Skip to main content

web_sys/features/
gen_GpuCanvasConfiguration.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[cfg(web_sys_unstable_apis)]
6#[wasm_bindgen]
7extern "C" {
8    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasConfiguration)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `GpuCanvasConfiguration` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
13    #[doc = ""]
14    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type GpuCanvasConfiguration;
17    #[cfg(web_sys_unstable_apis)]
18    #[cfg(feature = "GpuCanvasAlphaMode")]
19    #[doc = "Get the `alphaMode` field of this object."]
20    #[doc = ""]
21    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"]
22    #[doc = ""]
23    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
24    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
25    #[wasm_bindgen(method, getter = "alphaMode")]
26    pub fn get_alpha_mode(this: &GpuCanvasConfiguration) -> Option<GpuCanvasAlphaMode>;
27    #[cfg(web_sys_unstable_apis)]
28    #[cfg(feature = "GpuCanvasAlphaMode")]
29    #[doc = "Change the `alphaMode` field of this object."]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"]
32    #[doc = ""]
33    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
34    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
35    #[wasm_bindgen(method, setter = "alphaMode")]
36    pub fn set_alpha_mode(this: &GpuCanvasConfiguration, val: GpuCanvasAlphaMode);
37    #[cfg(web_sys_unstable_apis)]
38    #[cfg(feature = "GpuDevice")]
39    #[doc = "Get the `device` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"]
42    #[doc = ""]
43    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
44    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
45    #[wasm_bindgen(method, getter = "device")]
46    pub fn get_device(this: &GpuCanvasConfiguration) -> GpuDevice;
47    #[cfg(web_sys_unstable_apis)]
48    #[cfg(feature = "GpuDevice")]
49    #[doc = "Change the `device` field of this object."]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"]
52    #[doc = ""]
53    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
54    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
55    #[wasm_bindgen(method, setter = "device")]
56    pub fn set_device(this: &GpuCanvasConfiguration, val: &GpuDevice);
57    #[cfg(web_sys_unstable_apis)]
58    #[cfg(feature = "GpuTextureFormat")]
59    #[doc = "Get the `format` field of this object."]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
62    #[doc = ""]
63    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
64    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
65    #[wasm_bindgen(method, getter = "format")]
66    pub fn get_format(this: &GpuCanvasConfiguration) -> GpuTextureFormat;
67    #[cfg(web_sys_unstable_apis)]
68    #[cfg(feature = "GpuTextureFormat")]
69    #[doc = "Change the `format` field of this object."]
70    #[doc = ""]
71    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
72    #[doc = ""]
73    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
74    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
75    #[wasm_bindgen(method, setter = "format")]
76    pub fn set_format(this: &GpuCanvasConfiguration, val: GpuTextureFormat);
77    #[cfg(web_sys_unstable_apis)]
78    #[cfg(feature = "GpuCanvasToneMapping")]
79    #[doc = "Get the `toneMapping` field of this object."]
80    #[doc = ""]
81    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"]
82    #[doc = ""]
83    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
84    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
85    #[wasm_bindgen(method, getter = "toneMapping")]
86    pub fn get_tone_mapping(this: &GpuCanvasConfiguration) -> Option<GpuCanvasToneMapping>;
87    #[cfg(web_sys_unstable_apis)]
88    #[cfg(feature = "GpuCanvasToneMapping")]
89    #[doc = "Change the `toneMapping` field of this object."]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"]
92    #[doc = ""]
93    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
94    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
95    #[wasm_bindgen(method, setter = "toneMapping")]
96    pub fn set_tone_mapping(this: &GpuCanvasConfiguration, val: &GpuCanvasToneMapping);
97    #[cfg(web_sys_unstable_apis)]
98    #[doc = "Get the `usage` field of this object."]
99    #[doc = ""]
100    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
101    #[doc = ""]
102    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
103    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
104    #[wasm_bindgen(method, getter = "usage")]
105    pub fn get_usage(this: &GpuCanvasConfiguration) -> Option<u32>;
106    #[cfg(web_sys_unstable_apis)]
107    #[doc = "Change the `usage` field of this object."]
108    #[doc = ""]
109    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
110    #[doc = ""]
111    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
112    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
113    #[wasm_bindgen(method, setter = "usage")]
114    pub fn set_usage(this: &GpuCanvasConfiguration, val: u32);
115    #[cfg(web_sys_unstable_apis)]
116    #[doc = "Get the `viewFormats` field of this object."]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
119    #[doc = ""]
120    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
121    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
122    #[wasm_bindgen(method, getter = "viewFormats")]
123    pub fn get_view_formats(
124        this: &GpuCanvasConfiguration,
125    ) -> Option<::js_sys::Array<::js_sys::JsString>>;
126    #[cfg(web_sys_unstable_apis)]
127    #[doc = "Change the `viewFormats` field of this object."]
128    #[doc = ""]
129    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
130    #[doc = ""]
131    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
132    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
133    #[wasm_bindgen(method, setter = "viewFormats")]
134    pub fn set_view_formats(this: &GpuCanvasConfiguration, val: &[::js_sys::JsString]);
135}
136#[cfg(web_sys_unstable_apis)]
137impl GpuCanvasConfiguration {
138    #[cfg(all(feature = "GpuDevice", feature = "GpuTextureFormat",))]
139    #[doc = "Construct a new `GpuCanvasConfiguration`."]
140    #[doc = ""]
141    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`, `GpuTextureFormat`*"]
142    #[doc = ""]
143    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
144    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
145    pub fn new(device: &GpuDevice, format: GpuTextureFormat) -> Self {
146        #[allow(unused_mut)]
147        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
148        ret.set_device(device);
149        ret.set_format(format);
150        ret
151    }
152    #[cfg(web_sys_unstable_apis)]
153    #[cfg(feature = "GpuCanvasAlphaMode")]
154    #[deprecated = "Use `set_alpha_mode()` instead."]
155    pub fn alpha_mode(&mut self, val: GpuCanvasAlphaMode) -> &mut Self {
156        self.set_alpha_mode(val);
157        self
158    }
159    #[cfg(web_sys_unstable_apis)]
160    #[cfg(feature = "GpuDevice")]
161    #[deprecated = "Use `set_device()` instead."]
162    pub fn device(&mut self, val: &GpuDevice) -> &mut Self {
163        self.set_device(val);
164        self
165    }
166    #[cfg(web_sys_unstable_apis)]
167    #[cfg(feature = "GpuTextureFormat")]
168    #[deprecated = "Use `set_format()` instead."]
169    pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self {
170        self.set_format(val);
171        self
172    }
173    #[cfg(web_sys_unstable_apis)]
174    #[cfg(feature = "GpuCanvasToneMapping")]
175    #[deprecated = "Use `set_tone_mapping()` instead."]
176    pub fn tone_mapping(&mut self, val: &GpuCanvasToneMapping) -> &mut Self {
177        self.set_tone_mapping(val);
178        self
179    }
180    #[cfg(web_sys_unstable_apis)]
181    #[deprecated = "Use `set_usage()` instead."]
182    pub fn usage(&mut self, val: u32) -> &mut Self {
183        self.set_usage(val);
184        self
185    }
186    #[cfg(web_sys_unstable_apis)]
187    #[deprecated = "Use `set_view_formats()` instead."]
188    pub fn view_formats(&mut self, val: &[::js_sys::JsString]) -> &mut Self {
189        self.set_view_formats(val);
190        self
191    }
192}