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 Library 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 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library 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.
35 #include <gdk-pixbuf/gdk-pixbuf-features.h>
39 /* Color spaces; right now only RGB is supported */
44 /* All of these are opaque structures */
45 typedef struct _GdkPixbuf GdkPixbuf;
46 typedef struct _GdkPixbufFrame GdkPixbufFrame;
47 typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
49 typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
53 /* Reference counting */
55 GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
56 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
58 /* GdkPixbuf accessors */
60 GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
61 int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
62 gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
63 int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
64 guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
65 int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
66 int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
67 int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
71 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
72 GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
73 int width, int height);
77 GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
81 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
83 GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
84 GdkColorspace colorspace,
87 int width, int height,
89 GdkPixbufDestroyNotify destroy_fn,
90 gpointer destroy_fn_data);
92 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
94 /* Adding an alpha channel */
95 GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
96 guchar r, guchar g, guchar b);
98 /* Copy an area of a pixbuf onto another one */
99 void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
100 int src_x, int src_y,
101 int width, int height,
102 GdkPixbuf *dest_pixbuf,
103 int dest_x, int dest_y);
107 /* Rendering to a drawable */
109 /* Alpha compositing mode */
111 GDK_PIXBUF_ALPHA_BILEVEL,
112 GDK_PIXBUF_ALPHA_FULL
113 } GdkPixbufAlphaMode;
115 void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
116 int src_x, int src_y,
117 int dest_x, int dest_y,
118 int width, int height,
119 int alpha_threshold);
121 void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
122 GdkDrawable *drawable, GdkGC *gc,
123 int src_x, int src_y,
124 int dest_x, int dest_y,
125 int width, int height,
127 int x_dither, int y_dither);
129 void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
130 int src_x, int src_y,
131 int dest_x, int dest_y,
132 int width, int height,
133 GdkPixbufAlphaMode alpha_mode,
136 int x_dither, int y_dither);
138 void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
139 GdkPixmap **pixmap_return, GdkBitmap **mask_return,
140 int alpha_threshold);
142 /* Fetching a region from a drawable */
143 GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
144 GdkDrawable *src, GdkColormap *cmap,
145 int src_x, int src_y,
146 int dest_x, int dest_y,
147 int width, int height);
153 /* Interpolation modes */
161 void gdk_pixbuf_scale (const GdkPixbuf *src,
171 GdkInterpType interp_type);
172 void gdk_pixbuf_composite (const GdkPixbuf *src,
182 GdkInterpType interp_type,
184 void gdk_pixbuf_composite_color (const GdkPixbuf *src,
194 GdkInterpType interp_type,
202 GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
205 GdkInterpType interp_type);
207 GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
210 GdkInterpType interp_type,
218 /* Animation support */
220 /* GIF-like animation overlay modes for frames */
222 GDK_PIXBUF_FRAME_RETAIN,
223 GDK_PIXBUF_FRAME_DISPOSE,
224 GDK_PIXBUF_FRAME_REVERT
225 } GdkPixbufFrameAction;
227 GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
229 GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
230 void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
232 int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
233 int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
234 GList *gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation);
235 int gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation);
237 /* Frame accessors */
239 GdkPixbuf *gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame);
240 int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame);
241 int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame);
242 int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame);
243 GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame);
246 /* General (presently empty) initialization hooks, primarily for gnome-libs */
247 void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
248 void gdk_pixbuf_postinit (gpointer app, gpointer modinfo);