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