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