summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf.h
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-04-11 07:03:25 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2000-04-11 07:03:25 +0000
commit829ed02435b643c2b3da57dfc1f5abb8124e55cc (patch)
treef0d9b9a6c0c047d93f634bab8d22bced16be3253 /gdk-pixbuf/gdk-pixbuf.h
parentdaaae930ad946e06f183794ffda8e17c4125b3d4 (diff)
downloadgtk+-829ed02435b643c2b3da57dfc1f5abb8124e55cc.tar.gz
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com)
2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.h')
-rw-r--r--gdk-pixbuf/gdk-pixbuf.h174
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);