cogl/auto/
flags.rs

1use glib::translate::*;
2use glib::{
3    value::{FromValue, FromValueOptional, SetValue, Value},
4    StaticType, Type,
5};
6
7bitflags! {
8    pub struct BufferAccess: u32 {
9        const READ = 1;
10        const WRITE = 2;
11        const READ_WRITE = 3;
12    }
13}
14
15#[doc(hidden)]
16impl ToGlib for BufferAccess {
17    type GlibType = ffi::CoglBufferAccess;
18
19    fn to_glib(&self) -> ffi::CoglBufferAccess {
20        self.bits()
21    }
22}
23
24#[doc(hidden)]
25impl FromGlib<ffi::CoglBufferAccess> for BufferAccess {
26    fn from_glib(value: ffi::CoglBufferAccess) -> BufferAccess {
27        BufferAccess::from_bits_truncate(value)
28    }
29}
30
31bitflags! {
32    pub struct BufferBit: u32 {
33        const COLOR = 1;
34        const DEPTH = 2;
35        const STENCIL = 4;
36    }
37}
38
39#[doc(hidden)]
40impl ToGlib for BufferBit {
41    type GlibType = ffi::CoglBufferBit;
42
43    fn to_glib(&self) -> ffi::CoglBufferBit {
44        self.bits()
45    }
46}
47
48#[doc(hidden)]
49impl FromGlib<ffi::CoglBufferBit> for BufferBit {
50    fn from_glib(value: ffi::CoglBufferBit) -> BufferBit {
51        BufferBit::from_bits_truncate(value)
52    }
53}
54
55impl StaticType for BufferBit {
56    fn static_type() -> Type {
57        unsafe { from_glib(ffi::cogl_buffer_bit_get_type()) }
58    }
59}
60
61impl<'a> FromValueOptional<'a> for BufferBit {
62    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
63        Some(FromValue::from_value(value))
64    }
65}
66
67impl<'a> FromValue<'a> for BufferBit {
68    unsafe fn from_value(value: &Value) -> Self {
69        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
70    }
71}
72
73impl SetValue for BufferBit {
74    unsafe fn set_value(value: &mut Value, this: &Self) {
75        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
76    }
77}
78
79bitflags! {
80    pub struct BufferMapHint: u32 {
81        const DISCARD = 1;
82        const DISCARD_RANGE = 2;
83    }
84}
85
86#[doc(hidden)]
87impl ToGlib for BufferMapHint {
88    type GlibType = ffi::CoglBufferMapHint;
89
90    fn to_glib(&self) -> ffi::CoglBufferMapHint {
91        self.bits()
92    }
93}
94
95#[doc(hidden)]
96impl FromGlib<ffi::CoglBufferMapHint> for BufferMapHint {
97    fn from_glib(value: ffi::CoglBufferMapHint) -> BufferMapHint {
98        BufferMapHint::from_bits_truncate(value)
99    }
100}
101
102bitflags! {
103    pub struct BufferTarget: u32 {
104        const WINDOW_BUFFER = 2;
105        const OFFSCREEN_BUFFER = 4;
106    }
107}
108
109#[doc(hidden)]
110impl ToGlib for BufferTarget {
111    type GlibType = ffi::CoglBufferTarget;
112
113    fn to_glib(&self) -> ffi::CoglBufferTarget {
114        self.bits()
115    }
116}
117
118#[doc(hidden)]
119impl FromGlib<ffi::CoglBufferTarget> for BufferTarget {
120    fn from_glib(value: ffi::CoglBufferTarget) -> BufferTarget {
121        BufferTarget::from_bits_truncate(value)
122    }
123}
124
125impl StaticType for BufferTarget {
126    fn static_type() -> Type {
127        unsafe { from_glib(ffi::cogl_buffer_target_get_type()) }
128    }
129}
130
131impl<'a> FromValueOptional<'a> for BufferTarget {
132    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
133        Some(FromValue::from_value(value))
134    }
135}
136
137impl<'a> FromValue<'a> for BufferTarget {
138    unsafe fn from_value(value: &Value) -> Self {
139        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
140    }
141}
142
143impl SetValue for BufferTarget {
144    unsafe fn set_value(value: &mut Value, this: &Self) {
145        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
146    }
147}
148
149bitflags! {
150    pub struct ColorMask: u32 {
151        const NONE = 0;
152        const RED = 1;
153        const GREEN = 2;
154        const BLUE = 4;
155        const ALPHA = 8;
156        const ALL = 15;
157    }
158}
159
160#[doc(hidden)]
161impl ToGlib for ColorMask {
162    type GlibType = ffi::CoglColorMask;
163
164    fn to_glib(&self) -> ffi::CoglColorMask {
165        self.bits()
166    }
167}
168
169#[doc(hidden)]
170impl FromGlib<ffi::CoglColorMask> for ColorMask {
171    fn from_glib(value: ffi::CoglColorMask) -> ColorMask {
172        ColorMask::from_bits_truncate(value)
173    }
174}
175
176impl StaticType for ColorMask {
177    fn static_type() -> Type {
178        unsafe { from_glib(ffi::cogl_color_mask_get_type()) }
179    }
180}
181
182impl<'a> FromValueOptional<'a> for ColorMask {
183    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
184        Some(FromValue::from_value(value))
185    }
186}
187
188impl<'a> FromValue<'a> for ColorMask {
189    unsafe fn from_value(value: &Value) -> Self {
190        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
191    }
192}
193
194impl SetValue for ColorMask {
195    unsafe fn set_value(value: &mut Value, this: &Self) {
196        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
197    }
198}
199
200bitflags! {
201    pub struct FeatureFlags: u32 {
202        const TEXTURE_RECTANGLE = 2;
203        const TEXTURE_NPOT = 4;
204        const TEXTURE_YUV = 8;
205        const TEXTURE_READ_PIXELS = 16;
206        const SHADERS_GLSL = 32;
207        const OFFSCREEN = 64;
208        const OFFSCREEN_MULTISAMPLE = 128;
209        const OFFSCREEN_BLIT = 256;
210        const FOUR_CLIP_PLANES = 512;
211        const STENCIL_BUFFER = 1024;
212        const VBOS = 2048;
213        const PBOS = 4096;
214        const UNSIGNED_INT_INDICES = 8192;
215        const DEPTH_RANGE = 16384;
216        const TEXTURE_NPOT_BASIC = 32768;
217        const TEXTURE_NPOT_MIPMAP = 65536;
218        const TEXTURE_NPOT_REPEAT = 131072;
219        const POINT_SPRITE = 262144;
220        const TEXTURE_3D = 524288;
221        const SHADERS_ARBFP = 1048576;
222        const MAP_BUFFER_FOR_READ = 2097152;
223        const MAP_BUFFER_FOR_WRITE = 4194304;
224        const ONSCREEN_MULTIPLE = 8388608;
225        const DEPTH_TEXTURE = 16777216;
226    }
227}
228
229#[doc(hidden)]
230impl ToGlib for FeatureFlags {
231    type GlibType = ffi::CoglFeatureFlags;
232
233    fn to_glib(&self) -> ffi::CoglFeatureFlags {
234        self.bits()
235    }
236}
237
238#[doc(hidden)]
239impl FromGlib<ffi::CoglFeatureFlags> for FeatureFlags {
240    fn from_glib(value: ffi::CoglFeatureFlags) -> FeatureFlags {
241        FeatureFlags::from_bits_truncate(value)
242    }
243}
244
245impl StaticType for FeatureFlags {
246    fn static_type() -> Type {
247        unsafe { from_glib(ffi::cogl_feature_flags_get_type()) }
248    }
249}
250
251impl<'a> FromValueOptional<'a> for FeatureFlags {
252    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
253        Some(FromValue::from_value(value))
254    }
255}
256
257impl<'a> FromValue<'a> for FeatureFlags {
258    unsafe fn from_value(value: &Value) -> Self {
259        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
260    }
261}
262
263impl SetValue for FeatureFlags {
264    unsafe fn set_value(value: &mut Value, this: &Self) {
265        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
266    }
267}
268
269bitflags! {
270    pub struct ReadPixelsFlags: u32 {
271        const COLOR_BUFFER = 1;
272    }
273}
274
275#[doc(hidden)]
276impl ToGlib for ReadPixelsFlags {
277    type GlibType = ffi::CoglReadPixelsFlags;
278
279    fn to_glib(&self) -> ffi::CoglReadPixelsFlags {
280        self.bits()
281    }
282}
283
284#[doc(hidden)]
285impl FromGlib<ffi::CoglReadPixelsFlags> for ReadPixelsFlags {
286    fn from_glib(value: ffi::CoglReadPixelsFlags) -> ReadPixelsFlags {
287        ReadPixelsFlags::from_bits_truncate(value)
288    }
289}
290
291impl StaticType for ReadPixelsFlags {
292    fn static_type() -> Type {
293        unsafe { from_glib(ffi::cogl_read_pixels_flags_get_type()) }
294    }
295}
296
297impl<'a> FromValueOptional<'a> for ReadPixelsFlags {
298    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
299        Some(FromValue::from_value(value))
300    }
301}
302
303impl<'a> FromValue<'a> for ReadPixelsFlags {
304    unsafe fn from_value(value: &Value) -> Self {
305        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
306    }
307}
308
309impl SetValue for ReadPixelsFlags {
310    unsafe fn set_value(value: &mut Value, this: &Self) {
311        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
312    }
313}
314
315bitflags! {
316    pub struct RendererConstraint: u32 {
317        const USES_X11 = 1;
318        const USES_XLIB = 2;
319        const USES_EGL = 4;
320        const SUPPORTS_COGL_GLES2 = 8;
321    }
322}
323
324#[doc(hidden)]
325impl ToGlib for RendererConstraint {
326    type GlibType = ffi::CoglRendererConstraint;
327
328    fn to_glib(&self) -> ffi::CoglRendererConstraint {
329        self.bits()
330    }
331}
332
333#[doc(hidden)]
334impl FromGlib<ffi::CoglRendererConstraint> for RendererConstraint {
335    fn from_glib(value: ffi::CoglRendererConstraint) -> RendererConstraint {
336        RendererConstraint::from_bits_truncate(value)
337    }
338}
339
340bitflags! {
341    pub struct TextureFlags: u32 {
342        const NONE = 0;
343        const NO_AUTO_MIPMAP = 1;
344        const NO_SLICING = 2;
345        const NO_ATLAS = 4;
346    }
347}
348
349#[doc(hidden)]
350impl ToGlib for TextureFlags {
351    type GlibType = ffi::CoglTextureFlags;
352
353    fn to_glib(&self) -> ffi::CoglTextureFlags {
354        self.bits()
355    }
356}
357
358#[doc(hidden)]
359impl FromGlib<ffi::CoglTextureFlags> for TextureFlags {
360    fn from_glib(value: ffi::CoglTextureFlags) -> TextureFlags {
361        TextureFlags::from_bits_truncate(value)
362    }
363}
364
365impl StaticType for TextureFlags {
366    fn static_type() -> Type {
367        unsafe { from_glib(ffi::cogl_texture_flags_get_type()) }
368    }
369}
370
371impl<'a> FromValueOptional<'a> for TextureFlags {
372    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
373        Some(FromValue::from_value(value))
374    }
375}
376
377impl<'a> FromValue<'a> for TextureFlags {
378    unsafe fn from_value(value: &Value) -> Self {
379        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
380    }
381}
382
383impl SetValue for TextureFlags {
384    unsafe fn set_value(value: &mut Value, this: &Self) {
385        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
386    }
387}