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