[go: up one dir, main page]

gdk4/auto/
memory_texture.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, MemoryFormat, Paintable, Texture};
6use glib::translate::*;
7
8glib::wrapper! {
9    #[doc(alias = "GdkMemoryTexture")]
10    pub struct MemoryTexture(Object<ffi::GdkMemoryTexture, ffi::GdkMemoryTextureClass>) @extends Texture, @implements Paintable, gio::Icon, gio::LoadableIcon;
11
12    match fn {
13        type_ => || ffi::gdk_memory_texture_get_type(),
14    }
15}
16
17impl MemoryTexture {
18    #[doc(alias = "gdk_memory_texture_new")]
19    pub fn new(
20        width: i32,
21        height: i32,
22        format: MemoryFormat,
23        bytes: &glib::Bytes,
24        stride: usize,
25    ) -> MemoryTexture {
26        assert_initialized_main_thread!();
27        unsafe {
28            from_glib_full(ffi::gdk_memory_texture_new(
29                width,
30                height,
31                format.into_glib(),
32                bytes.to_glib_none().0,
33                stride,
34            ))
35        }
36    }
37}
38
39unsafe impl Send for MemoryTexture {}
40unsafe impl Sync for MemoryTexture {}