1 /* GdkPixbuf library - Main header file
3 * Copyright (C) 1999 The Free Software Foundation
5 * Authors: Mark Crichton <crichton@gimp.org>
6 * Miguel de Icaza <miguel@gnu.org>
7 * Federico Mena-Quintero <federico@gimp.org>
8 * Havoc Pennington <hp@redhat.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
30 #include <gdk-pixbuf/gdk-pixbuf-features.h>
31 #include <glib-object.h>
37 /* Alpha compositing mode */
40 GDK_PIXBUF_ALPHA_BILEVEL,
44 /* Color spaces; right now only RGB is supported.
45 * Note that these values are encoded in inline pixbufs
46 * as ints, so don't reorder them
52 /* All of these are opaque structures */
53 typedef struct _GdkPixbuf GdkPixbuf;
54 typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
55 typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
56 typedef struct _GdkPixbufFrame GdkPixbufFrame;
58 #define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ())
59 #define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf))
60 #define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF))
62 #define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ())
63 #define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation))
64 #define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION))
66 #define GDK_TYPE_PIXBUF_ANIMATION_ITER (gdk_pixbuf_animation_iter_get_type ())
67 #define GDK_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIter))
68 #define GDK_IS_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER))
70 /* Handler that must free the pixel array */
71 typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
73 #define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
76 /* image data hosed */
77 GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
78 /* no mem to load image */
79 GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
80 /* bad option passed to save routine */
81 GDK_PIXBUF_ERROR_BAD_OPTION,
82 /* unsupported image type (sort of an ENOSYS) */
83 GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
84 /* unsupported operation (load, save) for image type */
85 GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
86 GDK_PIXBUF_ERROR_FAILED
89 GQuark gdk_pixbuf_error_quark (void) G_GNUC_CONST;
93 GType gdk_pixbuf_get_type (void) G_GNUC_CONST;
95 /* Reference counting */
97 #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
98 GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
99 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
102 /* GdkPixbuf accessors */
104 GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
105 int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
106 gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
107 int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
108 guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
109 int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
110 int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
111 int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
115 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
116 GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
117 int width, int height);
121 GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
123 /* Create a pixbuf which points to the pixels of another pixbuf */
124 GdkPixbuf *gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
132 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename,
135 GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
136 GdkColorspace colorspace,
139 int width, int height,
141 GdkPixbufDestroyNotify destroy_fn,
142 gpointer destroy_fn_data);
144 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
145 GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length,
147 gboolean copy_pixels,
151 void gdk_pixbuf_fill (GdkPixbuf *pixbuf,
156 gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf,
157 const char *filename,
162 gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf,
163 const char *filename,
166 char **option_values,
169 /* Adding an alpha channel */
170 GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
171 guchar r, guchar g, guchar b);
173 /* Copy an area of a pixbuf onto another one */
174 void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
175 int src_x, int src_y,
176 int width, int height,
177 GdkPixbuf *dest_pixbuf,
178 int dest_x, int dest_y);
180 /* Brighten/darken and optionally make it pixelated-looking */
181 void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src,
188 /* Rendering to a drawable */
193 /* Interpolation modes */
201 void gdk_pixbuf_scale (const GdkPixbuf *src,
211 GdkInterpType interp_type);
212 void gdk_pixbuf_composite (const GdkPixbuf *src,
222 GdkInterpType interp_type,
224 void gdk_pixbuf_composite_color (const GdkPixbuf *src,
234 GdkInterpType interp_type,
242 GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
245 GdkInterpType interp_type);
247 GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
250 GdkInterpType interp_type,
258 /* Animation support */
260 GType gdk_pixbuf_animation_get_type (void) G_GNUC_CONST;
262 GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename,
265 #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
266 GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
267 void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
270 int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
271 int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
272 gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
273 GdkPixbuf *gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
275 GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
276 const GTimeVal *start_time);
277 GType gdk_pixbuf_animation_iter_get_type (void) G_GNUC_CONST;
278 int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
279 GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
280 gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
281 gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
282 const GTimeVal *current_time);
287 G_CONST_RETURN gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
294 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
295 #include <gdk-pixbuf/gdk-pixbuf-enum-types.h>