web_sys/features/
gen_HtmlCanvasElement.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = HtmlElement , extends = Element , extends = Node , extends = EventTarget , extends = :: js_sys :: Object , js_name = HTMLCanvasElement , typescript_type = "HTMLCanvasElement")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `HtmlCanvasElement` class."]
10    #[doc = ""]
11    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement)"]
12    #[doc = ""]
13    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
14    pub type HtmlCanvasElement;
15    # [wasm_bindgen (structural , method , getter , js_class = "HTMLCanvasElement" , js_name = width)]
16    #[doc = "Getter for the `width` field of this object."]
17    #[doc = ""]
18    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width)"]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
21    pub fn width(this: &HtmlCanvasElement) -> u32;
22    # [wasm_bindgen (structural , method , setter , js_class = "HTMLCanvasElement" , js_name = width)]
23    #[doc = "Setter for the `width` field of this object."]
24    #[doc = ""]
25    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width)"]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
28    pub fn set_width(this: &HtmlCanvasElement, value: u32);
29    # [wasm_bindgen (structural , method , getter , js_class = "HTMLCanvasElement" , js_name = height)]
30    #[doc = "Getter for the `height` field of this object."]
31    #[doc = ""]
32    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height)"]
33    #[doc = ""]
34    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
35    pub fn height(this: &HtmlCanvasElement) -> u32;
36    # [wasm_bindgen (structural , method , setter , js_class = "HTMLCanvasElement" , js_name = height)]
37    #[doc = "Setter for the `height` field of this object."]
38    #[doc = ""]
39    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height)"]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
42    pub fn set_height(this: &HtmlCanvasElement, value: u32);
43    #[cfg(feature = "MediaStream")]
44    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = captureStream)]
45    #[doc = "The `captureStream()` method."]
46    #[doc = ""]
47    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream)"]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `MediaStream`*"]
50    pub fn capture_stream(this: &HtmlCanvasElement) -> Result<MediaStream, JsValue>;
51    #[cfg(feature = "MediaStream")]
52    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = captureStream)]
53    #[doc = "The `captureStream()` method."]
54    #[doc = ""]
55    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream)"]
56    #[doc = ""]
57    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `MediaStream`*"]
58    pub fn capture_stream_with_frame_request_rate(
59        this: &HtmlCanvasElement,
60        frame_request_rate: f64,
61    ) -> Result<MediaStream, JsValue>;
62    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = getContext)]
63    #[doc = "The `getContext()` method."]
64    #[doc = ""]
65    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext)"]
66    #[doc = ""]
67    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
68    pub fn get_context(
69        this: &HtmlCanvasElement,
70        context_id: &str,
71    ) -> Result<Option<::js_sys::Object>, JsValue>;
72    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = getContext)]
73    #[doc = "The `getContext()` method."]
74    #[doc = ""]
75    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext)"]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
78    pub fn get_context_with_context_options(
79        this: &HtmlCanvasElement,
80        context_id: &str,
81        context_options: &::wasm_bindgen::JsValue,
82    ) -> Result<Option<::js_sys::Object>, JsValue>;
83    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toBlob)]
84    #[doc = "The `toBlob()` method."]
85    #[doc = ""]
86    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)"]
87    #[doc = ""]
88    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
89    pub fn to_blob(this: &HtmlCanvasElement, callback: &::js_sys::Function) -> Result<(), JsValue>;
90    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toBlob)]
91    #[doc = "The `toBlob()` method."]
92    #[doc = ""]
93    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)"]
94    #[doc = ""]
95    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
96    pub fn to_blob_with_type(
97        this: &HtmlCanvasElement,
98        callback: &::js_sys::Function,
99        type_: &str,
100    ) -> Result<(), JsValue>;
101    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toBlob)]
102    #[doc = "The `toBlob()` method."]
103    #[doc = ""]
104    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)"]
105    #[doc = ""]
106    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
107    pub fn to_blob_with_type_and_encoder_options(
108        this: &HtmlCanvasElement,
109        callback: &::js_sys::Function,
110        type_: &str,
111        encoder_options: &::wasm_bindgen::JsValue,
112    ) -> Result<(), JsValue>;
113    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toDataURL)]
114    #[doc = "The `toDataURL()` method."]
115    #[doc = ""]
116    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)"]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
119    pub fn to_data_url(this: &HtmlCanvasElement) -> Result<::alloc::string::String, JsValue>;
120    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toDataURL)]
121    #[doc = "The `toDataURL()` method."]
122    #[doc = ""]
123    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)"]
124    #[doc = ""]
125    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
126    pub fn to_data_url_with_type(
127        this: &HtmlCanvasElement,
128        type_: &str,
129    ) -> Result<::alloc::string::String, JsValue>;
130    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toDataURL)]
131    #[doc = "The `toDataURL()` method."]
132    #[doc = ""]
133    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)"]
134    #[doc = ""]
135    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"]
136    pub fn to_data_url_with_type_and_encoder_options(
137        this: &HtmlCanvasElement,
138        type_: &str,
139        encoder_options: &::wasm_bindgen::JsValue,
140    ) -> Result<::alloc::string::String, JsValue>;
141    #[cfg(feature = "OffscreenCanvas")]
142    # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = transferControlToOffscreen)]
143    #[doc = "The `transferControlToOffscreen()` method."]
144    #[doc = ""]
145    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen)"]
146    #[doc = ""]
147    #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `OffscreenCanvas`*"]
148    pub fn transfer_control_to_offscreen(
149        this: &HtmlCanvasElement,
150    ) -> Result<OffscreenCanvas, JsValue>;
151}