// Generated by gir (https://github.com/gtk-rs/gir @ c93f8f31b6a5)
// from  (@ 3879ff8e0201)
// from gir-files (@ 01ea5f1a07cd)
// DO NOT EDIT

#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(
    clippy::approx_constant,
    clippy::type_complexity,
    clippy::unreadable_literal,
    clippy::upper_case_acronyms
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[allow(unused_imports)]
use std::ffi::{
    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
};

#[allow(unused_imports)]
use glib::{GType, gboolean, gconstpointer, gpointer};
#[allow(unused_imports)]
use libc::{FILE, intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t};
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
use {gio_sys as gio, glib_sys as glib, gobject_sys as gobject};

// Enums
pub type GlyLoaderError = c_int;
pub const GLY_LOADER_ERROR_FAILED: GlyLoaderError = 0;
pub const GLY_LOADER_ERROR_UNKNOWN_IMAGE_FORMAT: GlyLoaderError = 1;
pub const GLY_LOADER_ERROR_NO_MORE_FRAMES: GlyLoaderError = 2;

pub type GlyMemoryFormat = c_int;
pub const GLY_MEMORY_B8G8R8A8_PREMULTIPLIED: GlyMemoryFormat = 0;
pub const GLY_MEMORY_A8R8G8B8_PREMULTIPLIED: GlyMemoryFormat = 1;
pub const GLY_MEMORY_R8G8B8A8_PREMULTIPLIED: GlyMemoryFormat = 2;
pub const GLY_MEMORY_B8G8R8A8: GlyMemoryFormat = 3;
pub const GLY_MEMORY_A8R8G8B8: GlyMemoryFormat = 4;
pub const GLY_MEMORY_R8G8B8A8: GlyMemoryFormat = 5;
pub const GLY_MEMORY_A8B8G8R8: GlyMemoryFormat = 6;
pub const GLY_MEMORY_R8G8B8: GlyMemoryFormat = 7;
pub const GLY_MEMORY_B8G8R8: GlyMemoryFormat = 8;
pub const GLY_MEMORY_R16G16B16: GlyMemoryFormat = 9;
pub const GLY_MEMORY_R16G16B16A16_PREMULTIPLIED: GlyMemoryFormat = 10;
pub const GLY_MEMORY_R16G16B16A16: GlyMemoryFormat = 11;
pub const GLY_MEMORY_R16G16B16_FLOAT: GlyMemoryFormat = 12;
pub const GLY_MEMORY_R16G16B16A16_FLOAT: GlyMemoryFormat = 13;
pub const GLY_MEMORY_R32G32B32_FLOAT: GlyMemoryFormat = 14;
pub const GLY_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: GlyMemoryFormat = 15;
pub const GLY_MEMORY_R32G32B32A32_FLOAT: GlyMemoryFormat = 16;
pub const GLY_MEMORY_G8A8_PREMULTIPLIED: GlyMemoryFormat = 17;
pub const GLY_MEMORY_G8A8: GlyMemoryFormat = 18;
pub const GLY_MEMORY_G8: GlyMemoryFormat = 19;
pub const GLY_MEMORY_G16A16_PREMULTIPLIED: GlyMemoryFormat = 20;
pub const GLY_MEMORY_G16A16: GlyMemoryFormat = 21;
pub const GLY_MEMORY_G16: GlyMemoryFormat = 22;

pub type GlySandboxSelector = c_int;
pub const GLY_SANDBOX_SELECTOR_AUTO: GlySandboxSelector = 0;
pub const GLY_SANDBOX_SELECTOR_BWRAP: GlySandboxSelector = 1;
pub const GLY_SANDBOX_SELECTOR_FLATPAK_SPAWN: GlySandboxSelector = 2;
pub const GLY_SANDBOX_SELECTOR_NOT_SANDBOXED: GlySandboxSelector = 3;

