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_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 alias GdkPixbufError PixbufError;
154 
155 /**
156  * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
157  * To make them easier to use, their numerical values are the actual degrees.
158  */
159 public enum GdkPixbufRotation
160 {
161 	/**
162 	 * No rotation.
163 	 */
164 	NONE = 0,
165 	/**
166 	 * Rotate by 90 degrees.
167 	 */
168 	COUNTERCLOCKWISE = 90,
169 	/**
170 	 * Rotate by 180 degrees.
171 	 */
172 	UPSIDEDOWN = 180,
173 	/**
174 	 * Rotate by 270 degrees.
175 	 */
176 	CLOCKWISE = 270,
177 }
178 alias GdkPixbufRotation PixbufRotation;
179 
180 /**
181  * An enumeration which is used by gdk_pixdata_to_csource() to
182  * determine the form of C source to be generated. The three values
183  * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
184  * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
185  * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
186  * elements are optional flags that can be freely added.
187  */
188 public enum GdkPixdataDumpType
189 {
190 	/**
191 	 * Generate pixbuf data stream (a single
192 	 * string containing a serialized #GdkPixdata structure in network byte
193 	 * order).
194 	 */
195 	PIXDATA_STREAM = 0,
196 	/**
197 	 * Generate #GdkPixdata structure (needs
198 	 * the #GdkPixdata structure definition from gdk-pixdata.h).
199 	 */
200 	PIXDATA_STRUCT = 1,
201 	/**
202 	 * Generate <function>*_ROWSTRIDE</function>,
203 	 * <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
204 	 * <function>*_BYTES_PER_PIXEL</function> and
205 	 * <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
206 	 * macro definitions for the image.
207 	 */
208 	MACROS = 2,
209 	/**
210 	 * Generate GLib data types instead of
211 	 * standard C data types.
212 	 */
213 	GTYPES = 0,
214 	/**
215 	 * Generate standard C data types instead of
216 	 * GLib data types.
217 	 */
218 	CTYPES = 256,
219 	/**
220 	 * Generate static symbols.
221 	 */
222 	STATIC = 512,
223 	/**
224 	 * Generate const symbols.
225 	 */
226 	CONST = 1024,
227 	/**
228 	 * Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
229 	 * macro definition  to  decode  run-length encoded image data.
230 	 */
231 	RLE_DECODER = 65536,
232 }
233 alias GdkPixdataDumpType PixdataDumpType;
234 
235 /**
236  * An enumeration containing three sets of flags for a #GdkPixdata struct:
237  * one for the used colorspace, one for the width of the samples and one
238  * for the encoding of the pixel data.
239  */
240 public enum GdkPixdataType
241 {
242 	/**
243 	 * each pixel has red, green and blue samples.
244 	 */
245 	COLOR_TYPE_RGB = 1,
246 	/**
247 	 * each pixel has red, green and blue samples
248 	 * and an alpha value.
249 	 */
250 	COLOR_TYPE_RGBA = 2,
251 	/**
252 	 * mask for the colortype flags of the enum.
253 	 */
254 	COLOR_TYPE_MASK = 255,
255 	/**
256 	 * each sample has 8 bits.
257 	 */
258 	SAMPLE_WIDTH_8 = 65536,
259 	/**
260 	 * mask for the sample width flags of the enum.
261 	 */
262 	SAMPLE_WIDTH_MASK = 983040,
263 	/**
264 	 * the pixel data is in raw form.
265 	 */
266 	ENCODING_RAW = 16777216,
267 	/**
268 	 * the pixel data is run-length encoded. Runs may
269 	 * be up to 127 bytes long; their length is stored in a single byte
270 	 * preceding the pixel data for the run. If a run is constant, its length
271 	 * byte has the high bit set and the pixel data consists of a single pixel
272 	 * which must be repeated.
273 	 */
274 	ENCODING_RLE = 33554432,
275 	/**
276 	 * mask for the encoding flags of the enum.
277 	 */
278 	ENCODING_MASK = 251658240,
279 }
280 alias GdkPixdataType PixdataType;
281 
282 struct GdkPixbuf;
283 
284 struct GdkPixbufAnimation;
285 
286 struct GdkPixbufAnimationIter;
287 
288 struct GdkPixbufFormat;
289 
290 struct GdkPixbufLoader
291 {
292 	GObject parentInstance;
293 	void* priv;
294 }
295 
296 struct GdkPixbufLoaderClass
297 {
298 	GObjectClass parentClass;
299 	extern(C) void function(GdkPixbufLoader* loader, int width, int height) sizePrepared;
300 	extern(C) void function(GdkPixbufLoader* loader) areaPrepared;
301 	extern(C) void function(GdkPixbufLoader* loader, int x, int y, int width, int height) areaUpdated;
302 	extern(C) void function(GdkPixbufLoader* loader) closed;
303 }
304 
305 struct GdkPixbufSimpleAnim;
306 
307 struct GdkPixbufSimpleAnimClass;
308 
309 
310 struct GdkPixdata
311 {
312 	/**
313 	 * magic number. A valid #GdkPixdata structure must have
314 	 * #GDK_PIXBUF_MAGIC_NUMBER here.
315 	 */
316 	uint magic;
317 	/**
318 	 * less than 1 to disable length checks, otherwise
319 	 * #GDK_PIXDATA_HEADER_LENGTH + length of @pixel_data.
320 	 */
321 	int length;
322 	/**
323 	 * information about colorspace, sample width and
324 	 * encoding, in a #GdkPixdataType.
325 	 */
326 	uint pixdataType;
327 	/**
328 	 * Distance in bytes between rows.
329 	 */
330 	uint rowstride;
331 	/**
332 	 * Width of the image in pixels.
333 	 */
334 	uint width;
335 	/**
336 	 * Height of the image in pixels.
337 	 */
338 	uint height;
339 	/**
340 	 * @width x @height pixels, encoded according to @pixdata_type
341 	 * and @rowstride.
342 	 */
343 	ubyte* pixelData;
344 }
345 
346 /**
347  * A function of this type is responsible for freeing the pixel array
348  * of a pixbuf.  The gdk_pixbuf_new_from_data() function lets you
349  * pass in a pre-allocated pixel array so that a pixbuf can be
350  * created from it; in this case you will need to pass in a function
351  * of #GdkPixbufDestroyNotify so that the pixel data can be freed
352  * when the pixbuf is finalized.
353  *
354  * Params:
355  *     pixels = The pixel array of the pixbuf
356  *         that is being finalized.
357  *     data = User closure data.
358  */
359 public alias extern(C) void function(char* pixels, void* data) GdkPixbufDestroyNotify;
360 
361 /**
362  * Specifies the type of the function passed to
363  * gdk_pixbuf_save_to_callback().  It is called once for each block of
364  * bytes that is "written" by gdk_pixbuf_save_to_callback().  If
365  * successful it should return %TRUE.  If an error occurs it should set
366  * @error and return %FALSE, in which case gdk_pixbuf_save_to_callback()
367  * will fail with the same error.
368  *
369  * Params:
370  *     buf = bytes to be written.
371  *     count = number of bytes in @buf.
372  *     error = A location to return an error.
373  *     data = user data passed to gdk_pixbuf_save_to_callback().
374  *
375  * Return: %TRUE if successful, %FALSE (with @error set) if failed.
376  *
377  * Since: 2.4
378  */
379 public alias extern(C) int function(char* buf, size_t count, GError** error, void* data) GdkPixbufSaveFunc;