]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/gdk-pixbuf.h
New function to threshold a pixbuf's alpha channel into a bitmap.
[~andy/gtk] / gdk-pixbuf / gdk-pixbuf.h
1 /* GdkPixbuf library - Main header file
2  *
3  * Copyright (C) 1999 The Free Software Foundation
4  *
5  * Authors: Mark Crichton <crichton@gimp.org>
6  *          Miguel de Icaza <miguel@gnu.org>
7  *          Federico Mena-Quintero <federico@gimp.org>
8  *
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.
13  *
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.
18  *
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.
23  */
24
25 #ifndef GDK_PIXBUF_H
26 #define GDK_PIXBUF_H
27
28 #include <libart_lgpl/art_misc.h>
29 #include <libart_lgpl/art_pixbuf.h>
30 #include <gdk/gdk.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #pragma }
35 #endif
36
37 \f
38
39 /* GdkPixbuf structure */
40
41 typedef struct _GdkPixbuf GdkPixbuf;
42
43 struct _GdkPixbuf {
44         /* Reference count */
45         int ref_count;
46
47         /* Libart pixbuf */
48         ArtPixBuf *art_pixbuf;
49 };
50
51 \f
52
53 /* Convenience macros */
54
55 #define gdk_pixbuf_get_format(pixbuf) ((pixbuf)->art_pixbuf->format)
56 #define gdk_pixbuf_get_n_channels(pixbuf) ((pixbuf)->art_pixbuf->n_channels)
57 #define gdk_pixbuf_get_has_alpha(pixbuf) ((pixbuf)->art_pixbuf->has_alpha)
58 #define gdk_pixbuf_get_bits_per_sample(pixbuf) ((pixbuf)->art_pixbuf->bits_per_sample)
59 #define gdk_pixbuf_get_pixels(pixbuf) ((pixbuf)->art_pixbuf->pixels)
60 #define gdk_pixbuf_get_width(pixbuf) ((pixbuf)->art_pixbuf->width)
61 #define gdk_pixbuf_get_height(pixbuf) ((pixbuf)->art_pixbuf->height)
62 #define gdk_pixbuf_get_rowstride(pixbuf) ((pixbuf)->art_pixbuf->rowstride)
63
64 /* Reference counting */
65
66 void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
67 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
68
69 /* Wrap a libart pixbuf */
70
71 GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
72
73 /* Create a blank pixbuf with an optimal rowstride and a new buffer */
74
75 GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
76                            int width, int height);
77
78 /* Simple loading */
79
80 GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
81 GdkPixbuf *gdk_pixbuf_new_from_data (guchar *data, ArtPixFormat format, gboolean has_alpha,
82                                      int width, int height, int rowstride,
83                                      ArtDestroyNotify dfunc, gpointer dfunc_data);
84 GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const gchar **data);
85
86 /* Rendering to a drawable */
87
88 typedef enum {
89         GDK_PIXBUF_ALPHA_BILEVEL,
90         GDK_PIXBUF_ALPHA_FULL
91 } GdkPixbufAlphaMode;
92
93 void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
94                                         int src_x, int src_y,
95                                         int dest_x, int dest_y,
96                                         int width, int height,
97                                         int alpha_threshold);
98
99 void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf, GdkDrawable *drawable,
100                                     int src_x, int src_y,
101                                     int dest_x, int dest_y,
102                                     int width, int height,
103                                     GdkPixbufAlphaMode alpha_mode,
104                                     int alpha_threshold,
105                                     GdkRgbDither dither,
106                                     int x_dither, int y_dither);
107
108 /* Transformations */
109 #if 0
110 GdkPixbuf *gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h);
111 GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle);
112 #endif
113
114 \f
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif