Skip to main content

web_sys/features/
gen_OffscreenCanvas.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "EventTarget",
9        extends = "::js_sys::Object",
10        js_name = "OffscreenCanvas",
11        typescript_type = "OffscreenCanvas"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `OffscreenCanvas` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
19    pub type OffscreenCanvas;
20    #[wasm_bindgen(method, getter, js_class = "OffscreenCanvas", js_name = "width")]
21    #[doc = "Getter for the `width` field of this object."]
22    #[doc = ""]
23    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/width)"]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
26    pub fn width(this: &OffscreenCanvas) -> u32;
27    #[wasm_bindgen(method, setter, js_class = "OffscreenCanvas", js_name = "width")]
28    #[doc = "Setter for the `width` field of this object."]
29    #[doc = ""]
30    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/width)"]
31    #[doc = ""]
32    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
33    pub fn set_width(this: &OffscreenCanvas, value: u32);
34    #[wasm_bindgen(method, getter, js_class = "OffscreenCanvas", js_name = "height")]
35    #[doc = "Getter for the `height` field of this object."]
36    #[doc = ""]
37    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/height)"]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
40    pub fn height(this: &OffscreenCanvas) -> u32;
41    #[wasm_bindgen(method, setter, js_class = "OffscreenCanvas", js_name = "height")]
42    #[doc = "Setter for the `height` field of this object."]
43    #[doc = ""]
44    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/height)"]
45    #[doc = ""]
46    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
47    pub fn set_height(this: &OffscreenCanvas, value: u32);
48    #[wasm_bindgen(catch, constructor, js_class = "OffscreenCanvas")]
49    #[doc = "The `new OffscreenCanvas(..)` constructor, creating a new instance of `OffscreenCanvas`."]
50    #[doc = ""]
51    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/OffscreenCanvas)"]
52    #[doc = ""]
53    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
54    pub fn new(width: u32, height: u32) -> Result<OffscreenCanvas, JsValue>;
55    #[wasm_bindgen(catch, method, js_class = "OffscreenCanvas", js_name = "convertToBlob")]
56    #[doc = "The `convertToBlob()` method."]
57    #[doc = ""]
58    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/convertToBlob)"]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
61    pub fn convert_to_blob(this: &OffscreenCanvas) -> Result<::js_sys::Promise, JsValue>;
62    #[cfg(feature = "ImageEncodeOptions")]
63    #[wasm_bindgen(catch, method, js_class = "OffscreenCanvas", js_name = "convertToBlob")]
64    #[doc = "The `convertToBlob()` method."]
65    #[doc = ""]
66    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/convertToBlob)"]
67    #[doc = ""]
68    #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`, `OffscreenCanvas`*"]
69    pub fn convert_to_blob_with_options(
70        this: &OffscreenCanvas,
71        options: &ImageEncodeOptions,
72    ) -> Result<::js_sys::Promise, JsValue>;
73    #[wasm_bindgen(catch, method, js_class = "OffscreenCanvas", js_name = "getContext")]
74    #[doc = "The `getContext()` method."]
75    #[doc = ""]
76    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/getContext)"]
77    #[doc = ""]
78    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
79    pub fn get_context(
80        this: &OffscreenCanvas,
81        context_id: &str,
82    ) -> Result<Option<::js_sys::Object>, JsValue>;
83    #[wasm_bindgen(catch, method, js_class = "OffscreenCanvas", js_name = "getContext")]
84    #[doc = "The `getContext()` method."]
85    #[doc = ""]
86    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/getContext)"]
87    #[doc = ""]
88    #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`*"]
89    pub fn get_context_with_context_options(
90        this: &OffscreenCanvas,
91        context_id: &str,
92        context_options: &::wasm_bindgen::JsValue,
93    ) -> Result<Option<::js_sys::Object>, JsValue>;
94    #[cfg(feature = "ImageBitmap")]
95    #[wasm_bindgen(
96        catch,
97        method,
98        js_class = "OffscreenCanvas",
99        js_name = "transferToImageBitmap"
100    )]
101    #[doc = "The `transferToImageBitmap()` method."]
102    #[doc = ""]
103    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/transferToImageBitmap)"]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `OffscreenCanvas`*"]
106    pub fn transfer_to_image_bitmap(this: &OffscreenCanvas) -> Result<ImageBitmap, JsValue>;
107}