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  * Conversion parameters:
26  * inFile  = gdk3-Pixbufs.html
27  * outPack = gdk
28  * outFile = Pixbuf
29  * strct   = GdkPixbuf
30  * realStrct=
31  * ctorStrct=
32  * clss    = Pixbuf
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = GObject
38  * implements:
39  * 	- IconIF
40  * 	- LoadableIconIF
41  * prefixes:
42  * 	- gdk_pixbuf_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- cairo.Surface
49  * 	- glib.Str
50  * 	- glib.ErrorG
51  * 	- glib.GException
52  * 	- gio.AsyncResultIF
53  * 	- gio.Cancellable
54  * 	- gio.InputStream
55  * 	- gdk.Window
56  * 	- gdkpixbuf.PixbufFormat
57  * 	- gio.IconT
58  * 	- gio.IconIF
59  * 	- gio.LoadableIconT
60  * 	- gio.LoadableIconIF
61  * structWrap:
62  * 	- GAsyncResult* -> AsyncResultIF
63  * 	- GCancellable* -> Cancellable
64  * 	- GInputStream* -> InputStream
65  * 	- GdkPixbuf* -> Pixbuf
66  * 	- GdkPixbufFormat* -> PixbufFormat
67  * 	- GdkWindow* -> Window
68  * 	- cairo_surface_t* -> Surface
69  * module aliases:
70  * local aliases:
71  * overrides:
72  */
73 
74 module gdk.Pixbuf;
75 
76 public  import gtkc.gdktypes;
77 
78 private import gtkc.gdk;
79 private import glib.ConstructionException;
80 private import gobject.ObjectG;
81 
82 private import cairo.Surface;
83 private import glib.Str;
84 private import glib.ErrorG;
85 private import glib.GException;
86 private import gio.AsyncResultIF;
87 private import gio.Cancellable;
88 private import gio.InputStream;
89 private import gdk.Window;
90 private import gdkpixbuf.PixbufFormat;
91 private import gio.IconT;
92 private import gio.IconIF;
93 private import gio.LoadableIconT;
94 private import gio.LoadableIconIF;
95 
96 
97 private import gobject.ObjectG;
98 
99 /**
100  * Pixbufs are client-side images. For details on how to create
101  * and manipulate pixbufs, see the GdkPixbuf API documentation.
102  *
103  * The functions described here allow to obtain pixbufs from
104  * GdkWindows and cairo surfaces.
105  */
106 public class Pixbuf : ObjectG, IconIF, LoadableIconIF
107 {
108 	
109 	/** the main Gtk struct */
110 	protected GdkPixbuf* gdkPixbuf;
111 	
112 	
113 	/** Get the main Gtk struct */
114 	public GdkPixbuf* getPixbufStruct()
115 	{
116 		return gdkPixbuf;
117 	}
118 	
119 	
120 	/** the main Gtk struct as a void* */
121 	protected override void* getStruct()
122 	{
123 		return cast(void*)gdkPixbuf;
124 	}
125 	
126 	/**
127 	 * Sets our main struct and passes it to the parent class
128 	 */
129 	public this (GdkPixbuf* gdkPixbuf)
130 	{
131 		super(cast(GObject*)gdkPixbuf);
132 		this.gdkPixbuf = gdkPixbuf;
133 	}
134 	
135 	protected override void setStruct(GObject* obj)
136 	{
137 		super.setStruct(obj);
138 		gdkPixbuf = cast(GdkPixbuf*)obj;
139 	}
140 	
141 	// Minimal implementation.
142 	mixin IconT!(GdkPixbuf);
143 	
144 	// add the LoadableIcon capabilities
145 	mixin LoadableIconT!(GdkPixbuf);
146 	
147 	~this(){
148 		unref();
149 	}
150 	
151 	/**
152 	 * Saves pixbuf to a new buffer in format type, which is currently "jpeg",
153 	 * "tiff", "png", "ico" or "bmp". See gdk_pixbuf_save_to_buffer() for more details.
154 	 * Since 2.4
155 	 * Params:
156 	 * buffer =  location to receive a pointer to the new buffer.
157 	 * type =  name of file format.
158 	 * optionKeys =  name of options to set, NULL-terminated
159 	 * optionValues =  values for named options
160 	 * Returns: whether an error was set
161 	 * Throws: GException on failure.
162 	 */
163 	public int saveToBuffer(out ubyte[] buffer, string type, string[] optionKeys, string[] optionValues)
164 	{
165 		gchar* outbuffer = null;
166 		gsize bufferSize;
167 		GError* err = null;
168 		
169 		// gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,  gchar **buffer,  gsize *buffer_size,  const char *type,  char **option_keys,  char **option_values,  GError **error);
170 		auto p = gdk_pixbuf_save_to_bufferv(gdkPixbuf, &outbuffer, &bufferSize, Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err);
171 		
172 		if (err !is null)
173 		{
174 			throw new GException( new ErrorG(err) );
175 		}
176 		
177 		buffer = (cast(ubyte*)outbuffer)[0 .. bufferSize];
178 		return p;
179 	}
180 	
181 	/**
182 	 * The most basic way to create a pixbuf is to wrap an existing pixel
183 	 * buffer with a GdkPixbuf structure. You can use the
184 	 * gdk_pixbuf_new_from_data() function to do this You need to specify
185 	 * the destroy notification function that will be called when the
186 	 * data buffer needs to be freed; this will happen when a GdkPixbuf
187 	 * is finalized by the reference counting functions If you have a
188 	 * chunk of static data compiled into your application, you can pass
189 	 * in NULL as the destroy notification function so that the data
190 	 * will not be freed.
191 	 *
192 	 * The gdk_pixbuf_new() function can be used as a convenience to
193 	 * create a pixbuf with an empty buffer. This is equivalent to
194 	 * allocating a data buffer using malloc() and
195 	 * then wrapping it with gdk_pixbuf_new_from_data(). The gdk_pixbuf_new()
196 	 * function will compute an optimal rowstride so that rendering can be
197 	 * performed with an efficient algorithm.
198 	 *
199 	 * As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
200 	 * function to create a pixbuf from inline XPM image data.
201 	 *
202 	 * You can also copy an existing pixbuf with the gdk_pixbuf_copy()
203 	 * function. This is not the same as just doing a g_object_ref()
204 	 * on the old pixbuf; the copy function will actually duplicate the
205 	 * pixel data in memory and create a new GdkPixbuf structure for it.
206 	 */
207 	
208 	/**
209 	 * The GdkPixbuf structure contains
210 	 * information that describes an image in memory.
211 	 *
212 	 * Image Data
213 	 *
214 	 * Image data in a pixbuf is stored in memory in uncompressed,
215 	 * packed format. Rows in the image are stored top to bottom, and
216 	 * in each row pixels are stored from left to right. There may be
217 	 * padding at the end of a row. The "rowstride" value of a pixbuf,
218 	 * as returned by gdk_pixbuf_get_rowstride(), indicates the number
219 	 * of bytes between rows.
220 	 *
221 	 * $(DDOC_COMMENT example)
222 	 *
223 	 * Note
224 	 *
225 	 * If you are doing memcpy() of raw pixbuf data, note that the
226 	 * last row in the pixbuf may not be as wide as the full
227 	 * rowstride, but rather just as wide as the pixel data needs to
228 	 * be. That is, it is unsafe to do memcpy (dest,
229 	 * pixels, rowstride * height) to copy a whole pixbuf.
230 	 * Use gdk_pixbuf_copy() instead, or compute the width in bytes
231 	 * of the last row as width * ((n_channels *
232 	 * bits_per_sample + 7) / 8).
233 	 */
234 	
235 	/**
236 	 * GdkPixbuf structures are reference counted. This means that an
237 	 * application can share a single pixbuf among many parts of the
238 	 * code. When a piece of the program needs to keep a pointer to a
239 	 * pixbuf, it should add a reference to it by calling g_object_ref().
240 	 * When it no longer needs the pixbuf, it should subtract a reference
241 	 * by calling g_object_unref(). The pixbuf will be destroyed when
242 	 * its reference count drops to zero. Newly-created GdkPixbuf
243 	 * structures start with a reference count of one.
244 	 *
245 	 * Note
246 	 *
247 	 * As GdkPixbuf is derived from GObject now, gdk_pixbuf_ref() and
248 	 * gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
249 	 * and g_object_unref() resp.
250 	 *
251 	 * Finalizing a pixbuf means to free its pixel
252 	 * data and to free the GdkPixbuf structure itself. Most of the
253 	 * library functions that create GdkPixbuf structures create the
254 	 * pixel data by themselves and define the way it should be freed;
255 	 * you do not need to worry about those. The only function that lets
256 	 * you specify how to free the pixel data is
257 	 * gdk_pixbuf_new_from_data(). Since you pass it a pre-allocated
258 	 * pixel buffer, you must also specify a way to free that data. This
259 	 * is done with a function of type GdkPixbufDestroyNotify. When a
260 	 * pixbuf created with gdk_pixbuf_new_from_data() is finalized, your
261 	 * destroy notification function will be called, and it is its
262 	 * responsibility to free the pixel array.
263 	 */
264 	
265 	/**
266 	 * The GdkPixBuf library provides a simple mechanism for loading
267 	 * an image from a file in synchronous fashion. This means that the
268 	 * library takes control of the application while the file is being
269 	 * loaded; from the user's point of view, the application will block
270 	 * until the image is done loading.
271 	 *
272 	 * This interface can be used by applications in which blocking is
273 	 * acceptable while an image is being loaded. It can also be used to
274 	 * load small images in general. Applications that need progressive
275 	 * loading can use the GdkPixbufLoader functionality instead.
276 	 */
277 	
278 	/**
279 	 * These functions allow to save a GdkPixbuf in a number of
280 	 * file formats. The formatted data can be written to a file
281 	 * or to a memory buffer. GdkPixBuf can also call a user-defined
282 	 * callback on the data, which allows to e.g. write the image
283 	 * to a socket or store it in a database.
284 	 */
285 	
286 	/**
287 	 * The GdkPixBuf contains functions to scale pixbufs, to scale
288 	 * pixbufs and composite against an existing image, and to scale
289 	 * pixbufs and composite against a solid color or checkerboard.
290 	 * Compositing a checkerboard is a common way to show an image with
291 	 * an alpha channel in image-viewing and editing software.
292 	 *
293 	 * Since the full-featured functions (gdk_pixbuf_scale(),
294 	 * gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
295 	 * rather complex to use and have many arguments, two simple
296 	 * convenience functions are provided, gdk_pixbuf_scale_simple() and
297 	 * gdk_pixbuf_composite_color_simple() which create a new pixbuf of a
298 	 * given size, scale an original image to fit, and then return the
299 	 * new pixbuf.
300 	 *
301 	 * Scaling and compositing functions take advantage of MMX hardware
302 	 * acceleration on systems where MMX is supported. If gdk-pixbuf is built
303 	 * with the Sun mediaLib library, these functions are instead accelerated
304 	 * using mediaLib, which provides hardware acceleration on Intel, AMD,
305 	 * and Sparc chipsets. If desired, mediaLib support can be turned off by
306 	 * setting the GDK_DISABLE_MEDIALIB environment variable.
307 	 *
308 	 * The following example demonstrates handling an expose event by
309 	 * rendering the appropriate area of a source image (which is scaled
310 	 * to fit the widget) onto the widget's window. The source image is
311 	 * rendered against a checkerboard, which provides a visual
312 	 * representation of the alpha channel if the image has one. If the
313 	 * image doesn't have an alpha channel, calling
314 	 * gdk_pixbuf_composite_color() function has exactly the same effect
315 	 * as calling gdk_pixbuf_scale().
316 	 *
317 	 * $(DDOC_COMMENT example)
318 	 */
319 	
320 	/**
321 	 * These functions provide miscellaneous utilities for manipulating
322 	 * pixbufs. The pixel data in pixbufs may of course be manipulated
323 	 * directly by applications, but several common operations can be
324 	 * performed by these functions instead.
325 	 */
326 	
327 	/**
328 	 * Transfers image data from a GdkWindow and converts it to an RGB(A)
329 	 * representation inside a GdkPixbuf. In other words, copies
330 	 * image data from a server-side drawable to a client-side RGB(A) buffer.
331 	 * This allows you to efficiently read individual pixels on the client side.
332 	 * This function will create an RGB pixbuf with 8 bits per channel with
333 	 * the same size specified by the width and height arguments. The pixbuf
334 	 * will contain an alpha channel if the window contains one.
335 	 * If the window is off the screen, then there is no image data in the
336 	 * obscured/offscreen regions to be placed in the pixbuf. The contents of
337 	 * portions of the pixbuf corresponding to the offscreen region are undefined.
338 	 * If the window you're obtaining data from is partially obscured by
339 	 * other windows, then the contents of the pixbuf areas corresponding
340 	 * to the obscured regions are undefined.
341 	 * If the window is not mapped (typically because it's iconified/minimized
342 	 * or not on the current workspace), then NULL will be returned.
343 	 * If memory can't be allocated for the return value, NULL will be returned
344 	 * instead.
345 	 * (In short, there are several ways this function can fail, and if it fails
346 	 *  it returns NULL; so check the return value.)
347 	 * Params:
348 	 * window = Source window
349 	 * srcX = Source X coordinate within window
350 	 * srcY = Source Y coordinate within window
351 	 * width = Width in pixels of region to get
352 	 * height = Height in pixels of region to get
353 	 * Returns: A newly-created pixbuf with a reference count of 1, or NULL on error. [transfer full]
354 	 */
355 	public static Pixbuf getFromWindow(Window window, int srcX, int srcY, int width, int height)
356 	{
357 		// GdkPixbuf * gdk_pixbuf_get_from_window (GdkWindow *window,  gint src_x,  gint src_y,  gint width,  gint height);
358 		auto p = gdk_pixbuf_get_from_window((window is null) ? null : window.getWindowStruct(), srcX, srcY, width, height);
359 		
360 		if(p is null)
361 		{
362 			return null;
363 		}
364 		
365 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
366 	}
367 	
368 	/**
369 	 * Transfers image data from a cairo_surface_t and converts it to an RGB(A)
370 	 * representation inside a GdkPixbuf. This allows you to efficiently read
371 	 * individual pixels from cairo surfaces. For GdkWindows, use
372 	 * gdk_pixbuf_get_from_window() instead.
373 	 * This function will create an RGB pixbuf with 8 bits per channel.
374 	 * The pixbuf will contain an alpha channel if the surface contains one.
375 	 * Params:
376 	 * surface = surface to copy from
377 	 * srcX = Source X coordinate within surface
378 	 * srcY = Source Y coordinate within surface
379 	 * width = Width in pixels of region to get
380 	 * height = Height in pixels of region to get
381 	 * Returns: A newly-created pixbuf with a reference count of 1, or NULL on error. [transfer full]
382 	 */
383 	public static Pixbuf getFromSurface(Surface surface, int srcX, int srcY, int width, int height)
384 	{
385 		// GdkPixbuf * gdk_pixbuf_get_from_surface (cairo_surface_t *surface,  gint src_x,  gint src_y,  gint width,  gint height);
386 		auto p = gdk_pixbuf_get_from_surface((surface is null) ? null : surface.getSurfaceStruct(), srcX, srcY, width, height);
387 		
388 		if(p is null)
389 		{
390 			return null;
391 		}
392 		
393 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
394 	}
395 	
396 	/**
397 	 */
398 	public static GType getType()
399 	{
400 		// GType gdk_pixbuf_get_type ();
401 		return gdk_pixbuf_get_type();
402 	}
403 	
404 	/**
405 	 * Creates a new GdkPixbuf structure and allocates a buffer for it. The
406 	 * buffer has an optimal rowstride. Note that the buffer is not cleared;
407 	 * you will have to fill it completely yourself.
408 	 * Params:
409 	 * colorspace = Color space for image
410 	 * hasAlpha = Whether the image should have transparency information
411 	 * bitsPerSample = Number of bits per color sample
412 	 * width = Width of image in pixels, must be > 0
413 	 * height = Height of image in pixels, must be > 0
414 	 * Throws: ConstructionException GTK+ fails to create the object.
415 	 */
416 	public this (GdkColorspace colorspace, int hasAlpha, int bitsPerSample, int width, int height)
417 	{
418 		// GdkPixbuf * gdk_pixbuf_new (GdkColorspace colorspace,  gboolean has_alpha,  int bits_per_sample,  int width,  int height);
419 		auto p = gdk_pixbuf_new(colorspace, hasAlpha, bitsPerSample, width, height);
420 		if(p is null)
421 		{
422 			throw new ConstructionException("null returned by gdk_pixbuf_new(colorspace, hasAlpha, bitsPerSample, width, height)");
423 		}
424 		this(cast(GdkPixbuf*) p);
425 	}
426 	
427 	/**
428 	 * Creates a new GdkPixbuf out of in-memory image data. Currently only RGB
429 	 * images with 8 bits per sample are supported.
430 	 * Params:
431 	 * data = Image data in 8-bit/sample packed format. [array]
432 	 * colorspace = Colorspace for the image data
433 	 * hasAlpha = Whether the data has an opacity channel
434 	 * bitsPerSample = Number of bits per sample
435 	 * width = Width of the image in pixels, must be > 0
436 	 * height = Height of the image in pixels, must be > 0
437 	 * rowstride = Distance in bytes between row starts
438 	 * destroyFn = Function used to free the data when the pixbuf's reference count
439 	 * drops to zero, or NULL if the data should not be freed. [scope async][allow-none]
440 	 * destroyFnData = Closure data to pass to the destroy notification function. [closure]
441 	 * Throws: ConstructionException GTK+ fails to create the object.
442 	 */
443 	public this (char* data, GdkColorspace colorspace, int hasAlpha, int bitsPerSample, int width, int height, int rowstride, GdkPixbufDestroyNotify destroyFn, void* destroyFnData)
444 	{
445 		// GdkPixbuf * gdk_pixbuf_new_from_data (const guchar *data,  GdkColorspace colorspace,  gboolean has_alpha,  int bits_per_sample,  int width,  int height,  int rowstride,  GdkPixbufDestroyNotify destroy_fn,  gpointer destroy_fn_data);
446 		auto p = gdk_pixbuf_new_from_data(data, colorspace, hasAlpha, bitsPerSample, width, height, rowstride, destroyFn, destroyFnData);
447 		if(p is null)
448 		{
449 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_data(data, colorspace, hasAlpha, bitsPerSample, width, height, rowstride, destroyFn, destroyFnData)");
450 		}
451 		this(cast(GdkPixbuf*) p);
452 	}
453 	
454 	/**
455 	 * Creates a new pixbuf by parsing XPM data in memory. This data is commonly
456 	 * the result of including an XPM file into a program's C source.
457 	 * Params:
458 	 * data = Pointer to inline XPM data. [array zero-terminated=1]
459 	 * Throws: ConstructionException GTK+ fails to create the object.
460 	 */
461 	public this (string[] data)
462 	{
463 		// GdkPixbuf * gdk_pixbuf_new_from_xpm_data (const char **data);
464 		auto p = gdk_pixbuf_new_from_xpm_data(Str.toStringzArray(data));
465 		if(p is null)
466 		{
467 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_xpm_data(Str.toStringzArray(data))");
468 		}
469 		this(cast(GdkPixbuf*) p);
470 	}
471 	
472 	/**
473 	 * Create a GdkPixbuf from a flat representation that is suitable for
474 	 * storing as inline data in a program. This is useful if you want to
475 	 * ship a program with images, but don't want to depend on any
476 	 * external files.
477 	 * gdk-pixbuf ships with a program called gdk-pixbuf-csource
478 	 * which allows for conversion of GdkPixbufs into such a inline representation.
479 	 * In almost all cases, you should pass the --raw flag to
480 	 * Params:
481 	 * data = Byte data containing a
482 	 * serialized GdkPixdata structure. [array length=data_length]
483 	 * copyPixels = Whether to copy the pixel data, or use direct pointers
484 	 * data for the resulting pixbuf
485 	 * Throws: GException on failure.
486 	 * Throws: ConstructionException GTK+ fails to create the object.
487 	 */
488 	public this (ubyte[] data, int copyPixels)
489 	{
490 		// GdkPixbuf * gdk_pixbuf_new_from_inline (gint data_length,  const guint8 *data,  gboolean copy_pixels,  GError **error);
491 		GError* err = null;
492 		
493 		auto p = gdk_pixbuf_new_from_inline(cast(int) data.length, data.ptr, copyPixels, &err);
494 		
495 		if (err !is null)
496 		{
497 			throw new GException( new ErrorG(err) );
498 		}
499 		
500 		if(p is null)
501 		{
502 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_inline(cast(int) data.length, data.ptr, copyPixels, &err)");
503 		}
504 		this(cast(GdkPixbuf*) p);
505 	}
506 	
507 	/**
508 	 * Creates a new pixbuf which represents a sub-region of
509 	 * src_pixbuf. The new pixbuf shares its pixels with the
510 	 * original pixbuf, so writing to one affects both.
511 	 * The new pixbuf holds a reference to src_pixbuf, so
512 	 * src_pixbuf will not be finalized until the new pixbuf
513 	 * is finalized.
514 	 * Params:
515 	 * srcPixbuf = a GdkPixbuf
516 	 * srcX = X coord in src_pixbuf
517 	 * srcY = Y coord in src_pixbuf
518 	 * width = width of region in src_pixbuf
519 	 * height = height of region in src_pixbuf
520 	 * Throws: ConstructionException GTK+ fails to create the object.
521 	 */
522 	public this (Pixbuf srcPixbuf, int srcX, int srcY, int width, int height)
523 	{
524 		// GdkPixbuf * gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,  int src_x,  int src_y,  int width,  int height);
525 		auto p = gdk_pixbuf_new_subpixbuf((srcPixbuf is null) ? null : srcPixbuf.getPixbufStruct(), srcX, srcY, width, height);
526 		if(p is null)
527 		{
528 			throw new ConstructionException("null returned by gdk_pixbuf_new_subpixbuf((srcPixbuf is null) ? null : srcPixbuf.getPixbufStruct(), srcX, srcY, width, height)");
529 		}
530 		this(cast(GdkPixbuf*) p);
531 	}
532 	
533 	/**
534 	 * Creates a new GdkPixbuf with a copy of the information in the specified
535 	 * pixbuf.
536 	 * Returns: A newly-created pixbuf with a reference count of 1, or NULL if not enough memory could be allocated. [transfer full]
537 	 */
538 	public Pixbuf copy()
539 	{
540 		// GdkPixbuf * gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
541 		auto p = gdk_pixbuf_copy(gdkPixbuf);
542 		
543 		if(p is null)
544 		{
545 			return null;
546 		}
547 		
548 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
549 	}
550 	
551 	/**
552 	 * Queries the color space of a pixbuf.
553 	 * Returns: Color space.
554 	 */
555 	public GdkColorspace getColorspace()
556 	{
557 		// GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
558 		return gdk_pixbuf_get_colorspace(gdkPixbuf);
559 	}
560 	
561 	/**
562 	 * Queries the number of channels of a pixbuf.
563 	 * Returns: Number of channels.
564 	 */
565 	public int getNChannels()
566 	{
567 		// int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
568 		return gdk_pixbuf_get_n_channels(gdkPixbuf);
569 	}
570 	
571 	/**
572 	 * Queries whether a pixbuf has an alpha channel (opacity information).
573 	 * Returns: TRUE if it has an alpha channel, FALSE otherwise.
574 	 */
575 	public int getHasAlpha()
576 	{
577 		// gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
578 		return gdk_pixbuf_get_has_alpha(gdkPixbuf);
579 	}
580 	
581 	/**
582 	 * Queries the number of bits per color sample in a pixbuf.
583 	 * Returns: Number of bits per color sample.
584 	 */
585 	public int getBitsPerSample()
586 	{
587 		// int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
588 		return gdk_pixbuf_get_bits_per_sample(gdkPixbuf);
589 	}
590 	
591 	/**
592 	 * Queries a pointer to the pixel data of a pixbuf.
593 	 * Returns: A pointer to the pixbuf's pixel data. Please see the section called “Image Data” for information about how the pixel data is stored in memory. [array]
594 	 */
595 	public char* getPixels()
596 	{
597 		// guchar * gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
598 		return gdk_pixbuf_get_pixels(gdkPixbuf);
599 	}
600 	
601 	/**
602 	 * Queries a pointer to the pixel data of a pixbuf.
603 	 * Since 2.26
604 	 * Returns: A pointer to the pixbuf's pixel data. Please see the section called “Image Data” for information about how the pixel data is stored in memory. Rename to: gdk_pixbuf_get_pixels. [array length=length]
605 	 */
606 	public char[] getPixelsWithLength()
607 	{
608 		// guchar * gdk_pixbuf_get_pixels_with_length (const GdkPixbuf *pixbuf,  guint *length);
609 		uint length;
610 		auto p = gdk_pixbuf_get_pixels_with_length(gdkPixbuf, &length);
611 		
612 		if(p is null)
613 		{
614 			return null;
615 		}
616 		
617 		return p[0 .. length];
618 	}
619 	
620 	/**
621 	 * Queries the width of a pixbuf.
622 	 * Returns: Width in pixels.
623 	 */
624 	public int getWidth()
625 	{
626 		// int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
627 		return gdk_pixbuf_get_width(gdkPixbuf);
628 	}
629 	
630 	/**
631 	 * Queries the height of a pixbuf.
632 	 * Returns: Height in pixels.
633 	 */
634 	public int getHeight()
635 	{
636 		// int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
637 		return gdk_pixbuf_get_height(gdkPixbuf);
638 	}
639 	
640 	/**
641 	 * Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
642 	 * and the start of the next row.
643 	 * Returns: Distance between row starts.
644 	 */
645 	public int getRowstride()
646 	{
647 		// int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
648 		return gdk_pixbuf_get_rowstride(gdkPixbuf);
649 	}
650 	
651 	/**
652 	 * Returns the length of the pixel data, in bytes.
653 	 * Since 2.26
654 	 * Returns: The length of the pixel data.
655 	 */
656 	public gsize getByteLength()
657 	{
658 		// gsize gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf);
659 		return gdk_pixbuf_get_byte_length(gdkPixbuf);
660 	}
661 	
662 	/**
663 	 * Looks up key in the list of options that may have been attached to the
664 	 * pixbuf when it was loaded, or that may have been attached by another
665 	 * function using gdk_pixbuf_set_option().
666 	 * For instance, the ANI loader provides "Title" and "Artist" options.
667 	 * The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
668 	 * options for cursor definitions. The PNG loader provides the tEXt ancillary
669 	 * chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
670 	 * return an "orientation" option string that corresponds to the embedded
671 	 * TIFF/Exif orientation tag (if present).
672 	 * Params:
673 	 * key = a nul-terminated string.
674 	 * Returns: the value associated with key. This is a nul-terminated string that should not be freed or NULL if key was not found.
675 	 */
676 	public string getOption(string key)
677 	{
678 		// const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,  const gchar *key);
679 		return Str.toString(gdk_pixbuf_get_option(gdkPixbuf, Str.toStringz(key)));
680 	}
681 	
682 	/**
683 	 * Creates a new pixbuf by loading an image from a file. The file format is
684 	 * detected automatically. If NULL is returned, then error will be set.
685 	 * Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
686 	 * Params:
687 	 * filename = Name of file to load, in the GLib file name encoding
688 	 * Throws: GException on failure.
689 	 * Throws: ConstructionException GTK+ fails to create the object.
690 	 */
691 	public this (string filename)
692 	{
693 		// GdkPixbuf * gdk_pixbuf_new_from_file (const char *filename,  GError **error);
694 		GError* err = null;
695 		
696 		auto p = gdk_pixbuf_new_from_file(Str.toStringz(filename), &err);
697 		
698 		if (err !is null)
699 		{
700 			throw new GException( new ErrorG(err) );
701 		}
702 		
703 		if(p is null)
704 		{
705 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_file(Str.toStringz(filename), &err)");
706 		}
707 		this(cast(GdkPixbuf*) p);
708 	}
709 	
710 	/**
711 	 * Creates a new pixbuf by loading an image from a file.
712 	 * The file format is detected automatically. If NULL is returned, then
713 	 * error will be set. Possible errors are in the GDK_PIXBUF_ERROR and
714 	 * G_FILE_ERROR domains.
715 	 * The image will be scaled to fit in the requested size, preserving
716 	 * the image's aspect ratio. Note that the returned pixbuf may be smaller
717 	 * than width x height, if the aspect ratio requires it. To load
718 	 * and image at the requested size, regardless of aspect ratio, use
719 	 * gdk_pixbuf_new_from_file_at_scale().
720 	 * Since 2.4
721 	 * Params:
722 	 * filename = Name of file to load, in the GLib file name encoding
723 	 * width = The width the image should have or -1 to not constrain the width
724 	 * height = The height the image should have or -1 to not constrain the height
725 	 * Throws: GException on failure.
726 	 * Throws: ConstructionException GTK+ fails to create the object.
727 	 */
728 	public this (string filename, int width, int height)
729 	{
730 		// GdkPixbuf * gdk_pixbuf_new_from_file_at_size (const char *filename,  int width,  int height,  GError **error);
731 		GError* err = null;
732 		
733 		auto p = gdk_pixbuf_new_from_file_at_size(Str.toStringz(filename), width, height, &err);
734 		
735 		if (err !is null)
736 		{
737 			throw new GException( new ErrorG(err) );
738 		}
739 		
740 		if(p is null)
741 		{
742 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_file_at_size(Str.toStringz(filename), width, height, &err)");
743 		}
744 		this(cast(GdkPixbuf*) p);
745 	}
746 	
747 	/**
748 	 * Creates a new pixbuf by loading an image from a file. The file format is
749 	 * detected automatically. If NULL is returned, then error will be set.
750 	 * Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
751 	 * The image will be scaled to fit in the requested size, optionally preserving
752 	 * the image's aspect ratio.
753 	 * When preserving the aspect ratio, a width of -1 will cause the image
754 	 * to be scaled to the exact given height, and a height of -1 will cause
755 	 * the image to be scaled to the exact given width. When not preserving
756 	 * aspect ratio, a width or height of -1 means to not scale the image
757 	 * at all in that dimension. Negative values for width and height are
758 	 * allowed since 2.8.
759 	 * Since 2.6
760 	 * Params:
761 	 * filename = Name of file to load, in the GLib file name encoding
762 	 * width = The width the image should have or -1 to not constrain the width
763 	 * height = The height the image should have or -1 to not constrain the height
764 	 * preserveAspectRatio = TRUE to preserve the image's aspect ratio
765 	 * Throws: GException on failure.
766 	 * Throws: ConstructionException GTK+ fails to create the object.
767 	 */
768 	public this (string filename, int width, int height, int preserveAspectRatio)
769 	{
770 		// GdkPixbuf * gdk_pixbuf_new_from_file_at_scale (const char *filename,  int width,  int height,  gboolean preserve_aspect_ratio,  GError **error);
771 		GError* err = null;
772 		
773 		auto p = gdk_pixbuf_new_from_file_at_scale(Str.toStringz(filename), width, height, preserveAspectRatio, &err);
774 		
775 		if (err !is null)
776 		{
777 			throw new GException( new ErrorG(err) );
778 		}
779 		
780 		if(p is null)
781 		{
782 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_file_at_scale(Str.toStringz(filename), width, height, preserveAspectRatio, &err)");
783 		}
784 		this(cast(GdkPixbuf*) p);
785 	}
786 	
787 	/**
788 	 * Parses an image file far enough to determine its format and size.
789 	 * Since 2.4
790 	 * Params:
791 	 * filename = The name of the file to identify.
792 	 * width = Return location for the width of the image, or NULL. [out]
793 	 * height = Return location for the height of the image, or NULL. [out]
794 	 * Returns: A GdkPixbufFormat describing the image format of the file or NULL if the image format wasn't recognized. The return value is owned by GdkPixbuf and should not be freed. [transfer none]
795 	 */
796 	public static PixbufFormat getFileInfo(string filename, out int width, out int height)
797 	{
798 		// GdkPixbufFormat * gdk_pixbuf_get_file_info (const gchar *filename,  gint *width,  gint *height);
799 		auto p = gdk_pixbuf_get_file_info(Str.toStringz(filename), &width, &height);
800 		
801 		if(p is null)
802 		{
803 			return null;
804 		}
805 		
806 		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p);
807 	}
808 	
809 	/**
810 	 * Creates a new pixbuf by loading an image from an input stream.
811 	 * The file format is detected automatically. If NULL is returned, then
812 	 * error will be set. The cancellable can be used to abort the operation
813 	 * from another thread. If the operation was cancelled, the error
814 	 * G_IO_ERROR_CANCELLED will be returned. Other possible errors are in
815 	 * the GDK_PIXBUF_ERROR and G_IO_ERROR domains.
816 	 * The stream is not closed.
817 	 * Since 2.14
818 	 * Params:
819 	 * stream = a GInputStream to load the pixbuf from
820 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
821 	 * Throws: GException on failure.
822 	 * Throws: ConstructionException GTK+ fails to create the object.
823 	 */
824 	public this (InputStream stream, Cancellable cancellable)
825 	{
826 		// GdkPixbuf * gdk_pixbuf_new_from_stream (GInputStream *stream,  GCancellable *cancellable,  GError **error);
827 		GError* err = null;
828 		
829 		auto p = gdk_pixbuf_new_from_stream((stream is null) ? null : stream.getInputStreamStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
830 		
831 		if (err !is null)
832 		{
833 			throw new GException( new ErrorG(err) );
834 		}
835 		
836 		if(p is null)
837 		{
838 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_stream((stream is null) ? null : stream.getInputStreamStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err)");
839 		}
840 		this(cast(GdkPixbuf*) p);
841 	}
842 	
843 	/**
844 	 * Creates a new pixbuf by asynchronously loading an image from an input stream.
845 	 * For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
846 	 * version of this function.
847 	 * When the operation is finished, callback will be called in the main thread.
848 	 * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
849 	 * Since 2.24
850 	 * Params:
851 	 * stream = a GInputStream from which to load the pixbuf
852 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
853 	 * callback = a GAsyncReadyCallback to call when the the pixbuf is loaded
854 	 * userData = the data to pass to the callback function
855 	 */
856 	public static void newFromStreamAsync(InputStream stream, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
857 	{
858 		// void gdk_pixbuf_new_from_stream_async (GInputStream *stream,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
859 		gdk_pixbuf_new_from_stream_async((stream is null) ? null : stream.getInputStreamStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
860 	}
861 	
862 	/**
863 	 * Finishes an asynchronous pixbuf creation operation started with
864 	 * gdk_pixbuf_new_from_stream_async().
865 	 * Since 2.24
866 	 * Params:
867 	 * asyncResult = a GAsyncResult
868 	 * Throws: GException on failure.
869 	 * Throws: ConstructionException GTK+ fails to create the object.
870 	 */
871 	public this (AsyncResultIF asyncResult)
872 	{
873 		// GdkPixbuf * gdk_pixbuf_new_from_stream_finish (GAsyncResult *async_result,  GError **error);
874 		GError* err = null;
875 		
876 		auto p = gdk_pixbuf_new_from_stream_finish((asyncResult is null) ? null : asyncResult.getAsyncResultTStruct(), &err);
877 		
878 		if (err !is null)
879 		{
880 			throw new GException( new ErrorG(err) );
881 		}
882 		
883 		if(p is null)
884 		{
885 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_stream_finish((asyncResult is null) ? null : asyncResult.getAsyncResultTStruct(), &err)");
886 		}
887 		this(cast(GdkPixbuf*) p);
888 	}
889 	
890 	/**
891 	 * Creates a new pixbuf by loading an image from an input stream.
892 	 * The file format is detected automatically. If NULL is returned, then
893 	 * error will be set. The cancellable can be used to abort the operation
894 	 * from another thread. If the operation was cancelled, the error
895 	 * G_IO_ERROR_CANCELLED will be returned. Other possible errors are in
896 	 * the GDK_PIXBUF_ERROR and G_IO_ERROR domains.
897 	 * The image will be scaled to fit in the requested size, optionally
898 	 * preserving the image's aspect ratio. When preserving the aspect ratio,
899 	 * a width of -1 will cause the image to be scaled to the exact given
900 	 * height, and a height of -1 will cause the image to be scaled to the
901 	 * exact given width. When not preserving aspect ratio, a width or
902 	 * height of -1 means to not scale the image at all in that dimension.
903 	 * The stream is not closed.
904 	 * Since 2.14
905 	 * Params:
906 	 * stream = a GInputStream to load the pixbuf from
907 	 * width = The width the image should have or -1 to not constrain the width
908 	 * height = The height the image should have or -1 to not constrain the height
909 	 * preserveAspectRatio = TRUE to preserve the image's aspect ratio
910 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
911 	 * Throws: GException on failure.
912 	 * Throws: ConstructionException GTK+ fails to create the object.
913 	 */
914 	public this (InputStream stream, int width, int height, int preserveAspectRatio, Cancellable cancellable)
915 	{
916 		// GdkPixbuf * gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,  gint width,  gint height,  gboolean preserve_aspect_ratio,  GCancellable *cancellable,  GError **error);
917 		GError* err = null;
918 		
919 		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);
920 		
921 		if (err !is null)
922 		{
923 			throw new GException( new ErrorG(err) );
924 		}
925 		
926 		if(p is null)
927 		{
928 			throw new ConstructionException("null returned by gdk_pixbuf_new_from_stream_at_scale((stream is null) ? null : stream.getInputStreamStruct(), width, height, preserveAspectRatio, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err)");
929 		}
930 		this(cast(GdkPixbuf*) p);
931 	}
932 	
933 	/**
934 	 * Creates a new pixbuf by asynchronously loading an image from an input stream.
935 	 * For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the synchronous
936 	 * version of this function.
937 	 * When the operation is finished, callback will be called in the main thread.
938 	 * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
939 	 * Since 2.24
940 	 * Params:
941 	 * stream = a GInputStream from which to load the pixbuf
942 	 * width = the width the image should have or -1 to not constrain the width
943 	 * height = the height the image should have or -1 to not constrain the height
944 	 * preserveAspectRatio = TRUE to preserve the image's aspect ratio
945 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
946 	 * callback = a GAsyncReadyCallback to call when the the pixbuf is loaded
947 	 * userData = the data to pass to the callback function
948 	 */
949 	public static void newFromStreamAtScaleAsync(InputStream stream, int width, int height, int preserveAspectRatio, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
950 	{
951 		// void gdk_pixbuf_new_from_stream_at_scale_async  (GInputStream *stream,  gint width,  gint height,  gboolean preserve_aspect_ratio,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
952 		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);
953 	}
954 	
955 	/**
956 	 * Saves pixbuf to a file in type, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
957 	 * If error is set, FALSE will be returned.
958 	 * See gdk_pixbuf_save() for more details.
959 	 * Params:
960 	 * filename = name of file to save.
961 	 * type = name of file format.
962 	 * optionKeys = name of options to set, NULL-terminated. [array zero-terminated=1]
963 	 * optionValues = values for named options. [array zero-terminated=1]
964 	 * Returns: whether an error was set
965 	 * Throws: GException on failure.
966 	 */
967 	public int savev(string filename, string type, string[] optionKeys, string[] optionValues)
968 	{
969 		// gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf,  const char *filename,  const char *type,  char **option_keys,  char **option_values,  GError **error);
970 		GError* err = null;
971 		
972 		auto p = gdk_pixbuf_savev(gdkPixbuf, Str.toStringz(filename), Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err);
973 		
974 		if (err !is null)
975 		{
976 			throw new GException( new ErrorG(err) );
977 		}
978 		
979 		return p;
980 	}
981 	
982 	/**
983 	 * Saves pixbuf to a callback in format type, which is currently "jpeg",
984 	 * "png", "tiff", "ico" or "bmp". If error is set, FALSE will be returned. See
985 	 * gdk_pixbuf_save_to_callback() for more details.
986 	 * Since 2.4
987 	 * Params:
988 	 * saveFunc = a function that is called to save each block of data that
989 	 * the save routine generates. [scope call]
990 	 * userData = user data to pass to the save function. [closure]
991 	 * type = name of file format.
992 	 * optionKeys = name of options to set, NULL-terminated. [array zero-terminated=1][element-type utf8]
993 	 * optionValues = values for named options. [array zero-terminated=1][element-type utf8]
994 	 * Returns: whether an error was set
995 	 * Throws: GException on failure.
996 	 */
997 	public int saveToCallbackv(GdkPixbufSaveFunc saveFunc, void* userData, string type, string[] optionKeys, string[] optionValues)
998 	{
999 		// gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,  GdkPixbufSaveFunc save_func,  gpointer user_data,  const char *type,  char **option_keys,  char **option_values,  GError **error);
1000 		GError* err = null;
1001 		
1002 		auto p = gdk_pixbuf_save_to_callbackv(gdkPixbuf, saveFunc, userData, Str.toStringz(type), Str.toStringzArray(optionKeys), Str.toStringzArray(optionValues), &err);
1003 		
1004 		if (err !is null)
1005 		{
1006 			throw new GException( new ErrorG(err) );
1007 		}
1008 		
1009 		return p;
1010 	}
1011 	
1012 	/**
1013 	 * Finishes an asynchronous pixbuf save operation started with
1014 	 * gdk_pixbuf_save_to_stream_async().
1015 	 * Since 2.24
1016 	 * Params:
1017 	 * asyncResult = a GAsyncResult
1018 	 * Returns: TRUE if the pixbuf was saved successfully, FALSE if an error was set.
1019 	 * Throws: GException on failure.
1020 	 */
1021 	public static int saveToStreamFinish(AsyncResultIF asyncResult)
1022 	{
1023 		// gboolean gdk_pixbuf_save_to_stream_finish (GAsyncResult *async_result,  GError **error);
1024 		GError* err = null;
1025 		
1026 		auto p = gdk_pixbuf_save_to_stream_finish((asyncResult is null) ? null : asyncResult.getAsyncResultTStruct(), &err);
1027 		
1028 		if (err !is null)
1029 		{
1030 			throw new GException( new ErrorG(err) );
1031 		}
1032 		
1033 		return p;
1034 	}
1035 	
1036 	/**
1037 	 * Create a new GdkPixbuf containing a copy of src scaled to
1038 	 * dest_width x dest_height. Leaves src unaffected. interp_type
1039 	 * should be GDK_INTERP_NEAREST if you want maximum speed (but when
1040 	 * scaling down GDK_INTERP_NEAREST is usually unusably ugly). The
1041 	 * default interp_type should be GDK_INTERP_BILINEAR which offers
1042 	 * reasonable quality and speed.
1043 	 * You can scale a sub-portion of src by creating a sub-pixbuf
1044 	 * pointing into src; see gdk_pixbuf_new_subpixbuf().
1045 	 * For more complicated scaling/compositing see gdk_pixbuf_scale()
1046 	 * and gdk_pixbuf_composite().
1047 	 * Params:
1048 	 * destWidth = the width of destination image
1049 	 * destHeight = the height of destination image
1050 	 * interpType = the interpolation type for the transformation.
1051 	 * Returns: the new GdkPixbuf, or NULL if not enough memory could be allocated for it. [transfer full]
1052 	 */
1053 	public Pixbuf scaleSimple(int destWidth, int destHeight, GdkInterpType interpType)
1054 	{
1055 		// GdkPixbuf * gdk_pixbuf_scale_simple (const GdkPixbuf *src,  int dest_width,  int dest_height,  GdkInterpType interp_type);
1056 		auto p = gdk_pixbuf_scale_simple(gdkPixbuf, destWidth, destHeight, interpType);
1057 		
1058 		if(p is null)
1059 		{
1060 			return null;
1061 		}
1062 		
1063 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1064 	}
1065 	
1066 	/**
1067 	 * Creates a transformation of the source image src by scaling by
1068 	 * scale_x and scale_y then translating by offset_x and offset_y,
1069 	 * then renders the rectangle (dest_x, dest_y, dest_width,
1070 	 * dest_height) of the resulting image onto the destination image
1071 	 * replacing the previous contents.
1072 	 * Try to use gdk_pixbuf_scale_simple() first, this function is
1073 	 * the industrial-strength power tool you can fall back to if
1074 	 * gdk_pixbuf_scale_simple() isn't powerful enough.
1075 	 * If the source rectangle overlaps the destination rectangle on the
1076 	 * same pixbuf, it will be overwritten during the scaling which
1077 	 * results in rendering artifacts.
1078 	 * Params:
1079 	 * dest = the GdkPixbuf into which to render the results
1080 	 * destX = the left coordinate for region to render
1081 	 * destY = the top coordinate for region to render
1082 	 * destWidth = the width of the region to render
1083 	 * destHeight = the height of the region to render
1084 	 * offsetX = the offset in the X direction (currently rounded to an integer)
1085 	 * offsetY = the offset in the Y direction (currently rounded to an integer)
1086 	 * scaleX = the scale factor in the X direction
1087 	 * scaleY = the scale factor in the Y direction
1088 	 * interpType = the interpolation type for the transformation.
1089 	 */
1090 	public void scale(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType)
1091 	{
1092 		// void gdk_pixbuf_scale (const GdkPixbuf *src,  GdkPixbuf *dest,  int dest_x,  int dest_y,  int dest_width,  int dest_height,  double offset_x,  double offset_y,  double scale_x,  double scale_y,  GdkInterpType interp_type);
1093 		gdk_pixbuf_scale(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), destX, destY, destWidth, destHeight, offsetX, offsetY, scaleX, scaleY, interpType);
1094 	}
1095 	
1096 	/**
1097 	 * Creates a new GdkPixbuf by scaling src to dest_width x
1098 	 * dest_height and compositing the result with a checkboard of colors
1099 	 * color1 and color2.
1100 	 * Params:
1101 	 * destWidth = the width of destination image
1102 	 * destHeight = the height of destination image
1103 	 * interpType = the interpolation type for the transformation.
1104 	 * overallAlpha = overall alpha for source image (0..255)
1105 	 * checkSize = the size of checks in the checkboard (must be a power of two)
1106 	 * color1 = the color of check at upper left
1107 	 * color2 = the color of the other check
1108 	 * Returns: the new GdkPixbuf, or NULL if not enough memory could be allocated for it. [transfer full]
1109 	 */
1110 	public Pixbuf compositeColorSimple(int destWidth, int destHeight, GdkInterpType interpType, int overallAlpha, int checkSize, uint color1, uint color2)
1111 	{
1112 		// GdkPixbuf * gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,  int dest_width,  int dest_height,  GdkInterpType interp_type,  int overall_alpha,  int check_size,  guint32 color1,  guint32 color2);
1113 		auto p = gdk_pixbuf_composite_color_simple(gdkPixbuf, destWidth, destHeight, interpType, overallAlpha, checkSize, color1, color2);
1114 		
1115 		if(p is null)
1116 		{
1117 			return null;
1118 		}
1119 		
1120 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1121 	}
1122 	
1123 	/**
1124 	 * Creates a transformation of the source image src by scaling by
1125 	 * scale_x and scale_y then translating by offset_x and offset_y.
1126 	 * This gives an image in the coordinates of the destination pixbuf.
1127 	 * The rectangle (dest_x, dest_y, dest_width, dest_height)
1128 	 * is then composited onto the corresponding rectangle of the
1129 	 * original destination image.
1130 	 * When the destination rectangle contains parts not in the source
1131 	 * image, the data at the edges of the source image is replicated
1132 	 * to infinity.
1133 	 * Figure 1. Compositing of pixbufs
1134 	 * Params:
1135 	 * dest = the GdkPixbuf into which to render the results
1136 	 * destX = the left coordinate for region to render
1137 	 * destY = the top coordinate for region to render
1138 	 * destWidth = the width of the region to render
1139 	 * destHeight = the height of the region to render
1140 	 * offsetX = the offset in the X direction (currently rounded to an integer)
1141 	 * offsetY = the offset in the Y direction (currently rounded to an integer)
1142 	 * scaleX = the scale factor in the X direction
1143 	 * scaleY = the scale factor in the Y direction
1144 	 * interpType = the interpolation type for the transformation.
1145 	 * overallAlpha = overall alpha for source image (0..255)
1146 	 */
1147 	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)
1148 	{
1149 		// void gdk_pixbuf_composite (const GdkPixbuf *src,  GdkPixbuf *dest,  int dest_x,  int dest_y,  int dest_width,  int dest_height,  double offset_x,  double offset_y,  double scale_x,  double scale_y,  GdkInterpType interp_type,  int overall_alpha);
1150 		gdk_pixbuf_composite(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), destX, destY, destWidth, destHeight, offsetX, offsetY, scaleX, scaleY, interpType, overallAlpha);
1151 	}
1152 	
1153 	/**
1154 	 * Creates a transformation of the source image src by scaling by
1155 	 * scale_x and scale_y then translating by offset_x and offset_y,
1156 	 * then composites the rectangle (dest_x ,dest_y, dest_width,
1157 	 * dest_height) of the resulting image with a checkboard of the
1158 	 * colors color1 and color2 and renders it onto the destination
1159 	 * image.
1160 	 * See gdk_pixbuf_composite_color_simple() for a simpler variant of this
1161 	 * function suitable for many tasks.
1162 	 * Params:
1163 	 * dest = the GdkPixbuf into which to render the results
1164 	 * destX = the left coordinate for region to render
1165 	 * destY = the top coordinate for region to render
1166 	 * destWidth = the width of the region to render
1167 	 * destHeight = the height of the region to render
1168 	 * offsetX = the offset in the X direction (currently rounded to an integer)
1169 	 * offsetY = the offset in the Y direction (currently rounded to an integer)
1170 	 * scaleX = the scale factor in the X direction
1171 	 * scaleY = the scale factor in the Y direction
1172 	 * interpType = the interpolation type for the transformation.
1173 	 * overallAlpha = overall alpha for source image (0..255)
1174 	 * checkX = the X offset for the checkboard (origin of checkboard is at -check_x, -check_y)
1175 	 * checkY = the Y offset for the checkboard
1176 	 * checkSize = the size of checks in the checkboard (must be a power of two)
1177 	 * color1 = the color of check at upper left
1178 	 * color2 = the color of the other check
1179 	 */
1180 	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)
1181 	{
1182 		// void gdk_pixbuf_composite_color (const GdkPixbuf *src,  GdkPixbuf *dest,  int dest_x,  int dest_y,  int dest_width,  int dest_height,  double offset_x,  double offset_y,  double scale_x,  double scale_y,  GdkInterpType interp_type,  int overall_alpha,  int check_x,  int check_y,  int check_size,  guint32 color1,  guint32 color2);
1183 		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);
1184 	}
1185 	
1186 	/**
1187 	 * Rotates a pixbuf by a multiple of 90 degrees, and returns the
1188 	 * result in a new pixbuf.
1189 	 * Since 2.6
1190 	 * Params:
1191 	 * angle = the angle to rotate by
1192 	 * Returns: the new GdkPixbuf, or NULL if not enough memory could be allocated for it. [transfer full]
1193 	 */
1194 	public Pixbuf rotateSimple(GdkPixbufRotation angle)
1195 	{
1196 		// GdkPixbuf * gdk_pixbuf_rotate_simple (const GdkPixbuf *src,  GdkPixbufRotation angle);
1197 		auto p = gdk_pixbuf_rotate_simple(gdkPixbuf, angle);
1198 		
1199 		if(p is null)
1200 		{
1201 			return null;
1202 		}
1203 		
1204 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1205 	}
1206 	
1207 	/**
1208 	 * Flips a pixbuf horizontally or vertically and returns the
1209 	 * result in a new pixbuf.
1210 	 * Since 2.6
1211 	 * Params:
1212 	 * horizontal = TRUE to flip horizontally, FALSE to flip vertically
1213 	 * Returns: the new GdkPixbuf, or NULL if not enough memory could be allocated for it. [transfer full]
1214 	 */
1215 	public Pixbuf flip(int horizontal)
1216 	{
1217 		// GdkPixbuf * gdk_pixbuf_flip (const GdkPixbuf *src,  gboolean horizontal);
1218 		auto p = gdk_pixbuf_flip(gdkPixbuf, horizontal);
1219 		
1220 		if(p is null)
1221 		{
1222 			return null;
1223 		}
1224 		
1225 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1226 	}
1227 	
1228 	/**
1229 	 * Takes an existing pixbuf and adds an alpha channel to it.
1230 	 * If the existing pixbuf already had an alpha channel, the channel
1231 	 * values are copied from the original; otherwise, the alpha channel
1232 	 * is initialized to 255 (full opacity).
1233 	 * If substitute_color is TRUE, then the color specified by (r, g, b) will be
1234 	 * assigned zero opacity. That is, if you pass (255, 255, 255) for the
1235 	 * substitute color, all white pixels will become fully transparent.
1236 	 * Params:
1237 	 * substituteColor = Whether to set a color to zero opacity. If this
1238 	 * is FALSE, then the (r, g, b) arguments will be ignored.
1239 	 * r = Red value to substitute.
1240 	 * g = Green value to substitute.
1241 	 * b = Blue value to substitute.
1242 	 * Returns: A newly-created pixbuf with a reference count of 1. [transfer full]
1243 	 */
1244 	public Pixbuf addAlpha(int substituteColor, char r, char g, char b)
1245 	{
1246 		// GdkPixbuf * gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,  gboolean substitute_color,  guchar r,  guchar g,  guchar b);
1247 		auto p = gdk_pixbuf_add_alpha(gdkPixbuf, substituteColor, r, g, b);
1248 		
1249 		if(p is null)
1250 		{
1251 			return null;
1252 		}
1253 		
1254 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1255 	}
1256 	
1257 	/**
1258 	 * Copies a rectangular area from src_pixbuf to dest_pixbuf. Conversion of
1259 	 * pixbuf formats is done automatically.
1260 	 * If the source rectangle overlaps the destination rectangle on the
1261 	 * same pixbuf, it will be overwritten during the copy operation.
1262 	 * Therefore, you can not use this function to scroll a pixbuf.
1263 	 * Params:
1264 	 * srcX = Source X coordinate within src_pixbuf.
1265 	 * srcY = Source Y coordinate within src_pixbuf.
1266 	 * width = Width of the area to copy.
1267 	 * height = Height of the area to copy.
1268 	 * destPixbuf = Destination pixbuf.
1269 	 * destX = X coordinate within dest_pixbuf.
1270 	 * destY = Y coordinate within dest_pixbuf.
1271 	 */
1272 	public void copyArea(int srcX, int srcY, int width, int height, Pixbuf destPixbuf, int destX, int destY)
1273 	{
1274 		// void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,  int src_x,  int src_y,  int width,  int height,  GdkPixbuf *dest_pixbuf,  int dest_x,  int dest_y);
1275 		gdk_pixbuf_copy_area(gdkPixbuf, srcX, srcY, width, height, (destPixbuf is null) ? null : destPixbuf.getPixbufStruct(), destX, destY);
1276 	}
1277 	
1278 	/**
1279 	 * Modifies saturation and optionally pixelates src, placing the result in
1280 	 * dest. src and dest may be the same pixbuf with no ill effects. If
1281 	 * saturation is 1.0 then saturation is not changed. If it's less than 1.0,
1282 	 * saturation is reduced (the image turns toward grayscale); if greater than
1283 	 * 1.0, saturation is increased (the image gets more vivid colors). If pixelate
1284 	 * is TRUE, then pixels are faded in a checkerboard pattern to create a
1285 	 * pixelated image. src and dest must have the same image format, size, and
1286 	 * rowstride.
1287 	 * Params:
1288 	 * dest = place to write modified version of src
1289 	 * saturation = saturation factor
1290 	 * pixelate = whether to pixelate
1291 	 */
1292 	public void saturateAndPixelate(Pixbuf dest, float saturation, int pixelate)
1293 	{
1294 		// void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src,  GdkPixbuf *dest,  gfloat saturation,  gboolean pixelate);
1295 		gdk_pixbuf_saturate_and_pixelate(gdkPixbuf, (dest is null) ? null : dest.getPixbufStruct(), saturation, pixelate);
1296 	}
1297 	
1298 	/**
1299 	 * Takes an existing pixbuf and checks for the presence of an
1300 	 * associated "orientation" option, which may be provided by the
1301 	 * jpeg loader (which reads the exif orientation tag) or the
1302 	 * tiff loader (which reads the tiff orientation tag, and
1303 	 * compensates it for the partial transforms performed by
1304 	 * libtiff). If an orientation option/tag is present, the
1305 	 * appropriate transform will be performed so that the pixbuf
1306 	 * is oriented correctly.
1307 	 * Since 2.12
1308 	 * Returns: A newly-created pixbuf, or a reference to the input pixbuf (with an increased reference count). [transfer full]
1309 	 */
1310 	public Pixbuf applyEmbeddedOrientation()
1311 	{
1312 		// GdkPixbuf * gdk_pixbuf_apply_embedded_orientation  (GdkPixbuf *src);
1313 		auto p = gdk_pixbuf_apply_embedded_orientation(gdkPixbuf);
1314 		
1315 		if(p is null)
1316 		{
1317 			return null;
1318 		}
1319 		
1320 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1321 	}
1322 	
1323 	/**
1324 	 * Clears a pixbuf to the given RGBA value, converting the RGBA value into
1325 	 * the pixbuf's pixel format. The alpha will be ignored if the pixbuf
1326 	 * doesn't have an alpha channel.
1327 	 * Params:
1328 	 * pixel = RGBA pixel to clear to
1329 	 * (0xffffffff is opaque white, 0x00000000 transparent black)
1330 	 */
1331 	public void fill(uint pixel)
1332 	{
1333 		// void gdk_pixbuf_fill (GdkPixbuf *pixbuf,  guint32 pixel);
1334 		gdk_pixbuf_fill(gdkPixbuf, pixel);
1335 	}
1336 }