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