// Flags
pub type GlyMemoryFormatSelection = c_uint;
pub const GLY_MEMORY_SELECTION_B8G8R8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 1;
pub const GLY_MEMORY_SELECTION_A8R8G8B8_PREMULTIPLIED: GlyMemoryFormatSelection = 2;
pub const GLY_MEMORY_SELECTION_R8G8B8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 4;
pub const GLY_MEMORY_SELECTION_B8G8R8A8: GlyMemoryFormatSelection = 8;
pub const GLY_MEMORY_SELECTION_A8R8G8B8: GlyMemoryFormatSelection = 16;
pub const GLY_MEMORY_SELECTION_R8G8B8A8: GlyMemoryFormatSelection = 32;
pub const GLY_MEMORY_SELECTION_A8B8G8R8: GlyMemoryFormatSelection = 64;
pub const GLY_MEMORY_SELECTION_R8G8B8: GlyMemoryFormatSelection = 128;
pub const GLY_MEMORY_SELECTION_B8G8R8: GlyMemoryFormatSelection = 256;
pub const GLY_MEMORY_SELECTION_R16G16B16: GlyMemoryFormatSelection = 512;
pub const GLY_MEMORY_SELECTION_R16G16B16A16_PREMULTIPLIED: GlyMemoryFormatSelection = 1024;
pub const GLY_MEMORY_SELECTION_R16G16B16A16: GlyMemoryFormatSelection = 2048;
pub const GLY_MEMORY_SELECTION_R16G16B16_FLOAT: GlyMemoryFormatSelection = 4096;
pub const GLY_MEMORY_SELECTION_R16G16B16A16_FLOAT: GlyMemoryFormatSelection = 8192;
pub const GLY_MEMORY_SELECTION_R32G32B32_FLOAT: GlyMemoryFormatSelection = 16384;
pub const GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT_PREMULTIPLIED: GlyMemoryFormatSelection = 32768;
pub const GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT: GlyMemoryFormatSelection = 65536;
pub const GLY_MEMORY_SELECTION_G8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 131072;
pub const GLY_MEMORY_SELECTION_G8A8: GlyMemoryFormatSelection = 262144;
pub const GLY_MEMORY_SELECTION_G8: GlyMemoryFormatSelection = 524288;
pub const GLY_MEMORY_SELECTION_G16A16_PREMULTIPLIED: GlyMemoryFormatSelection = 1048576;
pub const GLY_MEMORY_SELECTION_G16A16: GlyMemoryFormatSelection = 2097152;
pub const GLY_MEMORY_SELECTION_G16: GlyMemoryFormatSelection = 4194304;

// Callbacks
pub type GlyLoaderGetMimeTypesDoneFunc = Option<unsafe extern "C" fn(*mut *mut c_char, gpointer)>;

// Records
#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyCicp {
    pub color_primaries: u8,
    pub transfer_characteristics: u8,
    pub matrix_coefficients: u8,
    pub video_full_range_flag: u8,
}

