1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 module gtkc.gdkpixbuftypes;
25 
26 
27 public import gtkc.glibtypes;
28 public import gtkc.gobjecttypes;
29 public import gtkc.gdktypes;
30 public import gtkc.atktypes;
31 
32 version(Tango)
33 private import tango.stdc.stdio;
34 else
35 private import std.stdio;
36 
37 /**
38  * An enumeration containing three sets of flags for a GdkPixdata struct:
39  * one for the used colorspace, one for the width of the samples and one
40  * for the encoding of the pixel data.
41  * GDK_PIXDATA_COLOR_TYPE_RGB
42  * each pixel has red, green and blue samples.
43  * GDK_PIXDATA_COLOR_TYPE_RGBA
44  * each pixel has red, green and blue samples
45  *  and an alpha value.
46  * GDK_PIXDATA_COLOR_TYPE_MASK
47  * mask for the colortype flags of the enum.
48  * GDK_PIXDATA_SAMPLE_WIDTH_8
49  * each sample has 8 bits.
50  * GDK_PIXDATA_SAMPLE_WIDTH_MASK
51  * mask for the sample width flags of the enum.
52  * GDK_PIXDATA_ENCODING_RAW
53  * the pixel data is in raw form.
54  * GDK_PIXDATA_ENCODING_RLE
55  * the pixel data is run-length encoded. Runs may
56  *  be up to 127 bytes long; their length is stored in a single byte
57  *  preceding the pixel data for the run. If a run is constant, its length
58  *  byte has the high bit set and the pixel data consists of a single pixel
59  *  which must be repeated.
60  * GDK_PIXDATA_ENCODING_MASK
61  * mask for the encoding flags of the enum.
62  */
63 public enum GdkPixdataType
64 {
65 	/+* colorspace + alpha +/
66 	COLOR_TYPE_RGB = 0x01,
67 	COLOR_TYPE_RGBA = 0x02,
68 	COLOR_TYPE_MASK = 0xff,
69 	/+* width, support 8bits only currently +/
70 	SAMPLE_WIDTH_8 = 0x01 << 16,
71 	SAMPLE_WIDTH_MASK = 0x0f << 16,
72 	/+* encoding +/
73 	ENCODING_RAW = 0x01 << 24,
74 	ENCODING_RLE = 0x02 << 24,
75 	ENCODING_MASK = 0x0f << 24
76 }
77 alias GdkPixdataType PixdataType;
78 
79 /**
80  * An enumeration which is used by gdk_pixdata_to_csource() to
81  * determine the form of C source to be generated. The three values
82  * GDK_PIXDATA_DUMP_PIXDATA_STREAM, GDK_PIXDATA_DUMP_PIXDATA_STRUCT
83  * and GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
84  * GDK_PIXBUF_DUMP_GTYPES and GDK_PIXBUF_DUMP_CTYPES. The remaining
85  * elements are optional flags that can be freely added.
86  * GDK_PIXDATA_DUMP_PIXDATA_STREAM
87  * Generate pixbuf data stream (a single
88  *  string containing a serialized GdkPixdata structure in network byte
89  *  order).
90  * GDK_PIXDATA_DUMP_PIXDATA_STRUCT
91  * Generate GdkPixdata structure (needs
92  *  the GdkPixdata structure definition from gdk-pixdata.h).
93  * GDK_PIXDATA_DUMP_MACROS
94  * Generate *_ROWSTRIDE,
95  *  *_WIDTH, *_HEIGHT,
96  *  *_BYTES_PER_PIXEL and
97  *  *_RLE_PIXEL_DATA or *_PIXEL_DATA
98  *  macro definitions for the image.
99  * GDK_PIXDATA_DUMP_GTYPES
100  * Generate GLib data types instead of
101  *  standard C data types.
102  * GDK_PIXDATA_DUMP_CTYPES
103  * Generate standard C data types instead of
104  *  GLib data types.
105  * GDK_PIXDATA_DUMP_STATIC
106  * Generate static symbols.
107  * GDK_PIXDATA_DUMP_CONST
108  * Generate const symbols.
109  * GDK_PIXDATA_DUMP_RLE_DECODER
110  * Provide a *_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)
111  *  macro definition to decode run-length encoded image data.
112  */
113 public enum GdkPixdataDumpType
114 {
115 	/+* type of source to save +/
116 	PIXDATA_STREAM = 0,
117 	PIXDATA_STRUCT = 1,
118 	MACROS = 2,
119 	/+* type of variables to use +/
120 	GTYPES = 0,
121 	CTYPES = 1 << 8,
122 	STATIC = 1 << 9,
123 	CONST = 1 << 10,
124 	/+* save RLE decoder macro? +/
125 	RLE_DECODER = 1 << 16
126 }
127 alias GdkPixdataDumpType PixdataDumpType;
128 
129 /**
130  * Flags which allow a module to specify further details about the supported
131  * operations.
132  * GDK_PIXBUF_FORMAT_WRITABLE
133  * the module can write out images in the format.
134  * GDK_PIXBUF_FORMAT_SCALABLE
135  * the image format is scalable
136  * GDK_PIXBUF_FORMAT_THREADSAFE
137  * the module is threadsafe. If this flag is not
138  *  set, gdk-pixbuf; will use a lock to prevent multiple threads from using
139  *  this module at the same time. (Since 2.6)
140  * Since 2.2
141  */
142 public enum GdkPixbufFormatFlags
143 {
144 	WRITABLE = 1 << 0,
145 	SCALABLE = 1 << 1,
146 	THREADSAFE = 1 << 2
147 }
148 alias GdkPixbufFormatFlags PixbufFormatFlags;
149 
150 
151 /**
152  * Main Gtk struct.
153  * A GdkPixdata contains pixbuf information in a form suitable for
154  * serialization and streaming.
155  * guint32 magic;
156  * magic number. A valid GdkPixdata structure must have
157  * GDK_PIXBUF_MAGIC_NUMBER here.
158  * gint32 length;
159  * less than 1 to disable length checks, otherwise
160  * GDK_PIXDATA_HEADER_LENGTH + length of pixel_data.
161  * guint32 pixdata_type;
162  * information about colorspace, sample width and
163  * encoding, in a GdkPixdataType.
164  * guint32 rowstride;
165  * Distance in bytes between rows.
166  * guint32 width;
167  * Width of the image in pixels.
168  * guint32 height;
169  * Height of the image in pixels.
170  * guint8 *pixel_data;
171  * width x height pixels, encoded according to pixdata_type
172  * and rowstride.
173  */
174 public struct GdkPixdata
175 {
176 	uint magic; /+* GDK_PIXBUF_MAGIC_NUMBER +/
177 	int length; /+* <1 to disable length checks, otherwise:
178 	 * GDK_PIXDATA_HEADER_LENGTH + pixelData length
179 	+/
180 	uint pixdataType; /+* GdkPixdataType +/
181 	uint rowstride;
182 	uint width;
183 	uint height;
184 	ubyte *pixelData;
185 }
186 
187 
188 /**
189  * Main Gtk struct.
190  * An opaque struct representing an animation.
191  */
192 public struct GdkPixbufAnimation{}
193 
194 
195 /**
196  * An opaque struct representing an iterator which points to a
197  * certain position in an animation.
198  */
199 public struct GdkPixbufAnimationIter{}
200 
201 
202 /**
203  * An opaque struct representing a simple animation.
204  */
205 public struct GdkPixbufSimpleAnim{}
206 
207 
208 /**
209  * Main Gtk struct.
210  * The GdkPixbufLoader struct contains only private
211  * fields.
212  */
213 public struct GdkPixbufLoader{}
214 
215 
216 /**
217  * Main Gtk struct.
218  * A GdkPixbufFormat contains information about the image format accepted by a
219  * module. Only modules should access the fields directly, applications should
220  * use the gdk_pixbuf_format_* functions.
221  * gchar *name;
222  * the name of the image format.
223  * GdkPixbufModulePattern *signature;
224  * the signature of the module.
225  * gchar *domain;
226  * the message domain for the description.
227  * gchar *description;
228  * a description of the image format.
229  * gchar **mime_types;
230  * a NULL-terminated array of MIME types for the image format.
231  * gchar **extensions;
232  * a NULL-terminated array of typical filename extensions for the
233  * image format.
234  * guint32 flags;
235  * a combination of GdkPixbufFormatFlags.
236  * gboolean disabled;
237  * a boolean determining whether the loader is disabled.
238  * gchar *license;
239  * a string containing license information, typically set to
240  * shorthands like "GPL", "LGPL", etc.
241  * Since 2.2
242  */
243 public struct GdkPixbufFormat
244 {
245 	char *name;
246 	GdkPixbufModulePattern *signature;
247 	char *domain;
248 	char *description;
249 	char **mimeTypes;
250 	char **extensions;
251 	uint flags;
252 	int disabled;
253 	char *license;
254 }
255 
256 
257 /**
258  * The signature of a module is a set of prefixes. Prefixes are encoded as
259  * pairs of ordinary strings, where the second string, called the mask, if
260  * not NULL, must be of the same length as the first one and may contain
261  * ' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched,
262  * not matched, "don't-care"-bytes, zeros and non-zeros.
263  * Each prefix has an associated integer that describes the relevance of
264  * the prefix, with 0 meaning a mismatch and 100 a "perfect match".
265  * Starting with gdk-pixbuf; 2.8, the first byte of the mask may be '*',
266  * indicating an unanchored pattern that matches not only at the beginning,
267  * but also in the middle. Versions prior to 2.8 will interpret the '*'
268  * like an 'x'.
269  * The signature of a module is stored as an array of
270  * GdkPixbufModulePatterns. The array is terminated by a pattern
271  * where the prefix is NULL.
272  * $(DDOC_COMMENT example)
273  * char *prefix;
274  * the prefix for this pattern
275  * char *mask;
276  * mask containing bytes which modify how the prefix is matched against
277  * test data
278  * int relevance;
279  * relevance of this pattern
280  * Since 2.2
281  */
282 public struct GdkPixbufModulePattern
283 {
284 	char *prefix;
285 	char *mask;
286 	int relevance;
287 }
288 
289 
290 /**
291  * A GdkPixbufModule contains the necessary functions to load and save
292  * images in a certain file format.
293  * A GdkPixbufModule can be loaded dynamically from a GModule.
294  * Each loadable module must contain a GdkPixbufModuleFillVtableFunc function
295  * named fill_vtable, which will get called when the module
296  * is loaded and must set the function pointers of the GdkPixbufModule.
297  * char *module_name;
298  * the name of the module, usually the same as the
299  * usual file extension for images of this type, eg. "xpm", "jpeg" or "png".
300  * char *module_path;
301  * the path from which the module is loaded.
302  * GModule *module;
303  * the loaded GModule.
304  * GdkPixbufFormat *info;
305  * a GdkPixbufFormat holding information about the module.
306  * load ()
307  * loads an image from a file.
308  * load_xpm_data ()
309  * loads an image from data in memory.
310  * begin_load ()
311  * begins an incremental load.
312  * stop_load ()
313  * stops an incremental load.
314  * load_increment ()
315  * continues an incremental load.
316  * load_animation ()
317  * loads an animation from a file.
318  * save ()
319  * saves a GdkPixbuf to a file.
320  * save_to_callback ()
321  * saves a GdkPixbuf by calling the given GdkPixbufSaveFunc.
322  */
323 public struct GdkPixbufModule
324 {
325 	char *moduleName;
326 	char *modulePath;
327 	GModule *modul;
328 	GdkPixbufFormat *info;
329 	extern(C) GdkPixbuf * function(FILE* f, GError** error)  load;
330 	extern(C) GdkPixbuf * function(char** data)  loadXpmData;
331 	/+* Incremental loading +/
332 	extern(C) void* function(GdkPixbufModuleSizeFunc sizeFunc, GdkPixbufModulePreparedFunc prepareFunc, GdkPixbufModuleUpdatedFunc updateFunc, void* userData, GError** error)  beginLoad;
333 	extern(C) int function(void* context, GError** error)  stopLoad;
334 	extern(C) int function(void* context, char* buf, uint size, GError** error)  loadIncrement;
335 	/+* Animation loading +/
336 	extern(C) GdkPixbufAnimation * function(FILE* f, GError** error)  loadAnimation;
337 	/+* Saving +/
338 	extern(C) int function(FILE* f, GdkPixbuf* pixbuf, char** paramKeys, char** paramValues, GError** error)  save;
339 	extern(C) int function(GdkPixbufSaveFunc saveFunc, void* userData, GdkPixbuf* pixbuf, char** optionKeys, char** optionValues, GError** error) saveToCallback;
340 }
341 
342 
343 /**
344  * Modules supporting animations must derive a type from
345  * GdkPixbufAnimation, providing suitable implementations of the
346  * virtual functions.
347  * GObjectClass parent_class;
348  * the parent class
349  * is_static_image ()
350  * returns whether the given animation is just a static image.
351  * get_static_image ()
352  * returns a static image representing the given animation.
353  * get_size ()
354  * fills width and height with the frame size of the animation.
355  * get_iter ()
356  * returns an iterator for the given animation.
357  */
358 public struct GdkPixbufAnimationClass
359 {
360 	GObjectClass parentClass;
361 	extern(C) int function(GdkPixbufAnimation* anim) isStaticImage;
362 	extern(C) GdkPixbuf* function(GdkPixbufAnimation* anim) getStaticImage;
363 	extern(C) void function(GdkPixbufAnimation* anim, int* width, int* height) getSize;
364 	extern(C) GdkPixbufAnimationIter* function(GdkPixbufAnimation* anim, GTimeVal* startTime) getIter;
365 }
366 
367 
368 /**
369  * Modules supporting animations must derive a type from
370  * GdkPixbufAnimationIter, providing suitable implementations of the
371  * virtual functions.
372  * GObjectClass parent_class;
373  * the parent class
374  * get_delay_time ()
375  * returns the time in milliseconds that the current frame
376  * should be shown.
377  * get_pixbuf ()
378  * returns the current frame.
379  * on_currently_loading_frame ()
380  * returns whether the current frame of iter is
381  * being loaded.
382  * advance ()
383  * advances the iterator to current_time, possibly changing the
384  * current frame.
385  */
386 public struct GdkPixbufAnimationIterClass
387 {
388 	GObjectClass parentClass;
389 	extern(C) int function(GdkPixbufAnimationIter* iter) getDelayTime;
390 	extern(C) GdkPixbuf* function(GdkPixbufAnimationIter* iter) getPixbuf;
391 	extern(C) int function(GdkPixbufAnimationIter* iter) onCurrentlyLoadingFrame;
392 	extern(C) int function(GdkPixbufAnimationIter* iter, GTimeVal* currentTime) advance;
393 }
394 
395 
396 /*
397  * Defines the type of the function used to set the vtable of a
398  * GdkPixbufModule when it is loaded.
399  * module :
400  * a GdkPixbufModule.
401  * Since 2.2
402  */
403 // void (*GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
404 public alias extern(C) void function(GdkPixbufModule* modul) GdkPixbufModuleFillVtableFunc;
405 
406 /*
407  * Defines the type of the function used to fill a
408  * GdkPixbufFormat structure with information about a module.
409  * info :
410  * a GdkPixbufFormat.
411  * Since 2.2
412  */
413 // void (*GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
414 public alias extern(C) void function(GdkPixbufFormat* info) GdkPixbufModuleFillInfoFunc;
415 
416 /*
417  * Defines the type of the function that gets called once the size
418  * of the loaded image is known.
419  * The function is expected to set width and height to the desired
420  * size to which the image should be scaled. If a module has no efficient
421  * way to achieve the desired scaling during the loading of the image, it may
422  * either ignore the size request, or only approximate it -- gdk-pixbuf; will
423  * then perform the required scaling on the completely loaded image.
424  * If the function sets width or height to zero, the module should interpret
425  * this as a hint that it will be closed soon and shouldn't allocate further
426  * resources. This convention is used to implement gdk_pixbuf_get_file_info()
427  * efficiently.
428  * width :
429  * pointer to a location containing the current image width
430  * height :
431  * pointer to a location containing the current image height
432  * user_data :
433  * the loader.
434  * Since 2.2
435  */
436 // void (*GdkPixbufModuleSizeFunc) (gint *width,  gint *height,  gpointer user_data);
437 public alias extern(C) void function(gint* width, gint* height, void* userData) GdkPixbufModuleSizeFunc;
438 
439 /*
440  * Defines the type of the function that gets called once the initial
441  * setup of pixbuf is done.
442  * GdkPixbufLoader uses a function of this type to emit the
443  * "area_prepared"
444  * signal.
445  * pixbuf :
446  * the GdkPixbuf that is currently being loaded.
447  * anim :
448  * if an animation is being loaded, the GdkPixbufAnimation, else NULL.
449  * user_data :
450  * the loader.
451  * Since 2.2
452  */
453 // void (*GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf,  GdkPixbufAnimation *anim,  gpointer user_data);
454 public alias extern(C) void function(GdkPixbuf* pixbuf, GdkPixbufAnimation* anim, void* userData) GdkPixbufModulePreparedFunc;
455 
456 /*
457  * Defines the type of the function that gets called every time a region
458  * of pixbuf is updated.
459  * GdkPixbufLoader uses a function of this type to emit the
460  * "area_updated"
461  * signal.
462  * pixbuf :
463  * the GdkPixbuf that is currently being loaded.
464  * x :
465  * the X origin of the updated area.
466  * y :
467  * the Y origin of the updated area.
468  * width :
469  * the width of the updated area.
470  * height :
471  * the height of the updated area.
472  * user_data :
473  * the loader.
474  * Since 2.2
475  */
476 // void (*GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf,  int x,  int y,  int width,  int height,  gpointer user_data);
477 public alias extern(C) void function(GdkPixbuf* pixbuf, int x, int y, int width, int height, void* userData) GdkPixbufModuleUpdatedFunc;