Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
WIP: uddate GdkPixbuf
Browse files Browse the repository at this point in the history
Shows the generated files if gtk-rs/gir-files#72
is merged
  • Loading branch information
Paolo Borelli committed Jan 3, 2021
1 parent 5bef67e commit 5cf7ee3
Show file tree
Hide file tree
Showing 25 changed files with 294 additions and 25 deletions.
2 changes: 1 addition & 1 deletion atk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
2 changes: 1 addition & 1 deletion atk/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/pixbuf_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::pin::Pin;
use std::ptr;

glib::wrapper! {
pub struct PixbufAnimation(Object<ffi::GdkPixbufAnimation>);
pub struct PixbufAnimation(Object<ffi::GdkPixbufAnimation, ffi::GdkPixbufAnimationClass>);

match fn {
get_type => || ffi::gdk_pixbuf_animation_get_type(),
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
213 changes: 210 additions & 3 deletions gdk-pixbuf/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,109 @@ pub const GDK_PIXBUF_ROTATE_CLOCKWISE: GdkPixbufRotation = 270;

// Constants

// Flags
pub type GdkPixbufFormatFlags = c_uint;
pub const GDK_PIXBUF_FORMAT_WRITABLE: GdkPixbufFormatFlags = 1;
pub const GDK_PIXBUF_FORMAT_SCALABLE: GdkPixbufFormatFlags = 2;
pub const GDK_PIXBUF_FORMAT_THREADSAFE: GdkPixbufFormatFlags = 4;

// Callbacks
pub type GdkPixbufDestroyNotify = Option<unsafe extern "C" fn(*mut u8, gpointer)>;
pub type GdkPixbufModuleFillInfoFunc = Option<unsafe extern "C" fn(*mut GdkPixbufFormat)>;
pub type GdkPixbufModuleFillVtableFunc = Option<unsafe extern "C" fn(*mut GdkPixbufModule)>;
pub type GdkPixbufModulePreparedFunc =
Option<unsafe extern "C" fn(*mut GdkPixbuf, *mut GdkPixbufAnimation, gpointer)>;
pub type GdkPixbufModuleSizeFunc = Option<unsafe extern "C" fn(*mut c_int, *mut c_int, gpointer)>;
pub type GdkPixbufModuleUpdatedFunc =
Option<unsafe extern "C" fn(*mut GdkPixbuf, c_int, c_int, c_int, c_int, gpointer)>;
pub type GdkPixbufSaveFunc =
Option<unsafe extern "C" fn(*const u8, size_t, *mut *mut glib::GError, gpointer) -> gboolean>;

// Records
#[repr(C)]
pub struct GdkPixbufFormat(c_void);
#[derive(Copy, Clone)]
pub struct GdkPixbufAnimationClass {
pub parent_class: gobject::GObjectClass,
pub is_static_image: Option<unsafe extern "C" fn(*mut GdkPixbufAnimation) -> gboolean>,
pub get_static_image: Option<unsafe extern "C" fn(*mut GdkPixbufAnimation) -> *mut GdkPixbuf>,
pub get_size: Option<unsafe extern "C" fn(*mut GdkPixbufAnimation, *mut c_int, *mut c_int)>,
pub get_iter: Option<
unsafe extern "C" fn(
*mut GdkPixbufAnimation,
*const glib::GTimeVal,
) -> *mut GdkPixbufAnimationIter,
>,
}

impl ::std::fmt::Debug for GdkPixbufAnimationClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufAnimationClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("is_static_image", &self.is_static_image)
.field("get_static_image", &self.get_static_image)
.field("get_size", &self.get_size)
.field("get_iter", &self.get_iter)
.finish()
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct GdkPixbufAnimationIterClass {
pub parent_class: gobject::GObjectClass,
pub get_delay_time: Option<unsafe extern "C" fn(*mut GdkPixbufAnimationIter) -> c_int>,
pub get_pixbuf: Option<unsafe extern "C" fn(*mut GdkPixbufAnimationIter) -> *mut GdkPixbuf>,
pub on_currently_loading_frame:
Option<unsafe extern "C" fn(*mut GdkPixbufAnimationIter) -> gboolean>,
pub advance: Option<
unsafe extern "C" fn(*mut GdkPixbufAnimationIter, *const glib::GTimeVal) -> gboolean,
>,
}

impl ::std::fmt::Debug for GdkPixbufAnimationIterClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!(
"GdkPixbufAnimationIterClass @ {:?}",
self as *const _
))
.field("parent_class", &self.parent_class)
.field("get_delay_time", &self.get_delay_time)
.field("get_pixbuf", &self.get_pixbuf)
.field(
"on_currently_loading_frame",
&self.on_currently_loading_frame,
)
.field("advance", &self.advance)
.finish()
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct GdkPixbufFormat {
pub name: *mut c_char,
pub signature: *mut GdkPixbufModulePattern,
pub domain: *mut c_char,
pub description: *mut c_char,
pub mime_types: *mut *mut c_char,
pub extensions: *mut *mut c_char,
pub flags: u32,
pub disabled: gboolean,
pub license: *mut c_char,
}

impl ::std::fmt::Debug for GdkPixbufFormat {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufFormat @ {:?}", self as *const _))
.field("name", &self.name)
.field("signature", &self.signature)
.field("domain", &self.domain)
.field("description", &self.description)
.field("mime_types", &self.mime_types)
.field("extensions", &self.extensions)
.field("flags", &self.flags)
.field("disabled", &self.disabled)
.field("license", &self.license)
.finish()
}
}
Expand Down Expand Up @@ -93,6 +184,98 @@ impl ::std::fmt::Debug for GdkPixbufLoaderClass {
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct GdkPixbufModule {
pub module_name: *mut c_char,
pub module_path: *mut c_char,
pub module: gpointer,
pub info: *mut GdkPixbufFormat,
pub load: Option<unsafe extern "C" fn(*mut FILE, *mut *mut glib::GError) -> *mut GdkPixbuf>,
pub load_xpm_data: Option<unsafe extern "C" fn(*mut *const c_char) -> *mut GdkPixbuf>,
pub begin_load: Option<
unsafe extern "C" fn(
GdkPixbufModuleSizeFunc,
GdkPixbufModulePreparedFunc,
GdkPixbufModuleUpdatedFunc,
gpointer,
*mut *mut glib::GError,
) -> gpointer,
>,
pub stop_load: Option<unsafe extern "C" fn(gpointer, *mut *mut glib::GError) -> gboolean>,
pub load_increment: Option<
unsafe extern "C" fn(gpointer, *const u8, c_uint, *mut *mut glib::GError) -> gboolean,
>,
pub load_animation:
Option<unsafe extern "C" fn(*mut FILE, *mut *mut glib::GError) -> *mut GdkPixbufAnimation>,
pub save: Option<
unsafe extern "C" fn(
*mut FILE,
*mut GdkPixbuf,
*mut *mut c_char,
*mut *mut c_char,
*mut *mut glib::GError,
) -> gboolean,
>,
pub save_to_callback: Option<
unsafe extern "C" fn(
GdkPixbufSaveFunc,
gpointer,
*mut GdkPixbuf,
*mut *mut c_char,
*mut *mut c_char,
*mut *mut glib::GError,
) -> gboolean,
>,
pub is_save_option_supported: Option<unsafe extern "C" fn(*const c_char) -> gboolean>,
pub _reserved1: Option<unsafe extern "C" fn()>,
pub _reserved2: Option<unsafe extern "C" fn()>,
pub _reserved3: Option<unsafe extern "C" fn()>,
pub _reserved4: Option<unsafe extern "C" fn()>,
}

impl ::std::fmt::Debug for GdkPixbufModule {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufModule @ {:?}", self as *const _))
.field("module_name", &self.module_name)
.field("module_path", &self.module_path)
.field("module", &self.module)
.field("info", &self.info)
.field("load", &self.load)
.field("load_xpm_data", &self.load_xpm_data)
.field("begin_load", &self.begin_load)
.field("stop_load", &self.stop_load)
.field("load_increment", &self.load_increment)
.field("load_animation", &self.load_animation)
.field("save", &self.save)
.field("save_to_callback", &self.save_to_callback)
.field("is_save_option_supported", &self.is_save_option_supported)
.field("_reserved1", &self._reserved1)
.field("_reserved2", &self._reserved2)
.field("_reserved3", &self._reserved3)
.field("_reserved4", &self._reserved4)
.finish()
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct GdkPixbufModulePattern {
pub prefix: *mut c_char,
pub mask: *mut c_char,
pub relevance: c_int,
}

impl ::std::fmt::Debug for GdkPixbufModulePattern {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufModulePattern @ {:?}", self as *const _))
.field("prefix", &self.prefix)
.field("mask", &self.mask)
.field("relevance", &self.relevance)
.finish()
}
}

#[repr(C)]
pub struct _GdkPixbufSimpleAnimClass(c_void);

Expand All @@ -110,21 +293,29 @@ impl ::std::fmt::Debug for GdkPixbuf {
}

#[repr(C)]
pub struct GdkPixbufAnimation(c_void);
#[derive(Copy, Clone)]
pub struct GdkPixbufAnimation {
pub parent_instance: gobject::GObject,
}

impl ::std::fmt::Debug for GdkPixbufAnimation {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufAnimation @ {:?}", self as *const _))
.field("parent_instance", &self.parent_instance)
.finish()
}
}