impl ::std::fmt::Debug for GlyCicp {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyCicp @ {self:p}"))
            .field("color_primaries", &self.color_primaries)
            .field("transfer_characteristics", &self.transfer_characteristics)
            .field("matrix_coefficients", &self.matrix_coefficients)
            .field("video_full_range_flag", &self.video_full_range_flag)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyCreatorClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyCreatorClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyCreatorClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyEncodedImageClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyEncodedImageClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyEncodedImageClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyFrameClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyFrameClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyFrameClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyFrameRequestClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyFrameRequestClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyFrameRequestClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyImageClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyImageClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyImageClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyLoaderClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyLoaderClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyLoaderClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GlyNewFrameClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for GlyNewFrameClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyNewFrameClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

// Classes
#[repr(C)]
#[allow(dead_code)]
pub struct GlyCreator {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyCreator {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyCreator @ {self:p}")).finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyEncodedImage {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyEncodedImage {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyEncodedImage @ {self:p}"))
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyFrame {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyFrame {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyFrame @ {self:p}")).finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyFrameRequest {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyFrameRequest {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyFrameRequest @ {self:p}"))
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyImage {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyImage {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyImage @ {self:p}")).finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyLoader {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyLoader {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyLoader @ {self:p}")).finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct GlyNewFrame {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for GlyNewFrame {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GlyNewFrame @ {self:p}")).finish()
    }
}

unsafe extern "C" {

    //=========================================================================
    // GlyLoaderError
    //=========================================================================
    pub fn gly_loader_error_get_type() -> GType;
    pub fn gly_loader_error_quark() -> glib::GQuark;

    //=========================================================================
    // GlyMemoryFormat
    //=========================================================================
    pub fn gly_memory_format_get_type() -> GType;
    pub fn gly_memory_format_has_alpha(memory_format: GlyMemoryFormat) -> gboolean;
    pub fn gly_memory_format_is_premultiplied(memory_format: GlyMemoryFormat) -> gboolean;

    //=========================================================================
    // GlySandboxSelector
    //=========================================================================
    pub fn gly_sandbox_selector_get_type() -> GType;

    //=========================================================================
    // GlyMemoryFormatSelection
    //=========================================================================
    pub fn gly_memory_format_selection_get_type() -> GType;

    //=========================================================================
    // GlyCicp
    //=========================================================================
    pub fn gly_cicp_get_type() -> GType;
    pub fn gly_cicp_copy(cicp: *mut GlyCicp) -> *mut GlyCicp;
    pub fn gly_cicp_free(cicp: *mut GlyCicp);

    //=========================================================================
    // GlyCreator
    //=========================================================================
    pub fn gly_creator_get_type() -> GType;
    pub fn gly_creator_new(
        mime_type: *const c_char,
        error: *mut *mut glib::GError,
    ) -> *mut GlyCreator;
    pub fn gly_creator_add_frame(
        creator: *mut GlyCreator,
        width: u32,
        height: u32,
        memory_format: GlyMemoryFormat,
        texture: *mut glib::GBytes,
        error: *mut *mut glib::GError,
    ) -> *mut GlyNewFrame;
    pub fn gly_creator_add_frame_with_stride(
        creator: *mut GlyCreator,
        width: u32,
        height: u32,
        stride: u32,
        memory_format: GlyMemoryFormat,
        texture: *mut glib::GBytes,
        error: *mut *mut glib::GError,
    ) -> *mut GlyNewFrame;
    pub fn gly_creator_add_metadata_key_value(
        creator: *mut GlyCreator,
        key: *const c_char,
        value: *const c_char,
    ) -> gboolean;
    pub fn gly_creator_create(
        image: *mut GlyCreator,
        error: *mut *mut glib::GError,
    ) -> *mut GlyEncodedImage;
    pub fn gly_creator_create_async(
        creator: *mut GlyCreator,
        cancellable: *mut gio::GCancellable,
        callback: gio::GAsyncReadyCallback,
        user_data: gpointer,
    );
    pub fn gly_creator_create_finish(
        creator: *mut GlyCreator,
        result: *mut gio::GAsyncResult,
        error: *mut *mut glib::GError,
    ) -> *mut GlyEncodedImage;
    pub fn gly_creator_set_encoding_compression(
        creator: *mut GlyCreator,
        compression: u8,
    ) -> gboolean;
    pub fn gly_creator_set_encoding_quality(creator: *mut GlyCreator, quality: u8) -> gboolean;
    pub fn gly_creator_set_sandbox_selector(
        creator: *mut GlyCreator,
        sandbox_selector: GlySandboxSelector,
    ) -> gboolean;

    //=========================================================================
    // GlyEncodedImage
    //=========================================================================
    pub fn gly_encoded_image_get_type() -> GType;
    pub fn gly_encoded_image_get_data(encoded_image: *mut GlyEncodedImage) -> *mut glib::GBytes;

    //=========================================================================
    // GlyFrame
    //=========================================================================
    pub fn gly_frame_get_type() -> GType;
    pub fn gly_frame_get_buf_bytes(frame: *mut GlyFrame) -> *mut glib::GBytes;
    pub fn gly_frame_get_color_cicp(frame: *mut GlyFrame) -> *mut GlyCicp;
    pub fn gly_frame_get_delay(frame: *mut GlyFrame) -> i64;
    pub fn gly_frame_get_height(frame: *mut GlyFrame) -> u32;
    pub fn gly_frame_get_memory_format(frame: *mut GlyFrame) -> GlyMemoryFormat;
    pub fn gly_frame_get_stride(frame: *mut GlyFrame) -> u32;
    pub fn gly_frame_get_width(frame: *mut GlyFrame) -> u32;

    //=========================================================================
    // GlyFrameRequest
    //=========================================================================
    pub fn gly_frame_request_get_type() -> GType;
    pub fn gly_frame_request_new() -> *mut GlyFrameRequest;
    pub fn gly_frame_request_set_loop_animation(
        frame_request: *mut GlyFrameRequest,
        loop_animation: gboolean,
    );
    pub fn gly_frame_request_set_scale(
        frame_request: *mut GlyFrameRequest,
        width: u32,
        height: u32,
    );

    //=========================================================================
    // GlyImage
    //=========================================================================
    pub fn gly_image_get_type() -> GType;
    pub fn gly_image_get_height(image: *mut GlyImage) -> u32;
    pub fn gly_image_get_metadata_key_value(
        image: *mut GlyImage,
        key: *const c_char,
    ) -> *mut c_char;
    pub fn gly_image_get_metadata_keys(image: *mut GlyImage) -> *mut *mut c_char;
    pub fn gly_image_get_mime_type(image: *mut GlyImage) -> *const c_char;
    pub fn gly_image_get_specific_frame(
        image: *mut GlyImage,
        frame_request: *mut GlyFrameRequest,
        error: *mut *mut glib::GError,
    ) -> *mut GlyFrame;
    pub fn gly_image_get_specific_frame_async(
        image: *mut GlyImage,
        frame_request: *mut GlyFrameRequest,
        cancellable: *mut gio::GCancellable,
        callback: gio::GAsyncReadyCallback,
        user_data: gpointer,
    );
    pub fn gly_image_get_specific_frame_finish(
        image: *mut GlyImage,
        result: *mut gio::GAsyncResult,
        error: *mut *mut glib::GError,
    ) -> *mut GlyFrame;
    pub fn gly_image_get_transformation_orientation(image: *mut GlyImage) -> u16;
    pub fn gly_image_get_width(image: *mut GlyImage) -> u32;
    pub fn gly_image_next_frame(
        image: *mut GlyImage,
        error: *mut *mut glib::GError,
    ) -> *mut GlyFrame;
    pub fn gly_image_next_frame_async(
        image: *mut GlyImage,
        cancellable: *mut gio::GCancellable,
        callback: gio::GAsyncReadyCallback,
        user_data: gpointer,
    );
    pub fn gly_image_next_frame_finish(
        image: *mut GlyImage,
        result: *mut gio::GAsyncResult,
        error: *mut *mut glib::GError,
    ) -> *mut GlyFrame;

    //=========================================================================
    // GlyLoader
    //=========================================================================
    pub fn gly_loader_get_type() -> GType;
    pub fn gly_loader_new(file: *mut gio::GFile) -> *mut GlyLoader;
    pub fn gly_loader_new_for_bytes(bytes: *mut glib::GBytes) -> *mut GlyLoader;
    pub fn gly_loader_new_for_stream(stream: *mut gio::GInputStream) -> *mut GlyLoader;
    pub fn gly_loader_get_mime_types() -> *mut *mut c_char;
    pub fn gly_loader_get_mime_types_async(
        cancellable: *mut gio::GCancellable,
        callback: gio::GAsyncReadyCallback,
        user_data: gpointer,
    );
    pub fn gly_loader_get_mime_types_finish(
        result: *mut gio::GAsyncResult,
        error: *mut *mut glib::GError,
    ) -> *mut *mut c_char;
    pub fn gly_loader_load(loader: *mut GlyLoader, error: *mut *mut glib::GError) -> *mut GlyImage;
    pub fn gly_loader_load_async(
        loader: *mut GlyLoader,
        cancellable: *mut gio::GCancellable,
        callback: gio::GAsyncReadyCallback,
        user_data: gpointer,
    );
    pub fn gly_loader_load_finish(
        loader: *mut GlyLoader,
        result: *mut gio::GAsyncResult,
        error: *mut *mut glib::GError,
    ) -> *mut GlyImage;
    pub fn gly_loader_set_accepted_memory_formats(
        loader: *mut GlyLoader,
        memory_format_selection: GlyMemoryFormatSelection,
    );
    pub fn gly_loader_set_apply_transformations(
        loader: *mut GlyLoader,
        apply_transformations: gboolean,
    );
    pub fn gly_loader_set_sandbox_selector(
        loader: *mut GlyLoader,
        sandbox_selector: GlySandboxSelector,
    );

    //=========================================================================
    // GlyNewFrame
    //=========================================================================
    pub fn gly_new_frame_get_type() -> GType;
    pub fn gly_new_frame_set_color_icc_profile(
        new_frame: *mut GlyNewFrame,
        icc_profile: *mut glib::GBytes,
    ) -> gboolean;

}
