web_sys/features/
gen_WebGlContextAttributes.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebGLContextAttributes)]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `WebGlContextAttributes` dictionary."]
10 #[doc = ""]
11 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
12 pub type WebGlContextAttributes;
13 #[doc = "Get the `alpha` field of this object."]
14 #[doc = ""]
15 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
16 #[wasm_bindgen(method, getter = "alpha")]
17 pub fn get_alpha(this: &WebGlContextAttributes) -> Option<bool>;
18 #[doc = "Change the `alpha` field of this object."]
19 #[doc = ""]
20 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
21 #[wasm_bindgen(method, setter = "alpha")]
22 pub fn set_alpha(this: &WebGlContextAttributes, val: bool);
23 #[doc = "Get the `antialias` field of this object."]
24 #[doc = ""]
25 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
26 #[wasm_bindgen(method, getter = "antialias")]
27 pub fn get_antialias(this: &WebGlContextAttributes) -> Option<bool>;
28 #[doc = "Change the `antialias` field of this object."]
29 #[doc = ""]
30 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
31 #[wasm_bindgen(method, setter = "antialias")]
32 pub fn set_antialias(this: &WebGlContextAttributes, val: bool);
33 #[doc = "Get the `depth` field of this object."]
34 #[doc = ""]
35 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
36 #[wasm_bindgen(method, getter = "depth")]
37 pub fn get_depth(this: &WebGlContextAttributes) -> Option<bool>;
38 #[doc = "Change the `depth` field of this object."]
39 #[doc = ""]
40 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
41 #[wasm_bindgen(method, setter = "depth")]
42 pub fn set_depth(this: &WebGlContextAttributes, val: bool);
43 #[doc = "Get the `failIfMajorPerformanceCaveat` field of this object."]
44 #[doc = ""]
45 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
46 #[wasm_bindgen(method, getter = "failIfMajorPerformanceCaveat")]
47 pub fn get_fail_if_major_performance_caveat(this: &WebGlContextAttributes) -> Option<bool>;
48 #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object."]
49 #[doc = ""]
50 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
51 #[wasm_bindgen(method, setter = "failIfMajorPerformanceCaveat")]
52 pub fn set_fail_if_major_performance_caveat(this: &WebGlContextAttributes, val: bool);
53 #[cfg(feature = "WebGlPowerPreference")]
54 #[doc = "Get the `powerPreference` field of this object."]
55 #[doc = ""]
56 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"]
57 #[wasm_bindgen(method, getter = "powerPreference")]
58 pub fn get_power_preference(this: &WebGlContextAttributes) -> Option<WebGlPowerPreference>;
59 #[cfg(feature = "WebGlPowerPreference")]
60 #[doc = "Change the `powerPreference` field of this object."]
61 #[doc = ""]
62 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"]
63 #[wasm_bindgen(method, setter = "powerPreference")]
64 pub fn set_power_preference(this: &WebGlContextAttributes, val: WebGlPowerPreference);
65 #[doc = "Get the `premultipliedAlpha` field of this object."]
66 #[doc = ""]
67 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
68 #[wasm_bindgen(method, getter = "premultipliedAlpha")]
69 pub fn get_premultiplied_alpha(this: &WebGlContextAttributes) -> Option<bool>;
70 #[doc = "Change the `premultipliedAlpha` field of this object."]
71 #[doc = ""]
72 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
73 #[wasm_bindgen(method, setter = "premultipliedAlpha")]
74 pub fn set_premultiplied_alpha(this: &WebGlContextAttributes, val: bool);
75 #[doc = "Get the `preserveDrawingBuffer` field of this object."]
76 #[doc = ""]
77 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
78 #[wasm_bindgen(method, getter = "preserveDrawingBuffer")]
79 pub fn get_preserve_drawing_buffer(this: &WebGlContextAttributes) -> Option<bool>;
80 #[doc = "Change the `preserveDrawingBuffer` field of this object."]
81 #[doc = ""]
82 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
83 #[wasm_bindgen(method, setter = "preserveDrawingBuffer")]
84 pub fn set_preserve_drawing_buffer(this: &WebGlContextAttributes, val: bool);
85 #[doc = "Get the `stencil` field of this object."]
86 #[doc = ""]
87 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
88 #[wasm_bindgen(method, getter = "stencil")]
89 pub fn get_stencil(this: &WebGlContextAttributes) -> Option<bool>;
90 #[doc = "Change the `stencil` field of this object."]
91 #[doc = ""]
92 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
93 #[wasm_bindgen(method, setter = "stencil")]
94 pub fn set_stencil(this: &WebGlContextAttributes, val: bool);
95 #[cfg(web_sys_unstable_apis)]
96 #[doc = "Get the `xrCompatible` field of this object."]
97 #[doc = ""]
98 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
99 #[doc = ""]
100 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
101 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
102 #[wasm_bindgen(method, getter = "xrCompatible")]
103 pub fn get_xr_compatible(this: &WebGlContextAttributes) -> Option<bool>;
104 #[cfg(web_sys_unstable_apis)]
105 #[doc = "Change the `xrCompatible` field of this object."]
106 #[doc = ""]
107 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
108 #[doc = ""]
109 #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
110 #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
111 #[wasm_bindgen(method, setter = "xrCompatible")]
112 pub fn set_xr_compatible(this: &WebGlContextAttributes, val: bool);
113}
114impl WebGlContextAttributes {
115 #[doc = "Construct a new `WebGlContextAttributes`."]
116 #[doc = ""]
117 #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
118 pub fn new() -> Self {
119 #[allow(unused_mut)]
120 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
121 ret
122 }
123 #[deprecated = "Use `set_alpha()` instead."]
124 pub fn alpha(&mut self, val: bool) -> &mut Self {
125 self.set_alpha(val);
126 self
127 }
128 #[deprecated = "Use `set_antialias()` instead."]
129 pub fn antialias(&mut self, val: bool) -> &mut Self {
130 self.set_antialias(val);
131 self
132 }
133 #[deprecated = "Use `set_depth()` instead."]
134 pub fn depth(&mut self, val: bool) -> &mut Self {
135 self.set_depth(val);
136 self
137 }
138 #[deprecated = "Use `set_fail_if_major_performance_caveat()` instead."]
139 pub fn fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self {
140 self.set_fail_if_major_performance_caveat(val);
141 self
142 }
143 #[cfg(feature = "WebGlPowerPreference")]
144 #[deprecated = "Use `set_power_preference()` instead."]
145 pub fn power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self {
146 self.set_power_preference(val);
147 self
148 }
149 #[deprecated = "Use `set_premultiplied_alpha()` instead."]
150 pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self {
151 self.set_premultiplied_alpha(val);
152 self
153 }
154 #[deprecated = "Use `set_preserve_drawing_buffer()` instead."]
155 pub fn preserve_drawing_buffer(&mut self, val: bool) -> &mut Self {
156 self.set_preserve_drawing_buffer(val);
157 self
158 }
159 #[deprecated = "Use `set_stencil()` instead."]
160 pub fn stencil(&mut self, val: bool) -> &mut Self {
161 self.set_stencil(val);
162 self
163 }
164 #[cfg(web_sys_unstable_apis)]
165 #[deprecated = "Use `set_xr_compatible()` instead."]
166 pub fn xr_compatible(&mut self, val: bool) -> &mut Self {
167 self.set_xr_compatible(val);
168 self
169 }
170}
171impl Default for WebGlContextAttributes {
172 fn default() -> Self {
173 Self::new()
174 }
175}