]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/gdk-pixbuf.h
Removed #PRAGMA } from headers. Also, make compile if you don't have it
[~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 #endif
35
36 \f
37
38 /* GdkPixbuf structure */
39
40 typedef struct _GdkPixbuf GdkPixbuf;
41
42 struct _GdkPixbuf {
43         /* Reference count */
44         int ref_count;
45
46         /* Libart pixbuf */
47         ArtPixBuf *art_pixbuf;
48 };
49
50 \f
51
52 /* Convenience functions */
53
54 ArtPixFormat gdk_pixbuf_get_format          (GdkPixbuf *pixbuf);
55 int          gdk_pixbuf_get_n_channels      (GdkPixbuf *pixbuf);
56 int          gdk_pixbuf_get_has_alpha       (GdkPixbuf *pixbuf);
57 int          gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
58 guchar      *gdk_pixbuf_get_pixels          (GdkPixbuf *pixbuf);
59 int          gdk_pixbuf_get_width           (GdkPixbuf *pixbuf);
60 int          gdk_pixbuf_get_height          (GdkPixbuf *pixbuf);
61 int          gdk_pixbuf_get_rowstride       (GdkPixbuf *pixbuf);
62
63 /* Reference counting */
64
65 void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
66 void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
67
68 /* Constructors */
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,
100                                     GdkDrawable *drawable, GdkGC *gc,
101                                     int src_x, int src_y,
102                                     int dest_x, int dest_y,
103                                     int width, int height,
104                                     GdkRgbDither dither,
105                                     int x_dither, int y_dither);
106
107 void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
108                                           int src_x, int src_y,
109                                           int dest_x, int dest_y,
110                                           int width, int height,
111                                           GdkPixbufAlphaMode alpha_mode,
112                                           int alpha_threshold,
113                                           GdkRgbDither dither,
114                                           int x_dither, int y_dither);
115
116 /* Transformations */
117 #if 0
118 GdkPixbuf *gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h);
119 GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle);
120 #endif
121
122 \f
123
124 #ifdef __cplusplus
125 }
126 #endif
127
128 #endif