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>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
28 #include <libart_lgpl/art_misc.h>
29 #include <libart_lgpl/art_pixbuf.h>
30 #include <libart_lgpl/art_filterlevel.h>
37 #include <gdk-pixbuf/gdk-pixbuf-features.h>
39 /* GdkPixbuf structures */
40 typedef struct _GdkPixbuf GdkPixbuf;
41 typedef struct _GdkPixbufFrame GdkPixbufFrame;
42 typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
49 ArtPixBuf *art_pixbuf;
52 /* GIF-like animation overlay modes for frames */
54 GDK_PIXBUF_FRAME_RETAIN,
55 GDK_PIXBUF_FRAME_DISPOSE,
56 GDK_PIXBUF_FRAME_REVERT
57 } GdkPixbufFrameAction;
59 struct _GdkPixbufFrame {
60 /* The pixbuf with this frame's image data */
63 /* Offsets for overlaying onto the animation's area */
67 /* Frame duration in ms */
71 GdkPixbufFrameAction action;
74 struct _GdkPixbufAnimation {
78 /* Number of frames */
81 /* List of GdkPixbufFrame structures */
84 /* bounding box size */
90 /* Convenience functions */
92 ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
93 int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
94 gboolean gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
95 int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
96 guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
97 int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
98 int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
99 int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
101 /* Reference counting */
103 GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
104 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
106 /* Wrap a libart pixbuf */
107 GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
109 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
110 GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
111 int width, int height);
115 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
117 GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
120 int width, int height,
122 ArtDestroyNotify dfunc,
123 gpointer dfunc_data);
125 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
127 /* Adding an alpha channel */
128 GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
129 guchar r, guchar g, guchar b);
131 /* Rendering to a drawable */
133 /* Alpha compositing mode */
135 GDK_PIXBUF_ALPHA_BILEVEL,
136 GDK_PIXBUF_ALPHA_FULL
137 } GdkPixbufAlphaMode;
139 void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
140 int src_x, int src_y,
141 int dest_x, int dest_y,
142 int width, int height,
143 int alpha_threshold);
145 void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
146 GdkDrawable *drawable, GdkGC *gc,
147 int src_x, int src_y,
148 int dest_x, int dest_y,
149 int width, int height,
151 int x_dither, int y_dither);
153 void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
154 int src_x, int src_y,
155 int dest_x, int dest_y,
156 int width, int height,
157 GdkPixbufAlphaMode alpha_mode,
160 int x_dither, int y_dither);
162 void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
163 GdkPixmap **pixmap_return, GdkBitmap **mask_return,
164 int alpha_threshold);
166 /* Fetching a region from a drawable */
167 GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
168 GdkDrawable *src, GdkColormap *cmap,
169 int src_x, int src_y,
170 int dest_x, int dest_y,
171 int width, int height);
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);
182 void gdk_pixbuf_scale (const GdkPixbuf *src,
192 ArtFilterLevel filter_level);
193 void gdk_pixbuf_composite (const GdkPixbuf *src,
203 ArtFilterLevel filter_level,
205 void gdk_pixbuf_composite_color (const GdkPixbuf *src,
215 ArtFilterLevel filter_level,
223 GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
226 ArtFilterLevel filter_level);
227 GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
230 ArtFilterLevel filter_level,
236 /* Animation support */
238 GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
240 GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
241 void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
243 /* General (presently empty) initialization hooks, primarily for gnome-libs */
244 void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
245 void gdk_pixbuf_postinit (gpointer app, gpointer modinfo);