]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/gdk-pixbuf-io.h
Emit the closed signal when closing the loader, pointed out by David
[~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 #ifndef GDK_PIXBUF_IO_H
30 #define GDK_PIXBUF_IO_H
31
32 #include <stdio.h>
33 #include <glib.h>
34 #include <gmodule.h>
35 #include <gdk-pixbuf/gdk-pixbuf-core.h>
36 #include <gdk-pixbuf/gdk-pixbuf-animation.h>
37
38 G_BEGIN_DECLS
39
40 typedef struct _GdkPixbufFormat GdkPixbufFormat;
41  
42 GSList    *gdk_pixbuf_get_formats            (void);
43 gchar     *gdk_pixbuf_format_get_name        (GdkPixbufFormat *format);
44 gchar     *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
45 gchar    **gdk_pixbuf_format_get_mime_types  (GdkPixbufFormat *format);
46 gchar    **gdk_pixbuf_format_get_extensions  (GdkPixbufFormat *format);
47 gboolean   gdk_pixbuf_format_is_writable     (GdkPixbufFormat *format);
48 gboolean   gdk_pixbuf_format_is_scalable     (GdkPixbufFormat *format);
49 gboolean   gdk_pixbuf_format_is_disabled     (GdkPixbufFormat *format);
50 void       gdk_pixbuf_format_set_disabled    (GdkPixbufFormat *format,
51                                               gboolean         disabled);
52 gchar     *gdk_pixbuf_format_get_license     (GdkPixbufFormat *format);
53
54 GdkPixbufFormat *gdk_pixbuf_get_file_info    (const gchar     *filename,
55                                               gint            *width, 
56                                               gint            *height);
57
58 #ifdef GDK_PIXBUF_ENABLE_BACKEND
59
60 \f
61
62 typedef void (* GdkPixbufModuleSizeFunc)           (gint *width, 
63                                                     gint *height, 
64                                                     gpointer user_data);
65
66 typedef void (* GdkPixbufModulePreparedFunc) (GdkPixbuf          *pixbuf,
67                                               GdkPixbufAnimation *anim,
68                                               gpointer            user_data);
69 typedef void (* GdkPixbufModuleUpdatedFunc)  (GdkPixbuf *pixbuf,
70                                               int        x,
71                                               int        y,
72                                               int        width,
73                                               int        height,
74                                               gpointer   user_data);
75
76 typedef struct _GdkPixbufModulePattern GdkPixbufModulePattern;
77 struct _GdkPixbufModulePattern {
78         char *prefix;
79         char *mask;
80         int relevance;
81 };
82
83 typedef struct _GdkPixbufModule GdkPixbufModule;
84 struct _GdkPixbufModule {
85         char *module_name;
86         char *module_path;
87         GModule *module;
88         GdkPixbufFormat *info;
89         
90         GdkPixbuf *(* load) (FILE    *f,
91                              GError **error);
92         GdkPixbuf *(* load_xpm_data) (const char **data);
93
94         /* Incremental loading */
95
96         gpointer (* begin_load)     (GdkPixbufModuleSizeFunc size_func,
97                                      GdkPixbufModulePreparedFunc prepare_func,
98                                      GdkPixbufModuleUpdatedFunc update_func,
99                                      gpointer user_data,
100                                      GError **error);
101         gboolean (* stop_load)      (gpointer context,
102                                      GError **error);
103         gboolean (* load_increment) (gpointer      context,
104                                      const guchar *buf,
105                                      guint         size,
106                                      GError      **error);
107
108         /* Animation loading */
109         GdkPixbufAnimation *(* load_animation) (FILE    *f,
110                                                 GError **error);
111
112         /* Saving */
113         gboolean (* save) (FILE      *f,
114                            GdkPixbuf *pixbuf,
115                            gchar    **param_keys,
116                            gchar    **param_values,
117                            GError   **error);
118
119         gboolean (*save_to_callback) (GdkPixbufSaveFunc save_func,
120                                       gpointer user_data,
121                                       GdkPixbuf *pixbuf,
122                                       gchar **option_keys,
123                                       gchar **option_values,
124                                       GError **error);
125   
126   /*< private >*/
127         void (*_reserved1) (void); 
128         void (*_reserved2) (void); 
129         void (*_reserved3) (void); 
130         void (*_reserved4) (void); 
131         void (*_reserved5) (void); 
132
133 };
134
135 typedef void (* GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
136 typedef void (* GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
137
138 /*  key/value pairs that can be attached by the pixbuf loader  */
139
140 gboolean gdk_pixbuf_set_option  (GdkPixbuf   *pixbuf,
141                                  const gchar *key,
142                                  const gchar *value);
143
144 typedef enum /*< skip >*/
145 {
146   GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0,
147   GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1,
148   GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2
149 } GdkPixbufFormatFlags;
150
151 struct _GdkPixbufFormat {
152   gchar *name;
153   GdkPixbufModulePattern *signature;
154   gchar *domain;
155   gchar *description;
156   gchar **mime_types;
157   gchar **extensions;
158   guint32 flags;
159   gboolean disabled;
160   gchar *license;
161 };
162
163
164 #endif /* GDK_PIXBUF_ENABLE_BACKEND */
165
166 G_END_DECLS
167
168 #endif /* GDK_PIXBUF_IO_H */