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 */
87 /* Convenience functions */
89 ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
90 int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
91 int gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
92 int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
93 guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
94 int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
95 int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
96 int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
98 /* Reference counting */
100 void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
101 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
103 /* Wrap a libart pixbuf */
104 GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
106 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
107 GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
108 int width, int height);
112 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
114 GdkPixbuf *gdk_pixbuf_new_from_data (guchar *data,
117 int width, int height,
119 ArtDestroyNotify dfunc,
120 gpointer dfunc_data);
122 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
124 /* Adding an alpha channel */
125 GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
126 guchar r, guchar g, guchar b);
128 /* Rendering to a drawable */
130 /* Alpha compositing mode */
132 GDK_PIXBUF_ALPHA_BILEVEL,
133 GDK_PIXBUF_ALPHA_FULL
134 } GdkPixbufAlphaMode;
136 void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
137 int src_x, int src_y,
138 int dest_x, int dest_y,
139 int width, int height,
140 int alpha_threshold);
142 void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
143 GdkDrawable *drawable, GdkGC *gc,
144 int src_x, int src_y,
145 int dest_x, int dest_y,
146 int width, int height,
148 int x_dither, int y_dither);
150 void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
151 int src_x, int src_y,
152 int dest_x, int dest_y,
153 int width, int height,
154 GdkPixbufAlphaMode alpha_mode,
157 int x_dither, int y_dither);
159 /* Fetching a region from a drawable */
160 GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
161 GdkDrawable *src, GdkColormap *cmap,
162 int src_x, int src_y,
163 int dest_x, int dest_y,
164 int width, int height);
168 void gdk_pixbuf_scale (GdkPixbuf *src,
178 ArtFilterLevel filter_level);
179 void gdk_pixbuf_composite (GdkPixbuf *src,
189 ArtFilterLevel filter_level,
191 void gdk_pixbuf_composite_color (GdkPixbuf *src,
201 ArtFilterLevel filter_level,
209 GdkPixbuf *gdk_pixbuf_scale_simple (GdkPixbuf *src,
212 ArtFilterLevel filter_level);
213 GdkPixbuf *gdk_pixbuf_composite_color_simple (GdkPixbuf *src,
216 ArtFilterLevel filter_level,
222 /* Animation support */
224 GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
226 void gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
227 void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
229 /* General (presently empty) initialization hooks, primarily for gnome-libs */
230 void gdk_pixbuf_preinit(gpointer app, gpointer modinfo);
231 void gdk_pixbuf_postinit(gpointer app, gpointer modinfo);