diff options
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.h')
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf.h | 174 |
1 files changed, 86 insertions, 88 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h index aca5ab36bd..5b82e086bc 100644 --- a/gdk-pixbuf/gdk-pixbuf.h +++ b/gdk-pixbuf/gdk-pixbuf.h @@ -5,6 +5,7 @@ * Authors: Mark Crichton <crichton@gimp.org> * Miguel de Icaza <miguel@gnu.org> * Federico Mena-Quintero <federico@gimp.org> + * Havoc Pennington <hp@redhat.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -25,9 +26,6 @@ #ifndef GDK_PIXBUF_H #define GDK_PIXBUF_H -#include <libart_lgpl/art_misc.h> -#include <libart_lgpl/art_pixbuf.h> -#include <libart_lgpl/art_filterlevel.h> #include <gdk/gdk.h> #ifdef __cplusplus @@ -36,98 +34,76 @@ extern "C" { #include <gdk-pixbuf/gdk-pixbuf-features.h> -/* GdkPixbuf structures */ -typedef struct _GdkPixbuf GdkPixbuf; -typedef struct _GdkPixbufFrame GdkPixbufFrame; -typedef struct _GdkPixbufAnimation GdkPixbufAnimation; - -struct _GdkPixbuf { - /* Reference count */ - int ref_count; - - /* Libart pixbuf */ - ArtPixBuf *art_pixbuf; -}; + -/* GIF-like animation overlay modes for frames */ +/* Color spaces; right now only RGB is supported */ typedef enum { - GDK_PIXBUF_FRAME_RETAIN, - GDK_PIXBUF_FRAME_DISPOSE, - GDK_PIXBUF_FRAME_REVERT -} GdkPixbufFrameAction; - -struct _GdkPixbufFrame { - /* The pixbuf with this frame's image data */ - GdkPixbuf *pixbuf; - - /* Offsets for overlaying onto the animation's area */ - int x_offset; - int y_offset; - - /* Frame duration in ms */ - int delay_time; - - /* Overlay mode */ - GdkPixbufFrameAction action; -}; - -struct _GdkPixbufAnimation { - /* Reference count */ - int ref_count; + GDK_COLORSPACE_RGB +} GdkColorspace; - /* Number of frames */ - int n_frames; - - /* List of GdkPixbufFrame structures */ - GList *frames; +/* All of these are opaque structures */ +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GdkPixbufFrame GdkPixbufFrame; +typedef struct _GdkPixbufAnimation GdkPixbufAnimation; - /* bounding box size */ - int width, height; -}; +typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data); -/* Convenience functions */ - -ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf); -int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf); -gboolean gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf); -int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf); -guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf); -int gdk_pixbuf_get_width (GdkPixbuf *pixbuf); -int gdk_pixbuf_get_height (GdkPixbuf *pixbuf); -int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf); - /* Reference counting */ GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf); void gdk_pixbuf_unref (GdkPixbuf *pixbuf); -/* Wrap a libart pixbuf */ -GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf); +/* GdkPixbuf accessors */ + +GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf); +int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf); +gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf); +int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf); +guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf); +int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf); +int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf); +int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf); + + /* Create a blank pixbuf with an optimal rowstride and a new buffer */ -GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample, +GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height); +/* Copy a pixbuf */ + +GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf); + /* Simple loading */ GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename); GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data, - ArtPixFormat format, + GdkColorspace colorspace, gboolean has_alpha, + int bits_per_sample, int width, int height, int rowstride, - ArtDestroyNotify dfunc, - gpointer dfunc_data); + GdkPixbufDestroyNotify destroy_fn, + gpointer destroy_fn_data); GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data); /* Adding an alpha channel */ -GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color, +GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b); +/* Copy an area of a pixbuf onto another one */ +void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf, + int src_x, int src_y, + int width, int height, + GdkPixbuf *dest_pixbuf, + int dest_x, int dest_y); + + + /* Rendering to a drawable */ /* Alpha compositing mode */ @@ -159,26 +135,29 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawab GdkRgbDither dither, int x_dither, int y_dither); -void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf, - GdkPixmap **pixmap_return, GdkBitmap **mask_return, - int alpha_threshold); +void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf, + GdkPixmap **pixmap_return, GdkBitmap **mask_return, + int alpha_threshold); /* Fetching a region from a drawable */ -GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, - GdkDrawable *src, GdkColormap *cmap, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height); +GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, + GdkDrawable *src, GdkColormap *cmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height); -/* Copy an area of a pixbuf onto another one */ -void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf, - int src_x, int src_y, - int width, int height, - GdkPixbuf *dest_pixbuf, - int dest_x, int dest_y); + /* Scaling */ +/* Interpolation modes */ +typedef enum { + GDK_INTERP_NEAREST, + GDK_INTERP_TILES, + GDK_INTERP_BILINEAR, + GDK_INTERP_HYPER +} GdkInterpType; + void gdk_pixbuf_scale (const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, @@ -189,7 +168,7 @@ void gdk_pixbuf_scale (const GdkPixbuf *src, double offset_y, double scale_x, double scale_y, - ArtFilterLevel filter_level); + GdkInterpType interp_type); void gdk_pixbuf_composite (const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, @@ -200,7 +179,7 @@ void gdk_pixbuf_composite (const GdkPixbuf *src, double offset_y, double scale_x, double scale_y, - ArtFilterLevel filter_level, + GdkInterpType interp_type, int overall_alpha); void gdk_pixbuf_composite_color (const GdkPixbuf *src, GdkPixbuf *dest, @@ -212,29 +191,39 @@ void gdk_pixbuf_composite_color (const GdkPixbuf *src, double offset_y, double scale_x, double scale_y, - ArtFilterLevel filter_level, + GdkInterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, - art_u32 color1, - art_u32 color2); + guint32 color1, + guint32 color2); GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src, int dest_width, int dest_height, - ArtFilterLevel filter_level); + GdkInterpType interp_type); + GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src, int dest_width, int dest_height, - ArtFilterLevel filter_level, + GdkInterpType interp_type, int overall_alpha, int check_size, - art_u32 color1, - art_u32 color2); + guint32 color1, + guint32 color2); + + /* Animation support */ +/* GIF-like animation overlay modes for frames */ +typedef enum { + GDK_PIXBUF_FRAME_RETAIN, + GDK_PIXBUF_FRAME_DISPOSE, + GDK_PIXBUF_FRAME_REVERT +} GdkPixbufFrameAction; + GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename); GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation); @@ -245,6 +234,15 @@ int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *an GList *gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation); int gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation); +/* Frame accessors */ + +GdkPixbuf *gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame); +int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame); +int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame); +int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame); +GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame); + + /* General (presently empty) initialization hooks, primarily for gnome-libs */ void gdk_pixbuf_preinit (gpointer app, gpointer modinfo); void gdk_pixbuf_postinit (gpointer app, gpointer modinfo); |