]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/gdk-pixbuf-io.h
a6e07ca62375fd7c3c93bd3cf708650ff92795b4
[~andy/gtk] / gdk-pixbuf / gdk-pixbuf-io.h
1 /* GdkPixbuf library - Io handling.  This is an internal header for 
2  * GdkPixbuf. You should never use it unless you are doing development for 
3  * GdkPixbuf itself.
4  *
5  * Copyright (C) 1999 The Free Software Foundation
6  *
7  * Authors: Mark Crichton <crichton@gimp.org>
8  *          Miguel de Icaza <miguel@gnu.org>
9  *          Federico Mena-Quintero <federico@gimp.org>
10  *          Jonathan Blandford <jrb@redhat.com>
11  *          Michael Fulbright <drmike@redhat.com>
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this library; if not, write to the
25  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26  * Boston, MA 02111-1307, USA.
27  */
28
29 #if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
30 #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
31 #endif
32
33 #ifndef GDK_PIXBUF_IO_H
34 #define GDK_PIXBUF_IO_H
35
36 #include <stdio.h>
37 #include <glib.h>
38 #include <gmodule.h>
39 #include <gdk-pixbuf/gdk-pixbuf-core.h>
40 #include <gdk-pixbuf/gdk-pixbuf-animation.h>
41
42 G_BEGIN_DECLS
43
44 typedef struct _GdkPixbufFormat GdkPixbufFormat;
45  
46 GSList    *gdk_pixbuf_get_formats            (void);
47 gchar     *gdk_pixbuf_format_get_name        (GdkPixbufFormat *format);
48 gchar     *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
49 gchar    **gdk_pixbuf_format_get_mime_types  (GdkPixbufFormat *format);
50 gchar    **gdk_pixbuf_format_get_extensions  (GdkPixbufFormat *format);
51 gboolean   gdk_pixbuf_format_is_writable     (GdkPixbufFormat *format);
52 gboolean   gdk_pixbuf_format_is_scalable     (GdkPixbufFormat *format);
53 gboolean   gdk_pixbuf_format_is_disabled     (GdkPixbufFormat *format);
54 void       gdk_pixbuf_format_set_disabled    (GdkPixbufFormat *format,
55                                               gboolean         disabled);
56 gchar     *gdk_pixbuf_format_get_license     (GdkPixbufFormat *format);
57
58 GdkPixbufFormat *gdk_pixbuf_get_file_info    (const gchar     *filename,
59                                               gint            *width, 
60                                               gint            *height);
61
62 #ifdef GDK_PIXBUF_ENABLE_BACKEND
63
64 \f
65
66 typedef void (* GdkPixbufModuleSizeFunc)           (gint *width, 
67                                                     gint *height, 
68                                                     gpointer user_data);
69
70 typedef void (* GdkPixbufModulePreparedFunc) (GdkPixbuf          *pixbuf,
71                                               GdkPixbufAnimation *anim,
72                                               gpointer            user_data);
73 typedef void (* GdkPixbufModuleUpdatedFunc)  (GdkPixbuf *pixbuf,
74                                               int        x,
75                                               int        y,
76                                               int        width,
77                                               int        height,
78                                               gpointer   user_data);
79
80 typedef struct _GdkPixbufModulePattern GdkPixbufModulePattern;
81 struct _GdkPixbufModulePattern {
82         char *prefix;
83         char *mask;
84         int relevance;
85 };
86
87 typedef struct _GdkPixbufModule GdkPixbufModule;
88 struct _GdkPixbufModule {
89         char *module_name;
90         char *module_path;
91         GModule *module;
92         GdkPixbufFormat *info;
93         
94         GdkPixbuf *(* load) (FILE    *f,
95                              GError **error);
96         GdkPixbuf *(* load_xpm_data) (const char **data);
97
98         /* Incremental loading */
99
100         gpointer (* begin_load)     (GdkPixbufModuleSizeFunc size_func,
101                                      GdkPixbufModulePreparedFunc prepare_func,
102                                      GdkPixbufModuleUpdatedFunc update_func,
103                                      gpointer user_data,
104                                      GError **error);
105         gboolean (* stop_load)      (gpointer context,
106                                      GError **error);
107         gboolean (* load_increment) (gpointer      context,
108                                      const guchar *buf,
109                                      guint         size,
110                                      GError      **error);
111
112         /* Animation loading */
113         GdkPixbufAnimation *(* load_animation) (FILE    *f,
114                                                 GError **error);
115
116         /* Saving */
117         gboolean (* save) (FILE      *f,
118                            GdkPixbuf *pixbuf,
119                            gchar    **param_keys,
120                            gchar    **param_values,
121                            GError   **error);
122
123         gboolean (*save_to_callback) (GdkPixbufSaveFunc save_func,
124                                       gpointer user_data,
125                                       GdkPixbuf *pixbuf,
126                                       gchar **option_keys,
127                                       gchar **option_values,
128                                       GError **error);
129   
130   /*< private >*/
131         void (*_reserved1) (void); 
132         void (*_reserved2) (void); 
133         void (*_reserved3) (void); 
134         void (*_reserved4) (void); 
135         void (*_reserved5) (void); 
136
137 };
138
139 typedef void (* GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
140 typedef void (* GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
141
142 /*  key/value pairs that can be attached by the pixbuf loader  */
143
144 gboolean gdk_pixbuf_set_option  (GdkPixbuf   *pixbuf,
145                                  const gchar *key,
146                                  const gchar *value);
147
148 typedef enum /*< skip >*/
149 {
150   GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0,
151   GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1,
152   GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2
153 } GdkPixbufFormatFlags;
154
155 struct _GdkPixbufFormat {
156   gchar *name;
157   GdkPixbufModulePattern *signature;
158   gchar *domain;
159   gchar *description;
160   gchar **mime_types;
161   gchar **extensions;
162   guint32 flags;
163   gboolean disabled;
164   gchar *license;
165 };
166
167
168 #endif /* GDK_PIXBUF_ENABLE_BACKEND */
169
170 G_END_DECLS
171
172 #endif /* GDK_PIXBUF_IO_H */