// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

#[cfg(feature = "v4_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
use crate::ColorState;
use crate::{Display, Texture, ffi};
use glib::translate::*;

glib::wrapper! {
    #[doc(alias = "GdkDmabufTextureBuilder")]
    pub struct DmabufTextureBuilder(Object<ffi::GdkDmabufTextureBuilder, ffi::GdkDmabufTextureBuilderClass>);

    match fn {
        type_ => || ffi::gdk_dmabuf_texture_builder_get_type(),
    }
}

impl DmabufTextureBuilder {
    #[doc(alias = "gdk_dmabuf_texture_builder_new")]
    pub fn new() -> DmabufTextureBuilder {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::gdk_dmabuf_texture_builder_new()) }
    }

    #[cfg(feature = "v4_16")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
    #[doc(alias = "gdk_dmabuf_texture_builder_get_color_state")]
    #[doc(alias = "get_color_state")]
    #[doc(alias = "color-state")]
    pub fn color_state(&self) -> Option<ColorState> {
        unsafe {
            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_color_state(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_display")]
    #[doc(alias = "get_display")]
    pub fn display(&self) -> Display {
        unsafe {
            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_display(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_fourcc")]
    #[doc(alias = "get_fourcc")]
    pub fn fourcc(&self) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_fourcc(self.to_glib_none().0) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_height")]
    #[doc(alias = "get_height")]
    pub fn height(&self) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_height(self.to_glib_none().0) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_modifier")]
    #[doc(alias = "get_modifier")]
    pub fn modifier(&self) -> u64 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_modifier(self.to_glib_none().0) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_n_planes")]
    #[doc(alias = "get_n_planes")]
    #[doc(alias = "n-planes")]
    pub fn n_planes(&self) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_n_planes(self.to_glib_none().0) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_offset")]
    #[doc(alias = "get_offset")]
    pub fn offset(&self, plane: u32) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_offset(self.to_glib_none().0, plane) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_premultiplied")]
    #[doc(alias = "get_premultiplied")]
    #[doc(alias = "premultiplied")]
    pub fn is_premultiplied(&self) -> bool {
        unsafe {
            from_glib(ffi::gdk_dmabuf_texture_builder_get_premultiplied(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_stride")]
    #[doc(alias = "get_stride")]
    pub fn stride(&self, plane: u32) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_stride(self.to_glib_none().0, plane) }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_update_region")]
    #[doc(alias = "get_update_region")]
    #[doc(alias = "update-region")]
    pub fn update_region(&self) -> Option<cairo::Region> {
        unsafe {
            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_update_region(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_update_texture")]
    #[doc(alias = "get_update_texture")]
    #[doc(alias = "update-texture")]
    pub fn update_texture(&self) -> Option<Texture> {
        unsafe {
            from_glib_none(ffi::gdk_dmabuf_texture_builder_get_update_texture(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gdk_dmabuf_texture_builder_get_width")]
    #[doc(alias = "get_width")]
    pub fn width(&self) -> u32 {
        unsafe { ffi::gdk_dmabuf_texture_builder_get_width(self.to_glib_none().0) }
    }
}

#[cfg(feature = "v4_14")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
impl Default for DmabufTextureBuilder {
    fn default() -> Self {
        Self::new()
    }
}
