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
use glib::object::IsA; use glib::translate::*; use std::fmt; use crate::Texture; glib_wrapper! { pub struct Offscreen(Object<ffi::CoglOffscreen, OffscreenClass>); match fn { get_type => || ffi::cogl_offscreen_get_gtype(), } } impl Offscreen { pub fn with_texture<P: IsA<Texture>>(texture: &P) -> Offscreen { unsafe { from_glib_full(ffi::cogl_offscreen_new_with_texture(texture.as_ref().to_glib_none().0)) } } } impl fmt::Display for Offscreen { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Offscreen") } }