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 gdkpixbuf.Pixbuf;
26 
27 private import gdkpixbuf.PixbufFormat;
28 private import gdkpixbuf.Pixdata;
29 private import gio.AsyncResultIF;
30 private import gio.Cancellable;
31 private import gio.IconIF;
32 private import gio.IconT;
33 private import gio.InputStream;
34 private import gio.LoadableIconIF;
35 private import gio.LoadableIconT;
36 private import gio.OutputStream;
37 private import glib.Bytes;
38 private import glib.ConstructionException;
39 private import glib.ErrorG;
40 private import glib.GException;
41 private import glib.HashTable;
42 private import glib.ListSG;
43 private import glib.Str;
44 private import gobject.ObjectG;
45 private import gtkc.gdkpixbuf;
46 public  import gtkc.gdkpixbuftypes;
47 
48 
49 /**
50  * This is the main structure in the gdk-pixbuf library.  It is
51  * used to represent images.  It contains information about the
52  * image's pixel data, its color space, bits per sample, width and
53  * height, and the rowstride (the number of bytes between the start of
54  * one row and the start of the next).
55  */
56 public class Pixbuf : ObjectG, IconIF, LoadableIconIF
57 {
58 	/** the main Gtk struct */
59 	protected GdkPixbuf* gdkPixbuf;
60 
61 	/** Get the main Gtk struct */
62 	public GdkPixbuf* getPixbufStruct()
63 	{
64 		return gdkPixbuf;
65 	}
66 
67 	/** the main Gtk struct as a void* */
68 	protected override void* getStruct()
69 	{
70 		return cast(void*)gdkPixbuf;
71 	}
72 
73 	protected override void setStruct(GObject* obj)
74 	{
75 		gdkPixbuf = cast(GdkPixbuf*)obj;
76 		super.setStruct(obj);
77 	}
78 
79 	/**
80 	 * Sets our main struct and passes it to the parent class.
81 	 */
82 	public this (GdkPixbuf* gdkPixbuf, bool ownedRef = false)
83 	{
84 		this.gdkPixbuf = gdkPixbuf;
85 		super(cast(GObject*)gdkPixbuf, ownedRef);
86 	}
87 
88 	// add the Icon capabilities
89 	mixin IconT!(GdkPixbuf);
90 
91 	// add the LoadableIcon capabilities
92 	mixin LoadableIconT!(GdkPixbuf);
93 
94 	/**
95 	 * Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
96 	 * "tiff", "png", "ico" or "bmp".  See gdk_pixbuf_save_to_buffer()
97 	 * for more details.
98 	 *
99 	 * Params:
100 	 *     buffer = location to receive a pointer to the new buffer.
101 	 *     bufferSize = location to receive the size of the new buffer.
102 	 *     type = name of file format.
103 	 *     optionKeys = name of options to set, %NULL-terminated
104 	 *     optionValues = values for named options
105 	 *
106 	 * Return: whether an error was set
107 	 *
108 	 * Since: 2.4
109 	 *
110 	 * Throws: GException on failure.
111 	 */
112 	public bool saveToBuffer(out ubyte[] buffer, string type, string[] optionKeys, string[] optionValues)
113 	{
114 		char* outbuffer = null;
115 		size_t bufferSize;
116 		GError* err = null;
117 		
118 		auto p = gdk_pixbuf_save_to_bufferv(gdkPixbuf, &outbuffer, &bufferSize, Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err) != 0;
119 		
120 		if (err !is null)
121 		{
122 			throw new GException( new ErrorG(err) );
123 		}
124 		
125 		buffer = (cast(ubyte*)outbuffer)[0 .. bufferSize];
126 		
127 		return p;
128 	}
129 	
130 	/**
131 	 * Creates a new pixbuf by loading an image from an resource.
132 	 *
133 	 * The file format is detected automatically.
134 	 *
135 	 * Params:
136 	 *     resourcePath = the path of the resource file
137 	 *
138 	 * Return: A newly-created pixbuf, or null if any of several error
139 	 *     conditions occurred: the file could not be opened, the image format is
140 	 *     not supported, there was not enough memory to allocate the image buffer,
141 	 *     the stream contained invalid data, or the operation was cancelled.
142 	 *
143 	 * Since: 2.26
144 	 *
145 	 * Throws: GException on failure.
146 	 */
147 	public static Pixbuf newFromResource(string resourcePath)
148 	{
149 		GError* err = null;
150 		
151 		auto p = gdk_pixbuf_new_from_resource(Str.toStringz(resourcePath), &err);
152 		
153 		if (err !is null)
154 		{
155 			throw new GException( new ErrorG(err) );
156 		}
157 		
158 		return new Pixbuf(cast(GdkPixbuf*) p, true);
159 	}
160 	
161 	/**
162 	 * Creates a new pixbuf by loading an image from an resource.
163 	 *
164 	 * The file format is detected automatically.
165 	 *
166 	 * The image will be scaled to fit in the requested size, optionally
167 	 * preserving the image's aspect ratio. When preserving the aspect ratio,
168 	 * a width of -1 will cause the image to be scaled to the exact given
169 	 * height, and a height of -1 will cause the image to be scaled to the
170 	 * exact given width. When not preserving aspect ratio, a width or
171 	 * height of -1 means to not scale the image at all in that dimension.
172 	 *
173 	 * The stream is not closed.
174 	 *
175 	 * Params:
176 	 *     resourcePath = the path of the resource file
177 	 *     width = The width the image should have or -1 to not constrain the width
178 	 *     height = The height the image should have or -1 to not constrain the height
179 	 *     preserveAspectRatio = true to preserve the image's aspect ratio
180 	 *
181 	 * Return: A newly-created pixbuf, or null if any of several error
182 	 *     conditions occurred: the file could not be opened, the image format is
183 	 *     not supported, there was not enough memory to allocate the image buffer,
184 	 *     the stream contained invalid data, or the operation was cancelled.
185 	 *
186 	 * Since: 2.26
187 	 *
188 	 * Throws: GException on failure.
189 	 */
190 	public static Pixbuf newFromResource(string resourcePath, int width, int height, bool preserveAspectRatio)
191 	{
192 		GError* err = null;
193 		
194 		auto p = gdk_pixbuf_new_from_resource_at_scale(Str.toStringz(resourcePath), width, height, preserveAspectRatio, &err);
195 		
196 		if (err !is null)
197 		{
198 			throw new GException( new ErrorG(err) );
199 		}
200 		
201 		return new Pixbuf(cast(GdkPixbuf*) p, true);
202 	}
203 	
204 	/**
205 	 * Queries a pointer to the pixel data of a pixbuf.
206 	 *
207 	 * Return: A pointer to the pixbuf's pixel data.
208 	 *     Please see the section on [image data](image-data) for information
209 	 *     about how the pixel data is stored in memory.
210 	 *
211 	 *     This function will cause an implicit copy of the pixbuf data if the
212 	 *     pixbuf was created from read-only data.
213 	 */
214 	public char* getPixels()
215 	{
216 		return gdk_pixbuf_get_pixels(gdkPixbuf);
217 	}
218 
219 	/**
220 	 */
221 
222 	/** */
223 	public static GType getType()
224 	{
225 		return gdk_pixbuf_get_type();
226 	}
227 
228 	/**
229 	 * Creates a new #GdkPixbuf structure and allocates a buffer for it.  The
230 	 * buffer has an optimal rowstride.  Note that the buffer is not cleared;
231 	 * you will have to fill it completely yourself.
232 	 *
233 	 * Params:
234 	 *     colorspace = Color space for image
235 	 *     hasAlpha = Whether the image should have transparency information
236 	 *     bitsPerSample = Number of bits per color sample
237 	 *     width = Width of image in pixels, must be > 0
238 	 *     height = Height of image in pixels, must be > 0
239 	 *
240 	 * Returns: A newly-created #GdkPixbuf with a reference count of 1, or
241 	 *     %NULL if not enough memory could be allocated for the image buffer.
242 	 *
243 	 * Throws: ConstructionException GTK+ fails to create the object.
244 	 */
245 	public this(GdkColorspace colorspace, bool hasAlpha, int bitsPerSample, int width, int height)
246 	{
247 		auto p = gdk_pixbuf_new(colorspace, hasAlpha, bitsPerSample, width, height);
248 		
249 		if(p is null)
250 		{
251 			throw new ConstructionException("null returned by new");
252 		}
253 		
254 		this(cast(GdkPixbuf*) p, true);
255 	}
256 
257 	/**
258 	 * Creates a new #GdkPixbuf out of in-memory readonly image data.
259 	 * Currently only RGB images with 8 bits per sample are supported.
260 	 * This is the #GBytes variant of gdk_pixbuf_new_from_data().
261 	 *
262 	 * Params:
263 	 *     data = Image data in 8-bit/sample packed format inside a #GBytes
264 	 *     colorspace = Colorspace for the image data
265 	 *     hasAlpha = Whether the data has an opacity channel
266 	 *     bitsPerSample = Number of bits per sample
267 	 *     width = Width of the image in pixels, must be > 0
268 	 *     height = Height of the image in pixels, must be > 0
269 	 *     rowstride = Distance in bytes between row starts
270 	 *
271 	 * Returns: A newly-created #GdkPixbuf structure with a reference count of 1.
272 	 *
273 	 * Since: 2.32
274 	 *
275 	 * Throws: ConstructionException GTK+ fails to create the object.
276 	 */
277 	public this(Bytes data, GdkColorspace colorspace, bool hasAlpha, int bitsPerSample, int width, int height, int rowstride)
278 	{
279 		auto p = gdk_pixbuf_new_from_bytes((data is null) ? null : data.getBytesStruct(), colorspace, hasAlpha, bitsPerSample, width, height, rowstride);
280 		
281 		if(p is null)
282 		{
283 			throw new ConstructionException("null returned by new_from_bytes");
284 		}
285 		
286 		this(cast(GdkPixbuf*) p, true);
287 	}
288 
289 	/**
290 	 * Creates a new #GdkPixbuf out of in-memory image data.  Currently only RGB
291 	 * images with 8 bits per sample are supported.
292 	 *
293 	 * Since you are providing a pre-allocated pixel buffer, you must also
294 	 * specify a way to free that data.  This is done with a function of
295 	 * type #GdkPixbufDestroyNotify.  When a pixbuf created with is
296 	 * finalized, your destroy notification function will be called, and
297 	 * it is its responsibility to free the pixel array.
298 	 *
299 	 * See also gdk_pixbuf_new_from_bytes().
300 	 *
301 	 * Params:
302 	 *     data = Image data in 8-bit/sample packed format
303 	 *     colorspace = Colorspace for the image data
304 	 *     hasAlpha = Whether the data has an opacity channel
305 	 *     bitsPerSample = Number of bits per sample
306 	 *     width = Width of the image in pixels, must be > 0
307 	 *     height = Height of the image in pixels, must be > 0
308 	 *     rowstride = Distance in bytes between row starts
309 	 *     destroyFn = Function used to free the data when the pixbuf's reference count
310 	 *         drops to zero, or %NULL if the data should not be freed
311 	 *     destroyFnData = Closure data to pass to the destroy notification function
312 	 *
313 	 * Returns: A newly-created #GdkPixbuf structure with a reference count of 1.
314 	 *
315 	 * Throws: ConstructionException GTK+ fails to create the object.
316 	 */
317 	public this(char[] data, GdkColorspace colorspace, bool hasAlpha, int bitsPerSample, int width, int height, int rowstride, GdkPixbufDestroyNotify destroyFn, void* destroyFnData)
318 	{
319 		auto p = gdk_pixbuf_new_from_data(data.ptr, colorspace, hasAlpha, bitsPerSample, width, height, rowstride, destroyFn, destroyFnData);
320 		
321 		if(p is null)
322 		{
323 			throw new ConstructionException("null returned by new_from_data");
324 		}
325 		
326 		this(cast(GdkPixbuf*) p, true);
327 	}
328 
329 	/**
330 	 * Creates a new pixbuf by loading an image from a file.  The file format is
331 	 * detected automatically. If %NULL is returned, then @error will be set.
332 	 * Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
333 	 *
334 	 * Params:
335 	 *     filename = Name of file to load, in the GLib file name encoding
336 	 *
337 	 * Returns: A newly-created pixbuf with a reference count of 1, or %NULL if
338 	 *     any of several error conditions occurred:  the file could not be opened,
339 	 *     there was no loader for the file's format, there was not enough memory to
340 	 *     allocate the image buffer, or the image file contained invalid data.
341 	 *
342 	 * Throws: GException on failure.
343 	 * Throws: ConstructionException GTK+ fails to create the object.
344 	 */
345 	public this(string filename)
346 	{
347 		GError* err = null;
348 		
349 		auto p = gdk_pixbuf_new_from_file(Str.toStringz(filename), &err);
350 		
351 		if (err !is null)
352 		{
353 			throw new GException( new ErrorG(err) );
354 		}
355 		
356 		if(p is null)
357 		{
358 			throw new ConstructionException("null returned by new_from_file");
359 		}
360 		
361 		this(cast(GdkPixbuf*) p, true);
362 	}
363 
364 	/**
365 	 * Creates a new pixbuf by loading an image from a file.  The file format is
366 	 * detected automatically. If %NULL is returned, then @error will be set.
367 	 * Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
368 	 * The image will be scaled to fit in the requested size, optionally preserving
369 	 * the image's aspect ratio.
370 	 *
371 	 * When preserving the aspect ratio, a @width of -1 will cause the image
372 	 * to be scaled to the exact given height, and a @height of -1 will cause
373 	 * the image to be scaled to the exact given width. When not preserving
374 	 * aspect ratio, a @width or @height of -1 means to not scale the image
375 	 * at all in that dimension. Negative values for @width and @height are
376 	 * allowed since 2.8.
377 	 *
378 	 * Params:
379 	 *     filename = Name of file to load, in the GLib file name encoding
380 	 *     width = The width the image should have or -1 to not constrain the width
381 	 *     height = The height the image should have or -1 to not constrain the height
382 	 *     preserveAspectRatio = %TRUE to preserve the image's aspect ratio
383 	 *
384 	 * Returns: A newly-created pixbuf with a reference count of 1, or %NULL
385 	 *     if any of several error conditions occurred:  the file could not be opened,
386 	 *     there was no loader for the file's format, there was not enough memory to
387 	 *     allocate the image buffer, or the image file contained invalid data.
388 	 *
389 	 * Since: 2.6
390 	 *
391 	 * Throws: GException on failure.
392 	 * Throws: ConstructionException GTK+ fails to create the object.
393 	 */
394 	public this(string filename, int width, int height, bool preserveAspectRatio)
395 	{
396 		GError* err = null;
397 		
398 		auto p = gdk_pixbuf_new_from_file_at_scale(Str.toStringz(filename), width, height, preserveAspectRatio, &err);
399 		
400 		if (err !is null)
401 		{
402 			throw new GException( new ErrorG(err) );
403 		}
404 		
405 		if(p is null)
406 		{
407 			throw new ConstructionException("null returned by new_from_file_at_scale");
408 		}
409 		
410 		this(cast(GdkPixbuf*) p, true);
411 	}
412 
413 	/**
414 	 * Creates a new pixbuf by loading an image from a file.
415 	 * The file format is detected automatically. If %NULL is returned, then
416 	 * @error will be set. Possible errors are in the #GDK_PIXBUF_ERROR and
417 	 * #G_FILE_ERROR domains.
418 	 *
419 	 * The image will be scaled to fit in the requested size, preserving
420 	 * the image's aspect ratio. Note that the returned pixbuf may be smaller
421 	 * than @width x @height, if the aspect ratio requires it. To load
422 	 * and image at the requested size, regardless of aspect ratio, use
423 	 * gdk_pixbuf_new_from_file_at_scale().
424 	 *
425 	 * Params:
426 	 *     filename = Name of file to load, in the GLib file name encoding
427 	 *     width = The width the image should have or -1 to not constrain the width
428 	 *     height = The height the image should have or -1 to not constrain the height
429 	 *
430 	 * Returns: A newly-created pixbuf with a reference count of 1, or
431 	 *     %NULL if any of several error conditions occurred:  the file could not
432 	 *     be opened, there was no loader for the file's format, there was not
433 	 *     enough memory to allocate the image buffer, or the image file contained
434 	 *     invalid data.
435 	 *
436 	 * Since: 2.4
437 	 *
438 	 * Throws: GException on failure.
439 	 * Throws: ConstructionException GTK+ fails to create the object.
440 	 */
441 	public this(string filename, int width, int height)
442 	{
443 		GError* err = null;
444 		
445 		auto p = gdk_pixbuf_new_from_file_at_size(Str.toStringz(filename), width, height, &err);
446 		
447 		if (err !is null)
448 		{
449 			throw new GException( new ErrorG(err) );
450 		}
451 		
452 		if(p is null)
453 		{
454 			throw new ConstructionException("null returned by new_from_file_at_size");
455 		}
456 		
457 		this(cast(GdkPixbuf*) p, true);
458 	}
459 
460 	/**
461 	 * Create a #GdkPixbuf from a flat representation that is suitable for
462 	 * storing as inline data in a program. This is useful if you want to
463 	 * ship a program with images, but don't want to depend on any
464 	 * external files.
465 	 *
466 	 * gdk-pixbuf ships with a program called [gdk-pixbuf-csource][gdk-pixbuf-csource],
467 	 * which allows for conversion of #GdkPixbufs into such a inline representation.
468 	 * In almost all cases, you should pass the `--raw` option to
469 	 * `gdk-pixbuf-csource`. A sample invocation would be:
470 	 *
471 	 * |[
472 	 * gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
473 	 * ]|
474 	 *
475 	 * For the typical case where the inline pixbuf is read-only static data,
476 	 * you don't need to copy the pixel data unless you intend to write to
477 	 * it, so you can pass %FALSE for @copy_pixels.  (If you pass `--rle` to
478 	 * `gdk-pixbuf-csource`, a copy will be made even if @copy_pixels is %FALSE,
479 	 * so using this option is generally a bad idea.)
480 	 *
481 	 * If you create a pixbuf from const inline data compiled into your
482 	 * program, it's probably safe to ignore errors and disable length checks,
483 	 * since things will always succeed:
484 	 * |[
485 	 * pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
486 	 * ]|
487 	 *
488 	 * For non-const inline data, you could get out of memory. For untrusted
489 	 * inline data located at runtime, you could have corrupt inline data in
490 	 * addition.
491 	 *
492 	 * Deprecated: Use #GResource instead.
493 	 *
494 	 * Params:
495 	 *     dataLength = Length in bytes of the @data argument or -1 to
496 	 *         disable length checks
497 	 *     data = Byte data containing a
498 	 *         serialized #GdkPixdata structure
499 	 *     copyPixels = Whether to copy the pixel data, or use direct pointers
500 	 *         @data for the resulting pixbuf
501 	 *
502 	 * Returns: A newly-created #GdkPixbuf structure with a reference,
503 	 *     count of 1, or %NULL if an error occurred.
504 	 *
505 	 * Throws: GException on failure.
506 	 * Throws: ConstructionException GTK+ fails to create the object.
507 	 */
508 	public this(ubyte[] data, bool copyPixels)
509 	{
510 		GError* err = null;
511 		
512 		auto p = gdk_pixbuf_new_from_inline(cast(int)data.length, data.ptr, copyPixels, &err);
513 		
514 		if (err !is null)
515 		{
516 			throw new GException( new ErrorG(err) );
517 		}
518 		
519 		if(p is null)
520 		{
521 			throw new ConstructionException("null returned by new_from_inline");
522 		}
523 		
524 		this(cast(GdkPixbuf*) p, true);
525 	}
526 
527 	/**
528 	 * Creates a new pixbuf by loading an image from an input stream.
529 	 *
530 	 * The file format is detected automatically. If %NULL is returned, then
531 	 * @error will be set. The @cancellable can be used to abort the operation
532 	 * from another thread. If the operation was cancelled, the error
533 	 * %G_IO_ERROR_CANCELLED will be returned. Other possible errors are in
534 	 * the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
535 	 *
536 	 * The stream is not closed.
537 	 *
538 	 * Params:
539 	 *     stream = a #GInputStream to load the pixbuf from
540 	 *     cancellable = optional #GCancellable object, %NULL to ignore
541 	 *
542 	 * Returns: A newly-created pixbuf, or %NULL if any of several error
543 	 *     conditions occurred: the file could not be opened, the image format is
544 	 *     not supported, there was not enough memory to allocate the image buffer,
545 	 *     the stream contained invalid data, or the operation was cancelled.
546 	 *
547 	 * Since: 2.14
548 	 *
549 	 * Throws: GException on failure.
550 	 * Throws: ConstructionException GTK+ fails to create the object.
551 	 */
552 	public this(InputStream stream, Cancellable cancellable)
553 	{
554 		GError* err = null;
555 		
556 		auto p = gdk_pixbuf_new_from_stream((stream is null) ? null : stream.getInputStreamStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
557 		
558 		if (err !is null)
559 		{
560 			throw new GException( new ErrorG(err) );
561 		}
562 		
563 		if(p is null)
564 		{
565 			throw new ConstructionException("null returned by new_from_stream");
566 		}
567 		
568 		this(cast(GdkPixbuf*) p, true);
569 	}
570 
571 	/**
572 	 * Creates a new pixbuf by loading an image from an input stream.
573 	 *
574 	 * The file format is detected automatically. If %NULL is returned, then
575 	 * @error will be set. The @cancellable can be used to abort the operation
576 	 * from another thread. If the operation was cancelled, the error
577 	 * %G_IO_ERROR_CANCELLED will be returned. Other possible errors are in
578 	 * the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
579 	 *
580 	 * The image will be scaled to fit in the requested size, optionally
581 	 * preserving the image's aspect ratio.
582 	 *
583 	 * When preserving the aspect ratio, a @width of -1 will cause the image to be
584 	 * scaled to the exact given height, and a @height of -1 will cause the image
585 	 * to be scaled to the exact given width. If both @width and @height are
586 	 * given, this function will behave as if the smaller of the two values
587 	 * is passed as -1.
588 	 *
589 	 * When not preserving aspect ratio, a @width or @height of -1 means to not
590 	 * scale the image at all in that dimension.
591 	 *
592 	 * The stream is not closed.
593 	 *
594 	 * Params:
595 	 *     stream = a #GInputStream to load the pixbuf from
596 	 *     width = The width the image should have or -1 to not constrain the width
597 	 *     height = The height the image should have or -1 to not constrain the height
598 	 *     preserveAspectRatio = %TRUE to preserve the image's aspect ratio
599 	 *     cancellable = optional #GCancellable object, %NULL to ignore
600 	 *
601 	 * Returns: A newly-created pixbuf, or %NULL if any of several error
602 	 *     conditions occurred: the file could not be opened, the image format is
603 	 *     not supported, there was not enough memory to allocate the image buffer,
604 	 *     the stream contained invalid data, or the operation was cancelled.
605 	 *
606 	 * Since: 2.14
607 	 *
608 	 * Throws: GException on failure.
609 	 * Throws: ConstructionException GTK+ fails to create the object.
610 	 */
611 	public this(InputStream stream, int width, int height, bool preserveAspectRatio, Cancellable cancellable)
612 	{
613 		GError* err = null;
614 		
615 		auto p = gdk_pixbuf_new_from_stream_at_scale((stream is null) ? null : stream.getInputStreamStruct(), width, height, preserveAspectRatio, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
616 		
617 		if (err !is null)
618 		{
619 			throw new GException( new ErrorG(err) );
620 		}
621 		
622 		if(p is null)
623 		{
624 			throw new ConstructionException("null returned by new_from_stream_at_scale");
625 		}
626 		
627 		this(cast(GdkPixbuf*) p, true);
628 	}
629 
630 	/**
631 	 * Finishes an asynchronous pixbuf creation operation started with
632 	 * gdk_pixbuf_new_from_stream_async().
633 	 *
634 	 * Params:
635 	 *     asyncResult = a #GAsyncResult
636 	 *
637 	 * Returns: a #GdkPixbuf or %NULL on error. Free the returned
638 	 *     object with g_object_unref().
639 	 *
640 	 * Since: 2.24
641 	 *
642 	 * Throws: GException on failure.
643 	 * Throws: ConstructionException GTK+ fails to create the object.
644 	 */
645 	public this(AsyncResultIF asyncResult)
646 	{
647 		GError* err = null;
648 		
649 		auto p = gdk_pixbuf_new_from_stream_finish((asyncResult is null) ? null : asyncResult.getAsyncResultStruct(), &err);
650 		
651 		if (err !is null)
652 		{
653 			throw new GException( new ErrorG(err) );
654 		}
655 		
656 		if(p is null)
657 		{
658 			throw new ConstructionException("null returned by new_from_stream_finish");
659 		}
660 		
661 		this(cast(GdkPixbuf*) p, true);
662 	}
663 
664 	/**
665 	 * Creates a new pixbuf by parsing XPM data in memory.  This data is commonly
666 	 * the result of including an XPM file into a program's C source.
667 	 *
668 	 * Params:
669 	 *     data = Pointer to inline XPM data.
670 	 *
671 	 * Returns: A newly-created pixbuf with a reference count of 1.
672 	 *
673 	 * Throws: ConstructionException GTK+ fails to create the object.
674 	 */
675 	public this(string[] data)
676 	{
677 		auto p = gdk_pixbuf_new_from_xpm_data(Str.toStringzArray(data));
678 		
679 		if(p is null)
680 		{
681 			throw new ConstructionException("null returned by new_from_xpm_data");
682 		}
683 		
684 		this(cast(GdkPixbuf*) p, true);
685 	}
686 
687 	/**
688 	 * Converts a #GdkPixdata to a #GdkPixbuf. If @copy_pixels is %TRUE or
689 	 * if the pixel data is run-length-encoded, the pixel data is copied into
690 	 * newly-allocated memory; otherwise it is reused.
691 	 *
692 	 * Deprecated: Use #GResource instead.
693 	 *
694 	 * Params:
695 	 *     pixdata = a #GdkPixdata to convert into a #GdkPixbuf.
696 	 *     copyPixels = whether to copy raw pixel data; run-length encoded
697 	 *         pixel data is always copied.
698 	 *
699 	 * Returns: a new #GdkPixbuf.
700 	 *
701 	 * Throws: GException on failure.
702 	 */
703 	public static Pixbuf fromPixdata(Pixdata pixdata, bool copyPixels)
704 	{
705 		GError* err = null;
706 		
707 		auto p = gdk_pixbuf_from_pixdata((pixdata is null) ? null : pixdata.getPixdataStruct(), copyPixels, &err);
708 		
709 		if (err !is null)
710 		{
711 			throw new GException( new ErrorG(err) );
712 		}
713 		
714 		if(p is null)
715 		{
716 			return null;
717 		}
718 		
719 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
720 	}
721 
722 	/**
723 	 * Parses an image file far enough to determine its format and size.
724 	 *
725 	 * Params:
726 	 *     filename = The name of the file to identify.
727 	 *     width = Return location for the width of the
728 	 *         image, or %NULL
729 	 *     height = Return location for the height of the
730 	 *         image, or %NULL
731 	 *
732 	 * Returns: A #GdkPixbufFormat describing
733 	 *     the image format of the file or %NULL if the image format wasn't
734 	 *     recognized. The return value is owned by #GdkPixbuf and should
735 	 *     not be freed.
736 	 *
737 	 * Since: 2.4
738 	 */
739 	public static PixbufFormat getFileInfo(string filename, out int width, out int height)
740 	{
741 		auto p = gdk_pixbuf_get_file_info(Str.toStringz(filename), &width, &height);
742 		
743 		if(p is null)
744 		{
745 			return null;
746 		}
747 		
748 		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p);
749 	}
750 
751 	/**
752 	 * Asynchronously parses an image file far enough to determine its
753 	 * format and size.
754 	 *
755 	 * For more details see gdk_pixbuf_get_file_info(), which is the synchronous
756 	 * version of this function.
757 	 *
758 	 * When the operation is finished, @callback will be called in the
759 	 * main thread. You can then call gdk_pixbuf_get_file_info_finish() to
760 	 * get the result of the operation.
761 	 *
762 	 * Params:
763 	 *     filename = The name of the file to identify
764 	 *     cancellable = optional #GCancellable object, %NULL to ignore
765 	 *     callback = a #GAsyncReadyCallback to call when the file info is available
766 	 *     userData = the data to pass to the callback function
767 	 *
768 	 * Since: 2.32
769 	 */
770 	public static void getFileInfoAsync(string filename, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
771 	{
772 		gdk_pixbuf_get_file_info_async(Str.toStringz(filename), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
773 	}
774 
775 	/**
776 	 * Finishes an asynchronous pixbuf parsing operation started with
777 	 * gdk_pixbuf_get_file_info_async().
778 	 *
779 	 * Params:
780 	 *     asyncResult = a #GAsyncResult
781 	 *     width = Return location for the width of the image, or %NULL
782 	 *     height = Return location for the height of the image, or %NULL
783 	 *
784 	 * Returns: A #GdkPixbufFormat describing the image
785 	 *     format of the file or %NULL if the image format wasn't
786 	 *     recognized. The return value is owned by GdkPixbuf and should
787 	 *     not be freed.
788 	 *
789 	 * Since: 2.32
790 	 *
791 	 * Throws: GException on failure.
792 	 */
793 	public static PixbufFormat getFileInfoFinish(AsyncResultIF asyncResult, out int width, out int height)
794 	{
795 		GError* err = null;
796 		
797 		auto p = gdk_pixbuf_get_file_info_finish((asyncResult is null) ? null : asyncResult.getAsyncResultStruct(), &width, &height, &err);
798 		
799 		if (err !is null)
800 		{
801 			throw new GException( new ErrorG(err) );
802 		}
803 		
804 		if(p is null)
805 		{
806 			return null;
807 		}
808 		
809 		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p);
810 	}
811 
812 	/**
813 	 * Obtains the available information about the image formats supported
814 	 * by GdkPixbuf.
815 	 *
816 	 * Returns: A list of
817 	 *     #GdkPixbufFormats describing the supported image formats. The list should
818 	 *     be freed when it is no longer needed, but the structures themselves are
819 	 *     owned by #GdkPixbuf and should not be freed.
820 	 *
821 	 * Since: 2.2
822 	 */
823 	public static ListSG getFormats()
824 	{
825 		auto p = gdk_pixbuf_get_formats();
826 		
827 		if(p is null)
828 		{
829 			return null;
830 		}
831 		
832 		return new ListSG(cast(GSList*) p);
833 	}
834 
835 	/**
836 	 * Creates a new pixbuf by asynchronously loading an image from an input stream.
837 	 *
838 	 * For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
839 	 * version of this function.
840 	 *
841 	 * When the operation is finished, @callback will be called in the main thread.
842 	 * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
843 	 *
844 	 * Params:
845 	 *     stream = a #GInputStream from which to load the pixbuf
846 	 *     cancellable = optional #GCancellable object, %NULL to ignore
847 	 *     callback = a #GAsyncReadyCallback to call when the pixbuf is loaded
848 	 *     userData = the data to pass to the callback function
849 	 *
850 	 * Since: 2.24
851 	 */
852 	public static void newFromStreamAsync(InputStream stream, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
853 	{
854 		gdk_pixbuf_new_from_stream_async((stream is null) ? null : stream.getInputStreamStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
855 	}
856 
857 	/**
858 	 * Creates a new pixbuf by asynchronously loading an image from an input stream.
859 	 *
860 	 * For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the synchronous
861 	 * version of this function.
862 	 *
863 	 * When the operation is finished, @callback will be called in the main thread.
864 	 * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
865 	 *
866 	 * Params:
867 	 *     stream = a #GInputStream from which to load the pixbuf
868 	 *     width = the width the image should have or -1 to not constrain the width
869 	 *     height = the height the image should have or -1 to not constrain the height
870 	 *     preserveAspectRatio = %TRUE to preserve the image's aspect ratio
871 	 *     cancellable = optional #GCancellable object, %NULL to ignore
872 	 *     callback = a #GAsyncReadyCallback to call when the pixbuf is loaded
873 	 *     userData = the data to pass to the callback function
874 	 *
875 	 * Since: 2.24
876 	 */
877 	public static void newFromStreamAtScaleAsync(InputStream stream, int width, int height, bool preserveAspectRatio, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
878 	{
879 		gdk_pixbuf_new_from_stream_at_scale_async((stream is null) ? null : stream.getInputStreamStruct(), width, height, preserveAspectRatio, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
880 	}
881 
882 	/**
883 	 * Finishes an asynchronous pixbuf save operation started with
884 	 * gdk_pixbuf_save_to_stream_async().
885 	 *
886 	 * Params:
887 	 *     asyncResult = a #GAsyncResult
888 	 *
889 	 * Returns: %TRUE if the pixbuf was saved successfully, %FALSE if an error was set.
890 	 *
891 	 * Since: 2.24
892 	 *
893 	 * Throws: GException on failure.
894 	 */
895 	public static bool saveToStreamFinish(AsyncResultIF asyncResult)
896 	{
897 		GError* err = null;
898 		
899 		auto p = gdk_pixbuf_save_to_stream_finish((asyncResult is null) ? null : asyncResult.getAsyncResultStruct(), &err) != 0;
900 		
901 		if (err !is null)
902 		{
903 			throw new GException( new ErrorG(err) );
904 		}
905 		
906 		return p;
907 	}
908 
909 	/**
910 	 * Takes an existing pixbuf and adds an alpha channel to it.
911 	 * If the existing pixbuf already had an alpha channel, the channel
912 	 * values are copied from the original; otherwise, the alpha channel
913 	 * is initialized to 255 (full opacity).
914 	 *
915 	 * If @substitute_color is %TRUE, then the color specified by (@r, @g, @b) will be
916 	 * assigned zero opacity. That is, if you pass (255, 255, 255) for the
917 	 * substitute color, all white pixels will become fully transparent.
918 	 *
919 	 * Params:
920 	 *     substituteColor = Whether to set a color to zero opacity.  If this
921 	 *         is %FALSE, then the (@r, @g, @b) arguments will be ignored.
922 	 *     r = Red value to substitute.
923 	 *     g = Green value to substitute.
924 	 *     b = Blue value to substitute.
925 	 *
926 	 * Returns: A newly-created pixbuf with a reference count of 1.
927 	 */
928 	public Pixbuf addAlpha(bool substituteColor, char r, char g, char b)
929 	{
930 		auto p = gdk_pixbuf_add_alpha(gdkPixbuf, substituteColor, r, g, b);
931 		
932 		if(p is null)
933 		{
934 			return null;
935 		}
936 		
937 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
938 	}
939 
940 	/**
941 	 * Takes an existing pixbuf and checks for the presence of an
942 	 * associated "orientation" option, which may be provided by the
943 	 * jpeg loader (which reads the exif orientation tag) or the
944 	 * tiff loader (which reads the tiff orientation tag, and
945 	 * compensates it for the partial transforms performed by
946 	 * libtiff). If an orientation option/tag is present, the
947 	 * appropriate transform will be performed so that the pixbuf
948 	 * is oriented correctly.
949 	 *
950 	 * Returns: A newly-created pixbuf, %NULL if
951 	 *     not enough memory could be allocated for it, or a reference to the
952 	 *     input pixbuf (with an increased reference count).
953 	 *
954 	 * Since: 2.12
955 	 */
956 	public Pixbuf applyEmbeddedOrientation()
957 	{
958 		auto p = gdk_pixbuf_apply_embedded_orientation(gdkPixbuf);
959 		
960 		if(p is null)
961 		{
962 			return null;
963 		}
964 		
965 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
966 	}
967 
968 	/**
969 	 * Creates a transformation of the source image @src by scaling by
970 	 * @scale_x and @scale_y then translating by @offset_x and @offset_y.
971 	 * This gives an image in the coordinates of the destination pixbuf.
972 	 * The rectangle (@dest_x, @dest_y, @dest_width, @dest_height)
973 	 * is then alpha blended onto the corresponding rectangle of the
974 	 * original destination image.
975 	 *
976 	 * When the destination rectangle contains parts not in the source
977 	 * image, the data at the edges of the source image is replicated
978 	 * to infinity.
979 	 *
980 	 * ![](composite.png)
981 	 *
982 	 * Params:
983 	 *     dest = the #GdkPixbuf into which to render the results
984 	 *     destX = the left coordinate for region to render
985 	 *     destY = the top coordinate for region to render
986 	 *     destWidth = the width of the region to render
987 	 *     destHeight = the height of the region to render
988 	 *     offsetX = the offset in the X direction (currently rounded to an integer)
989 	 *     offsetY = the offset in the Y direction (currently rounded to an integer)
990 	 *     scaleX = the scale factor in the X direction
991 	 *     scaleY = the scale factor in the Y direction
992 	 *     interpType = the interpolation type for the transformation.
993 	 *     overallAlpha = overall alpha for source image (0..255)
994 	 */
995 	public void composite(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType, int overallAlpha)
996 	{
997 		gdk_pixbuf_composite(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), destX, destY, destWidth, destHeight, offsetX, offsetY, scaleX, scaleY, interpType, overallAlpha);
998 	}
999 
1000 	/**
1001 	 * Creates a transformation of the source image @src by scaling by
1002 	 * @scale_x and @scale_y then translating by @offset_x and @offset_y,
1003 	 * then alpha blends the rectangle (@dest_x ,@dest_y, @dest_width,
1004 	 * @dest_height) of the resulting image with a checkboard of the
1005 	 * colors @color1 and @color2 and renders it onto the destination
1006 	 * image.
1007 	 *
1008 	 * If the source image has no alpha channel, and @overall_alpha is 255, a fast
1009 	 * path is used which omits the alpha blending and just performs the scaling.
1010 	 *
1011 	 * See gdk_pixbuf_composite_color_simple() for a simpler variant of this
1012 	 * function suitable for many tasks.
1013 	 *
1014 	 * Params:
1015 	 *     dest = the #GdkPixbuf into which to render the results
1016 	 *     destX = the left coordinate for region to render
1017 	 *     destY = the top coordinate for region to render
1018 	 *     destWidth = the width of the region to render
1019 	 *     destHeight = the height of the region to render
1020 	 *     offsetX = the offset in the X direction (currently rounded to an integer)
1021 	 *     offsetY = the offset in the Y direction (currently rounded to an integer)
1022 	 *     scaleX = the scale factor in the X direction
1023 	 *     scaleY = the scale factor in the Y direction
1024 	 *     interpType = the interpolation type for the transformation.
1025 	 *     overallAlpha = overall alpha for source image (0..255)
1026 	 *     checkX = the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
1027 	 *     checkY = the Y offset for the checkboard
1028 	 *     checkSize = the size of checks in the checkboard (must be a power of two)
1029 	 *     color1 = the color of check at upper left
1030 	 *     color2 = the color of the other check
1031 	 */
1032 	public void compositeColor(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType, int overallAlpha, int checkX, int checkY, int checkSize, uint color1, uint color2)
1033 	{
1034 		gdk_pixbuf_composite_color(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), destX, destY, destWidth, destHeight, offsetX, offsetY, scaleX, scaleY, interpType, overallAlpha, checkX, checkY, checkSize, color1, color2);
1035 	}
1036 
1037 	/**
1038 	 * Creates a new #GdkPixbuf by scaling @src to @dest_width x
1039 	 * @dest_height and alpha blending the result with a checkboard of colors
1040 	 * @color1 and @color2.
1041 	 *
1042 	 * Params:
1043 	 *     destWidth = the width of destination image
1044 	 *     destHeight = the height of destination image
1045 	 *     interpType = the interpolation type for the transformation.
1046 	 *     overallAlpha = overall alpha for source image (0..255)
1047 	 *     checkSize = the size of checks in the checkboard (must be a power of two)
1048 	 *     color1 = the color of check at upper left
1049 	 *     color2 = the color of the other check
1050 	 *
1051 	 * Returns: the new #GdkPixbuf, or %NULL if not enough memory could be
1052 	 *     allocated for it.
1053 	 */
1054 	public Pixbuf compositeColorSimple(int destWidth, int destHeight, GdkInterpType interpType, int overallAlpha, int checkSize, uint color1, uint color2)
1055 	{
1056 		auto p = gdk_pixbuf_composite_color_simple(gdkPixbuf, destWidth, destHeight, interpType, overallAlpha, checkSize, color1, color2);
1057 		
1058 		if(p is null)
1059 		{
1060 			return null;
1061 		}
1062 		
1063 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1064 	}
1065 
1066 	/**
1067 	 * Creates a new #GdkPixbuf with a copy of the information in the specified
1068 	 * @pixbuf. Note that this does not copy the options set on the original #GdkPixbuf,
1069 	 * use gdk_pixbuf_copy_options() for this.
1070 	 *
1071 	 * Returns: A newly-created pixbuf with a reference count of 1, or %NULL if
1072 	 *     not enough memory could be allocated.
1073 	 */
1074 	public Pixbuf copy()
1075 	{
1076 		auto p = gdk_pixbuf_copy(gdkPixbuf);
1077 		
1078 		if(p is null)
1079 		{
1080 			return null;
1081 		}
1082 		
1083 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1084 	}
1085 
1086 	/**
1087 	 * Copies a rectangular area from @src_pixbuf to @dest_pixbuf.  Conversion of
1088 	 * pixbuf formats is done automatically.
1089 	 *
1090 	 * If the source rectangle overlaps the destination rectangle on the
1091 	 * same pixbuf, it will be overwritten during the copy operation.
1092 	 * Therefore, you can not use this function to scroll a pixbuf.
1093 	 *
1094 	 * Params:
1095 	 *     srcX = Source X coordinate within @src_pixbuf.
1096 	 *     srcY = Source Y coordinate within @src_pixbuf.
1097 	 *     width = Width of the area to copy.
1098 	 *     height = Height of the area to copy.
1099 	 *     destPixbuf = Destination pixbuf.
1100 	 *     destX = X coordinate within @dest_pixbuf.
1101 	 *     destY = Y coordinate within @dest_pixbuf.
1102 	 */
1103 	public void copyArea(int srcX, int srcY, int width, int height, Pixbuf destPixbuf, int destX, int destY)
1104 	{
1105 		gdk_pixbuf_copy_area(gdkPixbuf, srcX, srcY, width, height, (destPixbuf is null) ? null : destPixbuf.getPixbufStruct(), destX, destY);
1106 	}
1107 
1108 	/**
1109 	 * Copy the key/value pair options attached to a #GdkPixbuf to another.
1110 	 * This is useful to keep original metadata after having manipulated
1111 	 * a file. However be careful to remove metadata which you've already
1112 	 * applied, such as the "orientation" option after rotating the image.
1113 	 *
1114 	 * Params:
1115 	 *     destPixbuf = the #GdkPixbuf to copy options to
1116 	 *
1117 	 * Returns: %TRUE on success.
1118 	 *
1119 	 * Since: 2.36
1120 	 */
1121 	public bool copyOptions(Pixbuf destPixbuf)
1122 	{
1123 		return gdk_pixbuf_copy_options(gdkPixbuf, (destPixbuf is null) ? null : destPixbuf.getPixbufStruct()) != 0;
1124 	}
1125 
1126 	/**
1127 	 * Clears a pixbuf to the given RGBA value, converting the RGBA value into
1128 	 * the pixbuf's pixel format. The alpha will be ignored if the pixbuf
1129 	 * doesn't have an alpha channel.
1130 	 *
1131 	 * Params:
1132 	 *     pixel = RGBA pixel to clear to
1133 	 *         (0xffffffff is opaque white, 0x00000000 transparent black)
1134 	 */
1135 	public void fill(uint pixel)
1136 	{
1137 		gdk_pixbuf_fill(gdkPixbuf, pixel);
1138 	}
1139 
1140 	/**
1141 	 * Flips a pixbuf horizontally or vertically and returns the
1142 	 * result in a new pixbuf.
1143 	 *
1144 	 * Params:
1145 	 *     horizontal = %TRUE to flip horizontally, %FALSE to flip vertically
1146 	 *
1147 	 * Returns: the new #GdkPixbuf, or %NULL
1148 	 *     if not enough memory could be allocated for it.
1149 	 *
1150 	 * Since: 2.6
1151 	 */
1152 	public Pixbuf flip(bool horizontal)
1153 	{
1154 		auto p = gdk_pixbuf_flip(gdkPixbuf, horizontal);
1155 		
1156 		if(p is null)
1157 		{
1158 			return null;
1159 		}
1160 		
1161 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1162 	}
1163 
1164 	/**
1165 	 * Queries the number of bits per color sample in a pixbuf.
1166 	 *
1167 	 * Returns: Number of bits per color sample.
1168 	 */
1169 	public int getBitsPerSample()
1170 	{
1171 		return gdk_pixbuf_get_bits_per_sample(gdkPixbuf);
1172 	}
1173 
1174 	/**
1175 	 * Returns the length of the pixel data, in bytes.
1176 	 *
1177 	 * Returns: The length of the pixel data.
1178 	 *
1179 	 * Since: 2.26
1180 	 */
1181 	public size_t getByteLength()
1182 	{
1183 		return gdk_pixbuf_get_byte_length(gdkPixbuf);
1184 	}
1185 
1186 	/**
1187 	 * Queries the color space of a pixbuf.
1188 	 *
1189 	 * Returns: Color space.
1190 	 */
1191 	public GdkColorspace getColorspace()
1192 	{
1193 		return gdk_pixbuf_get_colorspace(gdkPixbuf);
1194 	}
1195 
1196 	/**
1197 	 * Queries whether a pixbuf has an alpha channel (opacity information).
1198 	 *
1199 	 * Returns: %TRUE if it has an alpha channel, %FALSE otherwise.
1200 	 */
1201 	public bool getHasAlpha()
1202 	{
1203 		return gdk_pixbuf_get_has_alpha(gdkPixbuf) != 0;
1204 	}
1205 
1206 	/**
1207 	 * Queries the height of a pixbuf.
1208 	 *
1209 	 * Returns: Height in pixels.
1210 	 */
1211 	public int getHeight()
1212 	{
1213 		return gdk_pixbuf_get_height(gdkPixbuf);
1214 	}
1215 
1216 	/**
1217 	 * Queries the number of channels of a pixbuf.
1218 	 *
1219 	 * Returns: Number of channels.
1220 	 */
1221 	public int getNChannels()
1222 	{
1223 		return gdk_pixbuf_get_n_channels(gdkPixbuf);
1224 	}
1225 
1226 	/**
1227 	 * Looks up @key in the list of options that may have been attached to the
1228 	 * @pixbuf when it was loaded, or that may have been attached by another
1229 	 * function using gdk_pixbuf_set_option().
1230 	 *
1231 	 * For instance, the ANI loader provides "Title" and "Artist" options.
1232 	 * The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
1233 	 * options for cursor definitions. The PNG loader provides the tEXt ancillary
1234 	 * chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
1235 	 * return an "orientation" option string that corresponds to the embedded
1236 	 * TIFF/Exif orientation tag (if present). Since 2.32, the TIFF loader sets
1237 	 * the "multipage" option string to "yes" when a multi-page TIFF is loaded.
1238 	 * Since 2.32 the JPEG and PNG loaders set "x-dpi" and "y-dpi" if the file
1239 	 * contains image density information in dots per inch.
1240 	 *
1241 	 * Params:
1242 	 *     key = a nul-terminated string.
1243 	 *
1244 	 * Returns: the value associated with @key. This is a nul-terminated
1245 	 *     string that should not be freed or %NULL if @key was not found.
1246 	 */
1247 	public string getOption(string key)
1248 	{
1249 		return Str.toString(gdk_pixbuf_get_option(gdkPixbuf, Str.toStringz(key)));
1250 	}
1251 
1252 	/**
1253 	 * Returns a #GHashTable with a list of all the options that may have been
1254 	 * attached to the @pixbuf when it was loaded, or that may have been
1255 	 * attached by another function using gdk_pixbuf_set_option().
1256 	 *
1257 	 * See gdk_pixbuf_get_option() for more details.
1258 	 *
1259 	 * Returns: a #GHashTable of key/values
1260 	 *
1261 	 * Since: 2.32
1262 	 */
1263 	public HashTable getOptions()
1264 	{
1265 		auto p = gdk_pixbuf_get_options(gdkPixbuf);
1266 		
1267 		if(p is null)
1268 		{
1269 			return null;
1270 		}
1271 		
1272 		return new HashTable(cast(GHashTable*) p);
1273 	}
1274 
1275 	/**
1276 	 * Queries a pointer to the pixel data of a pixbuf.
1277 	 *
1278 	 * Returns: A pointer to the pixbuf's
1279 	 *     pixel data.  Please see the section on [image data](image-data)
1280 	 *     for information about how the pixel data is stored in memory.
1281 	 *
1282 	 *     This function will cause an implicit copy of the pixbuf data if the
1283 	 *     pixbuf was created from read-only data.
1284 	 *
1285 	 * Since: 2.26
1286 	 */
1287 	public char[] getPixelsWithLength()
1288 	{
1289 		uint length;
1290 		
1291 		auto p = gdk_pixbuf_get_pixels_with_length(gdkPixbuf, &length);
1292 		
1293 		return p[0 .. length];
1294 	}
1295 
1296 	/**
1297 	 * Queries the rowstride of a pixbuf, which is the number of bytes between
1298 	 * the start of a row and the start of the next row.
1299 	 *
1300 	 * Returns: Distance between row starts.
1301 	 */
1302 	public int getRowstride()
1303 	{
1304 		return gdk_pixbuf_get_rowstride(gdkPixbuf);
1305 	}
1306 
1307 	/**
1308 	 * Queries the width of a pixbuf.
1309 	 *
1310 	 * Returns: Width in pixels.
1311 	 */
1312 	public int getWidth()
1313 	{
1314 		return gdk_pixbuf_get_width(gdkPixbuf);
1315 	}
1316 
1317 	/**
1318 	 * Creates a new pixbuf which represents a sub-region of @src_pixbuf.
1319 	 * The new pixbuf shares its pixels with the original pixbuf, so
1320 	 * writing to one affects both.  The new pixbuf holds a reference to
1321 	 * @src_pixbuf, so @src_pixbuf will not be finalized until the new
1322 	 * pixbuf is finalized.
1323 	 *
1324 	 * Note that if @src_pixbuf is read-only, this function will force it
1325 	 * to be mutable.
1326 	 *
1327 	 * Params:
1328 	 *     srcX = X coord in @src_pixbuf
1329 	 *     srcY = Y coord in @src_pixbuf
1330 	 *     width = width of region in @src_pixbuf
1331 	 *     height = height of region in @src_pixbuf
1332 	 *
1333 	 * Returns: a new pixbuf
1334 	 */
1335 	public Pixbuf newSubpixbuf(int srcX, int srcY, int width, int height)
1336 	{
1337 		auto p = gdk_pixbuf_new_subpixbuf(gdkPixbuf, srcX, srcY, width, height);
1338 		
1339 		if(p is null)
1340 		{
1341 			return null;
1342 		}
1343 		
1344 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1345 	}
1346 
1347 	/**
1348 	 * Returns: A new reference to a read-only copy of
1349 	 *     the pixel data.  Note that for mutable pixbufs, this function will
1350 	 *     incur a one-time copy of the pixel data for conversion into the
1351 	 *     returned #GBytes.
1352 	 *
1353 	 * Since: 2.32
1354 	 */
1355 	public Bytes readPixelBytes()
1356 	{
1357 		auto p = gdk_pixbuf_read_pixel_bytes(gdkPixbuf);
1358 		
1359 		if(p is null)
1360 		{
1361 			return null;
1362 		}
1363 		
1364 		return new Bytes(cast(GBytes*) p, true);
1365 	}
1366 
1367 	/**
1368 	 * Returns a read-only pointer to the raw pixel data; must not be
1369 	 * modified.  This function allows skipping the implicit copy that
1370 	 * must be made if gdk_pixbuf_get_pixels() is called on a read-only
1371 	 * pixbuf.
1372 	 *
1373 	 * Since: 2.32
1374 	 */
1375 	public ubyte* readPixels()
1376 	{
1377 		return gdk_pixbuf_read_pixels(gdkPixbuf);
1378 	}
1379 
1380 	/**
1381 	 * Remove the key/value pair option attached to a #GdkPixbuf.
1382 	 *
1383 	 * Params:
1384 	 *     key = a nul-terminated string representing the key to remove.
1385 	 *
1386 	 * Returns: %TRUE if an option was removed, %FALSE if not.
1387 	 *
1388 	 * Since: 2.36
1389 	 */
1390 	public bool removeOption(string key)
1391 	{
1392 		return gdk_pixbuf_remove_option(gdkPixbuf, Str.toStringz(key)) != 0;
1393 	}
1394 
1395 	/**
1396 	 * Rotates a pixbuf by a multiple of 90 degrees, and returns the
1397 	 * result in a new pixbuf.
1398 	 *
1399 	 * If @angle is 0, a copy of @src is returned, avoiding any rotation.
1400 	 *
1401 	 * Params:
1402 	 *     angle = the angle to rotate by
1403 	 *
1404 	 * Returns: the new #GdkPixbuf, or %NULL
1405 	 *     if not enough memory could be allocated for it.
1406 	 *
1407 	 * Since: 2.6
1408 	 */
1409 	public Pixbuf rotateSimple(GdkPixbufRotation angle)
1410 	{
1411 		auto p = gdk_pixbuf_rotate_simple(gdkPixbuf, angle);
1412 		
1413 		if(p is null)
1414 		{
1415 			return null;
1416 		}
1417 		
1418 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1419 	}
1420 
1421 	/**
1422 	 * Modifies saturation and optionally pixelates @src, placing the result in
1423 	 * @dest. @src and @dest may be the same pixbuf with no ill effects.  If
1424 	 * @saturation is 1.0 then saturation is not changed. If it's less than 1.0,
1425 	 * saturation is reduced (the image turns toward grayscale); if greater than
1426 	 * 1.0, saturation is increased (the image gets more vivid colors). If @pixelate
1427 	 * is %TRUE, then pixels are faded in a checkerboard pattern to create a
1428 	 * pixelated image. @src and @dest must have the same image format, size, and
1429 	 * rowstride.
1430 	 *
1431 	 * Params:
1432 	 *     dest = place to write modified version of @src
1433 	 *     saturation = saturation factor
1434 	 *     pixelate = whether to pixelate
1435 	 */
1436 	public void saturateAndPixelate(Pixbuf dest, float saturation, bool pixelate)
1437 	{
1438 		gdk_pixbuf_saturate_and_pixelate(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), saturation, pixelate);
1439 	}
1440 
1441 	/**
1442 	 * Saves pixbuf to a callback in format @type, which is currently "jpeg",
1443 	 * "png", "tiff", "ico" or "bmp".  If @error is set, %FALSE will be returned. See
1444 	 * gdk_pixbuf_save_to_callback () for more details.
1445 	 *
1446 	 * Params:
1447 	 *     saveFunc = a function that is called to save each block of data that
1448 	 *         the save routine generates.
1449 	 *     userData = user data to pass to the save function.
1450 	 *     type = name of file format.
1451 	 *     optionKeys = name of options to set, %NULL-terminated
1452 	 *     optionValues = values for named options
1453 	 *
1454 	 * Returns: whether an error was set
1455 	 *
1456 	 * Since: 2.4
1457 	 *
1458 	 * Throws: GException on failure.
1459 	 */
1460 	public bool saveToCallbackv(GdkPixbufSaveFunc saveFunc, void* userData, string type, string[] optionKeys, string[] optionValues)
1461 	{
1462 		GError* err = null;
1463 		
1464 		auto p = gdk_pixbuf_save_to_callbackv(gdkPixbuf, saveFunc, userData, Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err) != 0;
1465 		
1466 		if (err !is null)
1467 		{
1468 			throw new GException( new ErrorG(err) );
1469 		}
1470 		
1471 		return p;
1472 	}
1473 
1474 	/**
1475 	 * Saves @pixbuf to an output stream.
1476 	 *
1477 	 * Supported file formats are currently "jpeg", "tiff", "png", "ico" or
1478 	 * "bmp". See gdk_pixbuf_save_to_stream() for more details.
1479 	 *
1480 	 * Params:
1481 	 *     stream = a #GOutputStream to save the pixbuf to
1482 	 *     type = name of file format
1483 	 *     optionKeys = name of options to set, %NULL-terminated
1484 	 *     optionValues = values for named options
1485 	 *     cancellable = optional #GCancellable object, %NULL to ignore
1486 	 *
1487 	 * Returns: %TRUE if the pixbuf was saved successfully, %FALSE if an
1488 	 *     error was set.
1489 	 *
1490 	 * Since: 2.36
1491 	 *
1492 	 * Throws: GException on failure.
1493 	 */
1494 	public bool saveToStreamv(OutputStream stream, string type, string[] optionKeys, string[] optionValues, Cancellable cancellable)
1495 	{
1496 		GError* err = null;
1497 		
1498 		auto p = gdk_pixbuf_save_to_streamv(gdkPixbuf, (stream is null) ? null : stream.getOutputStreamStruct(), Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1499 		
1500 		if (err !is null)
1501 		{
1502 			throw new GException( new ErrorG(err) );
1503 		}
1504 		
1505 		return p;
1506 	}
1507 
1508 	/**
1509 	 * Saves @pixbuf to an output stream asynchronously.
1510 	 *
1511 	 * For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous
1512 	 * version of this function.
1513 	 *
1514 	 * When the operation is finished, @callback will be called in the main thread.
1515 	 * You can then call gdk_pixbuf_save_to_stream_finish() to get the result of the operation.
1516 	 *
1517 	 * Params:
1518 	 *     stream = a #GOutputStream to which to save the pixbuf
1519 	 *     type = name of file format
1520 	 *     optionKeys = name of options to set, %NULL-terminated
1521 	 *     optionValues = values for named options
1522 	 *     cancellable = optional #GCancellable object, %NULL to ignore
1523 	 *     callback = a #GAsyncReadyCallback to call when the pixbuf is saved
1524 	 *     userData = the data to pass to the callback function
1525 	 *
1526 	 * Since: 2.36
1527 	 */
1528 	public void saveToStreamvAsync(OutputStream stream, string type, string[] optionKeys, string[] optionValues, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1529 	{
1530 		gdk_pixbuf_save_to_streamv_async(gdkPixbuf, (stream is null) ? null : stream.getOutputStreamStruct(), Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1531 	}
1532 
1533 	/**
1534 	 * Saves pixbuf to a file in @type, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
1535 	 * If @error is set, %FALSE will be returned.
1536 	 * See gdk_pixbuf_save () for more details.
1537 	 *
1538 	 * Params:
1539 	 *     filename = name of file to save.
1540 	 *     type = name of file format.
1541 	 *     optionKeys = name of options to set, %NULL-terminated
1542 	 *     optionValues = values for named options
1543 	 *
1544 	 * Returns: whether an error was set
1545 	 *
1546 	 * Throws: GException on failure.
1547 	 */
1548 	public bool savev(string filename, string type, string[] optionKeys, string[] optionValues)
1549 	{
1550 		GError* err = null;
1551 		
1552 		auto p = gdk_pixbuf_savev(gdkPixbuf, Str.toStringz(filename), Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err) != 0;
1553 		
1554 		if (err !is null)
1555 		{
1556 			throw new GException( new ErrorG(err) );
1557 		}
1558 		
1559 		return p;
1560 	}
1561 
1562 	/**
1563 	 * Creates a transformation of the source image @src by scaling by
1564 	 * @scale_x and @scale_y then translating by @offset_x and @offset_y,
1565 	 * then renders the rectangle (@dest_x, @dest_y, @dest_width,
1566 	 * @dest_height) of the resulting image onto the destination image
1567 	 * replacing the previous contents.
1568 	 *
1569 	 * Try to use gdk_pixbuf_scale_simple() first, this function is
1570 	 * the industrial-strength power tool you can fall back to if
1571 	 * gdk_pixbuf_scale_simple() isn't powerful enough.
1572 	 *
1573 	 * If the source rectangle overlaps the destination rectangle on the
1574 	 * same pixbuf, it will be overwritten during the scaling which
1575 	 * results in rendering artifacts.
1576 	 *
1577 	 * Params:
1578 	 *     dest = the #GdkPixbuf into which to render the results
1579 	 *     destX = the left coordinate for region to render
1580 	 *     destY = the top coordinate for region to render
1581 	 *     destWidth = the width of the region to render
1582 	 *     destHeight = the height of the region to render
1583 	 *     offsetX = the offset in the X direction (currently rounded to an integer)
1584 	 *     offsetY = the offset in the Y direction (currently rounded to an integer)
1585 	 *     scaleX = the scale factor in the X direction
1586 	 *     scaleY = the scale factor in the Y direction
1587 	 *     interpType = the interpolation type for the transformation.
1588 	 */
1589 	public void scale(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType)
1590 	{
1591 		gdk_pixbuf_scale(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), destX, destY, destWidth, destHeight, offsetX, offsetY, scaleX, scaleY, interpType);
1592 	}
1593 
1594 	/**
1595 	 * Create a new #GdkPixbuf containing a copy of @src scaled to
1596 	 * @dest_width x @dest_height. Leaves @src unaffected.  @interp_type
1597 	 * should be #GDK_INTERP_NEAREST if you want maximum speed (but when
1598 	 * scaling down #GDK_INTERP_NEAREST is usually unusably ugly).  The
1599 	 * default @interp_type should be #GDK_INTERP_BILINEAR which offers
1600 	 * reasonable quality and speed.
1601 	 *
1602 	 * You can scale a sub-portion of @src by creating a sub-pixbuf
1603 	 * pointing into @src; see gdk_pixbuf_new_subpixbuf().
1604 	 *
1605 	 * If @dest_width and @dest_height are equal to the @src width and height, a
1606 	 * copy of @src is returned, avoiding any scaling.
1607 	 *
1608 	 * For more complicated scaling/alpha blending see gdk_pixbuf_scale()
1609 	 * and gdk_pixbuf_composite().
1610 	 *
1611 	 * Params:
1612 	 *     destWidth = the width of destination image
1613 	 *     destHeight = the height of destination image
1614 	 *     interpType = the interpolation type for the transformation.
1615 	 *
1616 	 * Returns: the new #GdkPixbuf, or %NULL if not enough memory could be
1617 	 *     allocated for it.
1618 	 */
1619 	public Pixbuf scaleSimple(int destWidth, int destHeight, GdkInterpType interpType)
1620 	{
1621 		auto p = gdk_pixbuf_scale_simple(gdkPixbuf, destWidth, destHeight, interpType);
1622 		
1623 		if(p is null)
1624 		{
1625 			return null;
1626 		}
1627 		
1628 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1629 	}
1630 
1631 	/**
1632 	 * Attaches a key/value pair as an option to a #GdkPixbuf. If @key already
1633 	 * exists in the list of options attached to @pixbuf, the new value is
1634 	 * ignored and %FALSE is returned.
1635 	 *
1636 	 * Params:
1637 	 *     key = a nul-terminated string.
1638 	 *     value = a nul-terminated string.
1639 	 *
1640 	 * Returns: %TRUE on success.
1641 	 *
1642 	 * Since: 2.2
1643 	 */
1644 	public bool setOption(string key, string value)
1645 	{
1646 		return gdk_pixbuf_set_option(gdkPixbuf, Str.toStringz(key), Str.toStringz(value)) != 0;
1647 	}
1648 }