#[repr(C)]
pub struct GdkPixbufAnimationIter(c_void);
#[derive(Copy, Clone)]
pub struct GdkPixbufAnimationIter {
pub parent_instance: gobject::GObject,
}

impl ::std::fmt::Debug for GdkPixbufAnimationIter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufAnimationIter @ {:?}", self as *const _))
.field("parent_instance", &self.parent_instance)
.finish()
}
}
Expand All @@ -144,6 +335,16 @@ impl ::std::fmt::Debug for GdkPixbufLoader {
}
}

#[repr(C)]
pub struct GdkPixbufNonAnim(c_void);

impl ::std::fmt::Debug for GdkPixbufNonAnim {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GdkPixbufNonAnim @ {:?}", self as *const _))
.finish()
}
}

#[repr(C)]
pub struct GdkPixbufSimpleAnim(c_void);

Expand Down Expand Up @@ -720,6 +921,12 @@ extern "C" {
error: *mut *mut glib::GError,
) -> gboolean;

//=========================================================================
// GdkPixbufNonAnim
//=========================================================================
pub fn gdk_pixbuf_non_anim_get_type() -> GType;
pub fn gdk_pixbuf_non_anim_new(pixbuf: *mut GdkPixbuf) -> *mut GdkPixbufAnimation;

