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