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>
38 /* GdkPixbuf structures */
39 typedef struct _GdkPixbuf GdkPixbuf;
40 typedef struct _GdkPixbufFrame GdkPixbufFrame;
41 typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
45 GDK_PIXBUF_FRAME_RETAIN,
46 GDK_PIXBUF_FRAME_DISPOSE,
47 GDK_PIXBUF_FRAME_REVERT
48 } GdkPixbufFrameAction;
56 ArtPixBuf *art_pixbuf;
60 struct _GdkPixbufFrame
67 GdkPixbufFrameAction action;
71 struct _GdkPixbufAnimation
79 /* Convenience functions */
81 ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
82 int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
83 int gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
84 int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
85 guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
86 int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
87 int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
88 int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
90 /* Reference counting */
92 void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
93 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
96 /* Wrap a libart pixbuf */
98 GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
100 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
102 GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
103 int width, int height);
107 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
108 GdkPixbuf *gdk_pixbuf_new_from_data (guchar *data,
111 int width, int height,
113 ArtDestroyNotify dfunc,
114 gpointer dfunc_data);
115 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const gchar **data);
117 /* Adding or removing alpha */
119 GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
120 guchar r, guchar g, guchar b);
122 /* Rendering to a drawable */
125 GDK_PIXBUF_ALPHA_BILEVEL,
126 GDK_PIXBUF_ALPHA_FULL
127 } GdkPixbufAlphaMode;
129 void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
130 int src_x, int src_y,
131 int dest_x, int dest_y,
132 int width, int height,
133 int alpha_threshold);
135 void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
136 GdkDrawable *drawable, GdkGC *gc,
137 int src_x, int src_y,
138 int dest_x, int dest_y,
139 int width, int height,
141 int x_dither, int y_dither);
143 void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
144 int src_x, int src_y,
145 int dest_x, int dest_y,
146 int width, int height,
147 GdkPixbufAlphaMode alpha_mode,
150 int x_dither, int y_dither);
153 /* Fetching a region from a drawable */
154 GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
155 GdkDrawable *src, GdkColormap *cmap,
156 int src_x, int src_y,
157 int dest_x, int dest_y,
158 int width, int height);
162 /* Animation loading */
164 GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
165 void gdk_pixbuf_animation_destroy (GdkPixbufAnimation *animation,
166 gboolean free_frames);