//=========================================================================
// GdkPixbufSimpleAnim
//=========================================================================
Expand Down
59 changes: 59 additions & 0 deletions gdk-pixbuf/sys/tests/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,55 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[
alignment: align_of::<GdkPixbufAlphaMode>(),
},
),
(
"GdkPixbufAnimation",
Layout {
size: size_of::<GdkPixbufAnimation>(),
alignment: align_of::<GdkPixbufAnimation>(),
},
),
(
"GdkPixbufAnimationClass",
Layout {
size: size_of::<GdkPixbufAnimationClass>(),
alignment: align_of::<GdkPixbufAnimationClass>(),
},
),
(
"GdkPixbufAnimationIter",
Layout {
size: size_of::<GdkPixbufAnimationIter>(),
alignment: align_of::<GdkPixbufAnimationIter>(),
},
),
(
"GdkPixbufAnimationIterClass",
Layout {
size: size_of::<GdkPixbufAnimationIterClass>(),
alignment: align_of::<GdkPixbufAnimationIterClass>(),
},
),
(
"GdkPixbufError",
Layout {
size: size_of::<GdkPixbufError>(),
alignment: align_of::<GdkPixbufError>(),
},
),
(
"GdkPixbufFormat",
Layout {
size: size_of::<GdkPixbufFormat>(),
alignment: align_of::<GdkPixbufFormat>(),
},
),
(
"GdkPixbufFormatFlags",
Layout {
size: size_of::<GdkPixbufFormatFlags>(),
alignment: align_of::<GdkPixbufFormatFlags>(),
},
),
(
"GdkPixbufLoader",
Layout {
Expand All @@ -291,6 +333,20 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[
alignment: align_of::<GdkPixbufLoaderClass>(),
},
),
(
"GdkPixbufModule",
Layout {
size: size_of::<GdkPixbufModule>(),
alignment: align_of::<GdkPixbufModule>(),
},
),
(
"GdkPixbufModulePattern",
Layout {
size: size_of::<GdkPixbufModulePattern>(),
alignment: align_of::<GdkPixbufModulePattern>(),
},
),
(
"GdkPixbufRotation",
Layout {
Expand All @@ -315,6 +371,9 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY", "1"),
("(gint) GDK_PIXBUF_ERROR_UNKNOWN_TYPE", "3"),
("(gint) GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION", "4"),
("(guint) GDK_PIXBUF_FORMAT_SCALABLE", "2"),
("(guint) GDK_PIXBUF_FORMAT_THREADSAFE", "4"),
("(guint) GDK_PIXBUF_FORMAT_WRITABLE", "1"),
("(gint) GDK_PIXBUF_ROTATE_CLOCKWISE", "270"),
("(gint) GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE", "90"),
("(gint) GDK_PIXBUF_ROTATE_NONE", "0"),
Expand Down
3 changes: 3 additions & 0 deletions gdk-pixbuf/sys/tests/manual.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.

// The bindings include the pixbuf loader API
#define GDK_PIXBUF_ENABLE_BACKEND

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h>
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
2 changes: 1 addition & 1 deletion gdk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
2 changes: 1 addition & 1 deletion gdk/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ be0cc8b)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
from gir-files (https://github.com/gtk-rs/gir-files @ 524c43a+)
Loading

0 comments on commit 5cf7ee3

Please # to comment.