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