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 
25 module gtkc.gdkpixbuftypes;
26 
27 public  import gtkc.glibtypes;
28 public  import gtkc.gobjecttypes;
29 public  import gtkc.gdktypes;
30 public  import gtkc.atktypes;
31 private import std.stdio;
32 
33 /**
34  * This enumeration defines the color spaces that are supported by
35  * the gdk-pixbuf library.  Currently only RGB is supported.
36  */
37 public enum GdkColorspace
38 {
39 	/**
40 	 * Indicates a red/green/blue additive color space.
41 	 */
42 	RGB = 0,
43 }
44 alias GdkColorspace Colorspace;
45 
46 /**
47  * This enumeration describes the different interpolation modes that
48  * can be used with the scaling functions. @GDK_INTERP_NEAREST is
49  * the fastest scaling method, but has horrible quality when
50  * scaling down. @GDK_INTERP_BILINEAR is the best choice if you
51  * aren't sure what to choose, it has a good speed/quality balance.
52  *
53  * <note>
54  * Cubic filtering is missing from the list; hyperbolic
55  * interpolation is just as fast and results in higher quality.
56  * </note>
57  */
58 public enum GdkInterpType
59 {
60 	/**
61 	 * Nearest neighbor sampling; this is the fastest
62 	 * and lowest quality mode. Quality is normally unacceptable when scaling
63 	 * down, but may be OK when scaling up.
64 	 */
65 	NEAREST = 0,
66 	/**
67 	 * This is an accurate simulation of the PostScript
68 	 * image operator without any interpolation enabled.  Each pixel is
69 	 * rendered as a tiny parallelogram of solid color, the edges of which
70 	 * are implemented with antialiasing.  It resembles nearest neighbor for
71 	 * enlargement, and bilinear for reduction.
72 	 */
73 	TILES = 1,
74 	/**
75 	 * Best quality/speed balance; use this mode by
76 	 * default. Bilinear interpolation.  For enlargement, it is
77 	 * equivalent to point-sampling the ideal bilinear-interpolated image.
78 	 * For reduction, it is equivalent to laying down small tiles and
79 	 * integrating over the coverage area.
80 	 */
81 	BILINEAR = 2,
82 	/**
83 	 * This is the slowest and highest quality
84 	 * reconstruction function. It is derived from the hyperbolic filters in
85 	 * Wolberg's "Digital Image Warping", and is formally defined as the
86 	 * hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
87 	 * image (the filter is designed to be idempotent for 1:1 pixel mapping).
88 	 */
89 	HYPER = 3,
90 }
91 alias GdkInterpType InterpType;
92 
93 /**
94  * These values can be passed to
95  * gdk_pixbuf_xlib_render_to_drawable_alpha() to control how the alpha
96  * channel of an image should be handled.  This function can create a
97  * bilevel clipping mask (black and white) and use it while painting
98  * the image.  In the future, when the X Window System gets an alpha
99  * channel extension, it will be possible to do full alpha
100  * compositing onto arbitrary drawables.  For now both cases fall
101  * back to a bilevel clipping mask.
102  */
103 public enum GdkPixbufAlphaMode
104 {
105 	/**
106 	 * A bilevel clipping mask (black and white)
107 	 * will be created and used to draw the image.  Pixels below 0.5 opacity
108 	 * will be considered fully transparent, and all others will be
109 	 * considered fully opaque.
110 	 */
111 	BILEVEL = 0,
112 	/**
113 	 * For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
114 	 * In the future it will do full alpha compositing.
115 	 */
116 	FULL = 1,
117 }
118 alias GdkPixbufAlphaMode PixbufAlphaMode;
119 
120 /**
121  * An error code in the #GDK_PIXBUF_ERROR domain. Many gdk-pixbuf
122  * operations can cause errors in this domain, or in the #G_FILE_ERROR
123  * domain.
124  */
125 public enum GdkPixbufError
126 {
127 	/**
128 	 * An image file was broken somehow.
129 	 */
130 	CORRUPT_IMAGE = 0,
131 	/**
132 	 * Not enough memory.
133 	 */
134 	INSUFFICIENT_MEMORY = 1,
135 	/**
136 	 * A bad option was passed to a pixbuf save module.
137 	 */
138 	BAD_OPTION = 2,
139 	/**
140 	 * Unknown image type.
141 	 */
142 	UNKNOWN_TYPE = 3,
143 	/**
144 	 * Don't know how to perform the
145 	 * given operation on the type of image at hand.
146 	 */
147 	UNSUPPORTED_OPERATION = 4,
148 	/**
149 	 * Generic failure code, something went wrong.
150 	 */
151 	FAILED = 5,
152 	/**
153 	 * Only part of the animation was loaded.
154 	 */
155 	INCOMPLETE_ANIMATION = 6,
156 }
157 alias GdkPixbufError PixbufError;
158 
159 /**
160  * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
161  * To make them easier to use, their numerical values are the actual degrees.
162  */
163 public enum GdkPixbufRotation
164 {
165 	/**
166 	 * No rotation.
167 	 */
168 	NONE = 0,
169 	/**
170 	 * Rotate by 90 degrees.
171 	 */
172 	COUNTERCLOCKWISE = 90,
173 	/**
174 	 * Rotate by 180 degrees.
175 	 */
176 	UPSIDEDOWN = 180,
177 	/**
178 	 * Rotate by 270 degrees.
179 	 */
180 	CLOCKWISE = 270,
181 }
182 alias GdkPixbufRotation PixbufRotation;
183 
184 /**
185  * An enumeration which is used by gdk_pixdata_to_csource() to
186  * determine the form of C source to be generated. The three values
187  * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
188  * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
189  * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
190  * elements are optional flags that can be freely added.
191  */
192 public enum GdkPixdataDumpType
193 {
194 	/**
195 	 * Generate pixbuf data stream (a single
196 	 * string containing a serialized #GdkPixdata structure in network byte
197 	 * order).
198 	 */
199 	PIXDATA_STREAM = 0,
200 	/**
201 	 * Generate #GdkPixdata structure (needs
202 	 * the #GdkPixdata structure definition from gdk-pixdata.h).
203 	 */
204 	PIXDATA_STRUCT = 1,
205 	/**
206 	 * Generate <function>*_ROWSTRIDE</function>,
207 	 * <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
208 	 * <function>*_BYTES_PER_PIXEL</function> and
209 	 * <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
210 	 * macro definitions for the image.
211 	 */
212 	MACROS = 2,
213 	/**
214 	 * Generate GLib data types instead of
215 	 * standard C data types.
216 	 */
217 	GTYPES = 0,
218 	/**
219 	 * Generate standard C data types instead of
220 	 * GLib data types.
221 	 */
222 	CTYPES = 256,
223 	/**
224 	 * Generate static symbols.
225 	 */
226 	STATIC = 512,
227 	/**
228 	 * Generate const symbols.
229 	 */
230 	CONST = 1024,
231 	/**
232 	 * Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
233 	 * macro definition  to  decode  run-length encoded image data.
234 	 */
235 	RLE_DECODER = 65536,
236 }
237 alias GdkPixdataDumpType PixdataDumpType;
238 
239 /**
240  * An enumeration containing three sets of flags for a #GdkPixdata struct:
241  * one for the used colorspace, one for the width of the samples and one
242  * for the encoding of the pixel data.
243  */
244 public enum GdkPixdataType
245 {
246 	/**
247 	 * each pixel has red, green and blue samples.
248 	 */
249 	COLOR_TYPE_RGB = 1,
250 	/**
251 	 * each pixel has red, green and blue samples
252 	 * and an alpha value.
253 	 */
254 	COLOR_TYPE_RGBA = 2,
255 	/**
256 	 * mask for the colortype flags of the enum.
257 	 */
258 	COLOR_TYPE_MASK = 255,
259 	/**
260 	 * each sample has 8 bits.
261 	 */
262 	SAMPLE_WIDTH_8 = 65536,
263 	/**
264 	 * mask for the sample width flags of the enum.
265 	 */
266 	SAMPLE_WIDTH_MASK = 983040,
267 	/**
268 	 * the pixel data is in raw form.
269 	 */
270 	ENCODING_RAW = 16777216,
271 	/**
272 	 * the pixel data is run-length encoded. Runs may
273 	 * be up to 127 bytes long; their length is stored in a single byte
274 	 * preceding the pixel data for the run. If a run is constant, its length
275 	 * byte has the high bit set and the pixel data consists of a single pixel
276 	 * which must be repeated.
277 	 */
278 	ENCODING_RLE = 33554432,
279 	/**
280 	 * mask for the encoding flags of the enum.
281 	 */
282 	ENCODING_MASK = 251658240,
283 }
284 alias GdkPixdataType PixdataType;
285 
286 struct GdkPixbuf;
287 
288 struct GdkPixbufAnimation;
289 
290 struct GdkPixbufAnimationIter;
291 
292 struct GdkPixbufFormat;
293 
294 struct GdkPixbufLoader
295 {
296 	GObject parentInstance;
297 	void* priv;
298 }
299 
300 struct GdkPixbufLoaderClass
301 {
302 	GObjectClass parentClass;
303 	/** */
304 	extern(C) void function(GdkPixbufLoader* loader, int width, int height) sizePrepared;
305 	/** */
306 	extern(C) void function(GdkPixbufLoader* loader) areaPrepared;
307 	/** */
308 	extern(C) void function(GdkPixbufLoader* loader, int x, int y, int width, int height) areaUpdated;
309 	/** */
310 	extern(C) void function(GdkPixbufLoader* loader) closed;
311 }
312 
313 struct GdkPixbufSimpleAnim;
314 
315 struct GdkPixbufSimpleAnimClass;
316 
317 
318 struct GdkPixdata
319 {
320 	/**
321 	 * magic number. A valid #GdkPixdata structure must have
322 	 * #GDK_PIXBUF_MAGIC_NUMBER here.
323 	 */
324 	uint magic;
325 	/**
326 	 * less than 1 to disable length checks, otherwise
327 	 * #GDK_PIXDATA_HEADER_LENGTH + length of @pixel_data.
328 	 */
329 	int length;
330 	/**
331 	 * information about colorspace, sample width and
332 	 * encoding, in a #GdkPixdataType.
333 	 */
334 	uint pixdataType;
335 	/**
336 	 * Distance in bytes between rows.
337 	 */
338 	uint rowstride;
339 	/**
340 	 * Width of the image in pixels.
341 	 */
342 	uint width;
343 	/**
344 	 * Height of the image in pixels.
345 	 */
346 	uint height;
347 	/**
348 	 * @width x @height pixels, encoded according to @pixdata_type
349 	 * and @rowstride.
350 	 */
351 	ubyte* pixelData;
352 }
353 
354 /**
355  * A function of this type is responsible for freeing the pixel array
356  * of a pixbuf.  The gdk_pixbuf_new_from_data() function lets you
357  * pass in a pre-allocated pixel array so that a pixbuf can be
358  * created from it; in this case you will need to pass in a function
359  * of #GdkPixbufDestroyNotify so that the pixel data can be freed
360  * when the pixbuf is finalized.
361  *
362  * Params:
363  *     pixels = The pixel array of the pixbuf
364  *         that is being finalized.
365  *     data = User closure data.
366  */
367 public alias extern(C) void function(char* pixels, void* data) GdkPixbufDestroyNotify;
368 
369 /**
370  * Specifies the type of the function passed to
371  * gdk_pixbuf_save_to_callback().  It is called once for each block of
372  * bytes that is "written" by gdk_pixbuf_save_to_callback().  If
373  * successful it should return %TRUE.  If an error occurs it should set
374  * @error and return %FALSE, in which case gdk_pixbuf_save_to_callback()
375  * will fail with the same error.
376  *
377  * Params:
378  *     buf = bytes to be written.
379  *     count = number of bytes in @buf.
380  *     error = A location to return an error.
381  *     data = user data passed to gdk_pixbuf_save_to_callback().
382  *
383  * Returns: %TRUE if successful, %FALSE (with @error set) if failed.
384  *
385  * Since: 2.4
386  */
387 public alias extern(C) int function(char* buf, size_t count, GError** error, void* data) GdkPixbufSaveFunc;