cogl/
texture_vertex.rs

1#![allow(unused_imports)]
2use crate::Color;
3use glib::translate::*;
4use std::mem;
5
6#[repr(C)]
7#[derive(Clone, Debug, PartialEq)]
8pub struct TextureVertex {
9    pub x: f32,
10    pub y: f32,
11    pub z: f32,
12    pub tx: f32,
13    pub ty: f32,
14    pub color: Color, //TODO: fixme Copy
15}
16
17#[doc(hidden)]
18impl Uninitialized for TextureVertex {
19    #[inline]
20    unsafe fn uninitialized() -> Self {
21        mem::zeroed()
22    }
23}
24
25#[doc(hidden)]
26impl<'a> ToGlibPtr<'a, *const ffi::CoglTextureVertex> for TextureVertex {
27    type Storage = &'a Self;
28
29    #[inline]
30    fn to_glib_none(&'a self) -> Stash<'a, *const ffi::CoglTextureVertex, Self> {
31        let ptr: *const TextureVertex = &*self;
32        Stash(ptr as *const ffi::CoglTextureVertex, self)
33    }
34}
35
36#[doc(hidden)]
37impl<'a> ToGlibPtrMut<'a, *mut ffi::CoglTextureVertex> for TextureVertex {
38    type Storage = &'a mut Self;
39
40    #[inline]
41    fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::CoglTextureVertex, Self> {
42        let ptr: *mut TextureVertex = &mut *self;
43        StashMut(ptr as *mut ffi::CoglTextureVertex, self)
44    }
45}
46
47// #[doc(hidden)]
48// impl FromGlibPtrNone<*const ffi::CoglTextureVertex> for TextureVertex {
49//     unsafe fn from_glib_none(ptr: *const ffi::CoglTextureVertex) -> Self {
50//         *(ptr as *const TextureVertex)
51//     }
52// }
53
54// #[doc(hidden)]
55// impl FromGlibPtrNone<*mut ffi::CoglTextureVertex> for TextureVertex {
56//     unsafe fn from_glib_none(ptr: *mut ffi::CoglTextureVertex) -> Self {
57//         *(ptr as *mut TextureVertex)
58//     }
59// }
60
61// #[doc(hidden)]
62// impl FromGlibPtrBorrow<*mut ffi::CoglTextureVertex> for TextureVertex {
63//     unsafe fn from_glib_borrow(
64//         ptr: *mut ffi::CoglTextureVertex,
65//     ) -> glib::translate::Borrowed<Self> {
66//         glib::translate::Borrowed::new(*(ptr as *mut TextureVertex))
67//     }
68// }
69
70// #[doc(hidden)]
71// impl FromGlibPtrBorrow<*const ffi::CoglTextureVertex> for TextureVertex {
72//     unsafe fn from_glib_borrow(
73//         ptr: *const ffi::CoglTextureVertex,
74//     ) -> glib::translate::Borrowed<Self> {
75//         glib::translate::Borrowed::new(*(ptr as *const TextureVertex))
76//     }
77// }