2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-Pixbufs.html
46 * - gdk_pixbuf_get_from_drawable
50 * - gdkpixbuf.PixbufFormat
56 * - GdkBitmap* -> Bitmap
57 * - GdkColormap* -> Colormap
58 * - GdkDrawable* -> Drawable
59 * - GdkImage* -> ImageGdk
60 * - GdkPixbuf* -> Pixbuf
61 * - GdkPixbufFormat* -> PixbufFormat
72 import tango
.io
.Stdout
; // use the tango loging?
76 private import gtkc
.gdktypes
;
78 private import gtkc
.gdk
;
81 private import glib
.Str
;
82 private import glib
.Str
;
83 private import gdkpixbuf
.PixbufFormat
;
84 private import gdk
.Drawable
;
85 private import gdk
.Bitmap
;
86 private import gdk
.Colormap
;
87 private import gdk
.ImageGdk
;
94 * These functions allow to render pixbufs on drawables. Pixbufs are
95 * client-side images. For details on how to create and manipulate
96 * pixbufs, see the GdkPixbuf API documentation.
101 /** the main Gtk struct */
102 protected GdkPixbuf
* gdkPixbuf
;
105 public GdkPixbuf
* getPixbufStruct()
111 /** the main Gtk struct as a void* */
112 protected void* getStruct()
114 return cast(void*)gdkPixbuf
;
118 * Sets our main struct and passes it to the parent class
120 public this (GdkPixbuf
* gdkPixbuf
)
124 if ( gdkPixbuf
is null )
129 Stdout("struct gdkPixbuf is null on constructor").newline
;
133 printf("struct gdkPixbuf is null on constructor");
140 assert(gdkPixbuf
!is null, "struct gdkPixbuf is null on constructor");
142 this.gdkPixbuf
= gdkPixbuf
;
146 * Transfers image data from a GdkDrawable and converts it to an RGB(A)
147 * representation inside a GdkPixbuf. In other words, copies
148 * image data from a server-side drawable to a client-side RGB(A) buffer.
149 * This allows you to efficiently read individual pixels on the client side.
150 * If the drawable src has no colormap (gdk_drawable_get_colormap()
151 * returns NULL), then a suitable colormap must be specified.
152 * Typically a GdkWindow or a pixmap created by passing a GdkWindow
153 * to gdk_pixmap_new() will already have a colormap associated with
154 * it. If the drawable has a colormap, the cmap argument will be
155 * ignored. If the drawable is a bitmap (1 bit per pixel pixmap),
156 * then a colormap is not required; pixels with a value of 1 are
157 * assumed to be white, and pixels with a value of 0 are assumed to be
158 * black. For taking screenshots, gdk_colormap_get_system() returns
159 * the correct colormap to use.
160 * If the specified destination pixbuf dest is NULL, then this
161 * function will create an RGB pixbuf with 8 bits per channel and no
162 * alpha, with the same size specified by the width and height
163 * arguments. In this case, the dest_x and dest_y arguments must be
164 * specified as 0. If the specified destination pixbuf is not NULL
165 * and it contains alpha information, then the filled pixels will be
166 * set to full opacity (alpha = 255).
167 * If the specified drawable is a pixmap, then the requested source
168 * rectangle must be completely contained within the pixmap, otherwise
169 * the function will return NULL. For pixmaps only (not for windows)
170 * passing -1 for width or height is allowed to mean the full width
171 * or height of the pixmap.
172 * If the specified drawable is a window, and the window is off the
173 * screen, then there is no image data in the obscured/offscreen
174 * regions to be placed in the pixbuf. The contents of portions of the
175 * pixbuf corresponding to the offscreen region are undefined.
176 * If the window you're obtaining data from is partially obscured by
177 * other windows, then the contents of the pixbuf areas corresponding
178 * to the obscured regions are undefined.
179 * If the target drawable is not mapped (typically because it's
180 * iconified/minimized or not on the current workspace), then NULL
182 * If memory can't be allocated for the return value, NULL will be returned
184 * (In short, there are several ways this function can fail, and if it fails
185 * it returns NULL; so check the return value.)
186 * This function calls gdk_drawable_get_image() internally and
187 * converts the resulting image to a GdkPixbuf, so the
188 * documentation for gdk_drawable_get_image() may also be relevant.
190 * Destination pixbuf, or NULL if a new pixbuf should be created.
194 * A colormap if src doesn't have one set.
196 * Source X coordinate within drawable.
198 * Source Y coordinate within drawable.
200 * Destination X coordinate in pixbuf, or 0 if dest is NULL.
202 * Destination Y coordinate in pixbuf, or 0 if dest is NULL.
204 * Width in pixels of region to get.
206 * Height in pixels of region to get.
208 * The same pixbuf as dest if it was non-NULL, or a newly-created
209 * pixbuf with a reference count of 1 if no destination pixbuf was specified, or NULL on error
211 public Pixbuf
getFromDrawable(Drawable src
, Colormap cmap
, int srcX
, int srcY
, int destX
, int destY
, int width
, int height
)
213 // GdkPixbuf* gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, GdkDrawable *src, GdkColormap *cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);
214 return new Pixbuf( gdk_pixbuf_get_from_drawable(null, (src
is null) ?
null : src
.getDrawableStruct(), (cmap
is null) ?
null : cmap
.getColormapStruct(), srcX
, srcY
, destX
, destY
, width
, height
) );
218 * SetFromDrawable is different from GetFrom Drawable as it doesn't create a new pixbuf
220 public void setFromDrawable(Drawable src
, int srcX
, int srcY
, int width
, int height
)
222 gdk_pixbuf_get_from_drawable(
223 gdkPixbuf
, // gdkPixbuf
224 src
.getDrawableStruct(),
227 0, 0, // destination x and y
232 * Creates a new Pixbuf from a drawable.
233 * this is a simplyfied GetFromDrawable
235 this(Drawable src
, int srcX
, int srcY
, int width
, int height
)
237 GdkPixbuf
* pb
= gdk_pixbuf_get_from_drawable(
239 src
.getDrawableStruct(),
242 0, 0, // destination x and y
250 * The most basic way to create a pixbuf is to wrap an existing pixel
251 * buffer with a GdkPixbuf structure. You can use the
252 * gdk_pixbuf_new_from_data() function to do this You need to specify
253 * the destroy notification function that will be called when the
254 * data buffer needs to be freed; this will happen when a GdkPixbuf
255 * is finalized by the reference counting functions If you have a
256 * chunk of static data compiled into your application, you can pass
257 * in NULL as the destroy notification function so that the data
259 * The gdk_pixbuf_new() function can be used as a convenience to
260 * create a pixbuf with an empty buffer. This is equivalent to
261 * allocating a data buffer using malloc() and
262 * then wrapping it with gdk_pixbuf_new_from_data(). The gdk_pixbuf_new()
263 * function will compute an optimal rowstride so that rendering can be
264 * performed with an efficient algorithm.
265 * As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
266 * function to create a pixbuf from inline XPM image data.
267 * You can also copy an existing pixbuf with the gdk_pixbuf_copy()
268 * function. This is not the same as just doing a g_object_ref()
269 * on the old pixbuf; the copy function will actually duplicate the
270 * pixel data in memory and create a new GdkPixbuf structure for it.
275 * The GdkPixbuf structure contains
276 * information that describes an image in memory.
278 * Image data in a pixbuf is stored in memory in uncompressed,
279 * packed format. Rows in the image are stored top to bottom, and
280 * in each row pixels are stored from left to right. There may be
281 * padding at the end of a row. The "rowstride" value of a pixbuf,
282 * as returned by gdk_pixbuf_get_rowstride(), indicates the number
283 * of bytes between rows.
284 * Example1.put_pixel() example
285 * The following code illustrates a simple put_pixel()
286 * function for RGB pixbufs with 8 bits per channel with an alpha
287 * channel. It is not included in the gdk-pixbuf library for
288 * performance reasons; rather than making several function calls
289 * for each pixel, your own code can take shortcuts.
291 * put_pixel (GdkPixbuf *pixbuf, int x, int y, guchar red, guchar green, guchar blue, guchar alpha)
293 * int width, height, rowstride, n_channels;
294 * guchar *pixels, *p;
295 * n_channels = gdk_pixbuf_get_n_channels (pixbuf);
296 * g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
297 * g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
298 * g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
299 * g_assert (n_channels == 4);
300 * width = gdk_pixbuf_get_width (pixbuf);
301 * height = gdk_pixbuf_get_height (pixbuf);
302 * g_assert (x >= 0 x < width);
303 * g_assert (y >= 0 y < height);
304 * rowstride = gdk_pixbuf_get_rowstride (pixbuf);
305 * pixels = gdk_pixbuf_get_pixels (pixbuf);
306 * p = pixels + y * rowstride + x * n_channels;
312 * This function will not work for pixbufs with images that are
313 * other than 8 bits per sample or channel, but it will work for
314 * most of the pixbufs that GTK+ uses.
316 * If you are doing memcpy() of raw pixbuf data, note that the
317 * last row in the pixbuf may not be as wide as the full
318 * rowstride, but rather just as wide as the pixel data needs to
319 * be. That is, it is unsafe to do memcpy (dest,
320 * pixels, rowstride * height) to copy a whole pixbuf.
321 * Use gdk_pixbuf_copy() instead, or compute the width in bytes
322 * of the last row as width * ((n_channels *
323 * bits_per_sample + 7) / 8).
328 * GdkPixbuf structures are reference counted. This means that an
329 * application can share a single pixbuf among many parts of the
330 * code. When a piece of the program needs to keep a pointer to a
331 * pixbuf, it should add a reference to it by calling g_object_ref().
332 * When it no longer needs the pixbuf, it should subtract a reference
333 * by calling g_object_unref(). The pixbuf will be destroyed when
334 * its reference count drops to zero. Newly-created GdkPixbuf
335 * structures start with a reference count of one.
337 * As GdkPixbuf is derived from GObject now, gdk_pixbuf_ref() and
338 * gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
339 * and g_object_unref() resp.
340 * Finalizing a pixbuf means to free its pixel
341 * data and to free the GdkPixbuf structure itself. Most of the
342 * library functions that create GdkPixbuf structures create the
343 * pixel data by themselves and define the way it should be freed;
344 * you do not need to worry about those. The only function that lets
345 * you specify how to free the pixel data is
346 * gdk_pixbuf_new_from_data(). Since you pass it a pre-allocated
347 * pixel buffer, you must also specify a way to free that data. This
348 * is done with a function of type GdkPixbufDestroyNotify. When a
349 * pixbuf created with gdk_pixbuf_new_from_data() is finalized, your
350 * destroy notification function will be called, and it is its
351 * responsibility to free the pixel array.
356 * The gdk-pixbuf library provides a simple mechanism for loading
357 * an image from a file in synchronous fashion. This means that the
358 * library takes control of the application while the file is being
359 * loaded; from the user's point of view, the application will block
360 * until the image is done loading.
361 * This interface can be used by applications in which blocking is
362 * acceptable while an image is being loaded. It can also be used to
363 * load small images in general. Applications that need progressive
364 * loading can use the GdkPixbufLoader functionality instead.
369 * These functions allow to save a GdkPixbuf in a number of
370 * file formats. The formatted data can be written to a file
371 * or to a memory buffer. gdk-pixbuf can also call a user-defined
372 * callback on the data, which allows to e.g. write the image
373 * to a socket or store it in a database.
378 * The gdk-pixbuf contains functions to scale pixbufs, to scale
379 * pixbufs and composite against an existing image, and to scale
380 * pixbufs and composite against a solid color or checkerboard.
381 * Compositing a checkerboard is a common way to show an image with
382 * an alpha channel in image-viewing and editing software.
383 * Since the full-featured functions (gdk_pixbuf_scale(),
384 * gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
385 * rather complex to use and have many arguments, two simple
386 * convenience functions are provided, gdk_pixbuf_scale_simple() and
387 * gdk_pixbuf_composite_color_simple() which create a new pixbuf of a
388 * given size, scale an original image to fit, and then return the
390 * The following example demonstrates handling an expose event by
391 * rendering the appropriate area of a source image (which is scaled
392 * to fit the widget) onto the widget's window. The source image is
393 * rendered against a checkerboard, which provides a visual
394 * representation of the alpha channel if the image has one. If the
395 * image doesn't have an alpha channel, calling
396 * gdk_pixbuf_composite_color() function has exactly the same effect
397 * as calling gdk_pixbuf_scale().
398 * Example2.Handling an expose event.
400 * expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
403 * dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
404 * gdk_pixbuf_composite_color (pixbuf, dest,
405 * 0, 0, event->area.width, event->area.height,
406 * -event->area.x, -event->area.y,
407 * (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
408 * (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
409 * GDK_INTERP_BILINEAR, 255,
410 * event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
411 * gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
412 * 0, 0, event->area.x, event->area.y,
413 * event->area.width, event->area.height,
414 * GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
415 * gdk_pixbuf_unref (dest);
422 * These functions provide miscellaneous utilities for manipulating
423 * pixbufs. The pixel data in pixbufs may of course be manipulated
424 * directly by applications, but several common operations can be
425 * performed by these functions instead.
429 * Takes the opacity values in a rectangular portion of a pixbuf and thresholds
430 * them to produce a bi-level alpha mask that can be used as a clipping mask for
435 * Bitmap where the bilevel mask will be painted to.
437 * Source X coordinate.
439 * source Y coordinate.
441 * Destination X coordinate.
443 * Destination Y coordinate.
445 * Width of region to threshold, or -1 to use pixbuf width
447 * Height of region to threshold, or -1 to use pixbuf height
449 * Opacity values below this will be painted as zero; all
450 * other values will be painted as one.
452 public void renderThresholdAlpha(Bitmap bitmap
, int srcX
, int srcY
, int destX
, int destY
, int width
, int height
, int alphaThreshold
)
454 // void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold);
455 gdk_pixbuf_render_threshold_alpha(gdkPixbuf
, (bitmap
is null) ?
null : bitmap
.getBitmapStruct(), srcX
, srcY
, destX
, destY
, width
, height
, alphaThreshold
);
460 * gdk_pixbuf_render_to_drawable has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use gdk_draw_pixbuf() instead.
461 * Renders a rectangular portion of a pixbuf to a drawable while using the
462 * specified GC. This is done using GdkRGB, so the specified drawable must have
463 * the GdkRGB visual and colormap. Note that this function will ignore the
464 * opacity information for images with an alpha channel; the GC must already
465 * have the clipping mask set if you want transparent regions to show through.
466 * For an explanation of dither offsets, see the GdkRGB documentation. In
467 * brief, the dither offset is important when re-rendering partial regions of an
468 * image to a rendered version of the full image, or for when the offsets to a
469 * base position change, as in scrolling. The dither matrix has to be shifted
470 * for consistent visual results. If you do not have any of these cases, the
471 * dither offsets can be both zero.
475 * Destination drawable.
477 * GC used for rendering.
479 * Source X coordinate within pixbuf.
481 * Source Y coordinate within pixbuf.
483 * Destination X coordinate within drawable.
485 * Destination Y coordinate within drawable.
487 * Width of region to render, in pixels, or -1 to use pixbuf width
489 * Height of region to render, in pixels, or -1 to use pixbuf height
491 * Dithering mode for GdkRGB.
493 * X offset for dither.
495 * Y offset for dither.
497 public void renderToDrawable(Drawable drawable
, GdkGC
* gc
, int srcX
, int srcY
, int destX
, int destY
, int width
, int height
, GdkRgbDither dither
, int xDither
, int yDither
)
499 // void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf, GdkDrawable *drawable, GdkGC *gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, GdkRgbDither dither, int x_dither, int y_dither);
500 gdk_pixbuf_render_to_drawable(gdkPixbuf
, (drawable
is null) ?
null : drawable
.getDrawableStruct(), gc
, srcX
, srcY
, destX
, destY
, width
, height
, dither
, xDither
, yDither
);
505 * gdk_pixbuf_render_to_drawable_alpha has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use gdk_draw_pixbuf() instead.
506 * Renders a rectangular portion of a pixbuf to a drawable. The destination
507 * drawable must have a colormap. All windows have a colormap, however, pixmaps
508 * only have colormap by default if they were created with a non-NULL window argument.
509 * Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
510 * On older X servers, rendering pixbufs with an alpha channel involves round trips
511 * to the X server, and may be somewhat slow.
515 * Destination drawable.
517 * Source X coordinate within pixbuf.
519 * Source Y coordinates within pixbuf.
521 * Destination X coordinate within drawable.
523 * Destination Y coordinate within drawable.
525 * Width of region to render, in pixels, or -1 to use pixbuf width.
527 * Height of region to render, in pixels, or -1 to use pixbuf height.
529 * Ignored. Present for backwards compatibility.
531 * Ignored. Present for backwards compatibility
533 * Dithering mode for GdkRGB.
535 * X offset for dither.
537 * Y offset for dither.
539 public void renderToDrawableAlpha(Drawable drawable
, int srcX
, int srcY
, int destX
, int destY
, int width
, int height
, GdkPixbufAlphaMode alphaMode
, int alphaThreshold
, GdkRgbDither dither
, int xDither
, int yDither
)
541 // void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, GdkPixbufAlphaMode alpha_mode, int alpha_threshold, GdkRgbDither dither, int x_dither, int y_dither);
542 gdk_pixbuf_render_to_drawable_alpha(gdkPixbuf
, (drawable
is null) ?
null : drawable
.getDrawableStruct(), srcX
, srcY
, destX
, destY
, width
, height
, alphaMode
, alphaThreshold
, dither
, xDither
, yDither
);
546 * Creates a pixmap and a mask bitmap which are returned in the pixmap_return
547 * and mask_return arguments, respectively, and renders a pixbuf and its
548 * corresponding thresholded alpha mask to them. This is merely a convenience
549 * function; applications that need to render pixbufs with dither offsets or to
550 * given drawables should use gdk_draw_pixbuf() and gdk_pixbuf_render_threshold_alpha().
551 * The pixmap that is created is created for the colormap returned
552 * by gdk_rgb_get_colormap(). You normally will want to instead use
553 * the actual colormap for a widget, and use
554 * gdk_pixbuf_render_pixmap_and_mask_for_colormap().
555 * If the pixbuf does not have an alpha channel, then *mask_return will be set
560 * Location to store a pointer to the created pixmap,
561 * or NULL if the pixmap is not needed.
563 * Location to store a pointer to the created mask,
564 * or NULL if the mask is not needed.
566 * Threshold value for opacity values.
568 public void renderPixmapAndMask(GdkPixmap
** pixmapReturn
, GdkBitmap
** maskReturn
, int alphaThreshold
)
570 // void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf, GdkPixmap **pixmap_return, GdkBitmap **mask_return, int alpha_threshold);
571 gdk_pixbuf_render_pixmap_and_mask(gdkPixbuf
, pixmapReturn
, maskReturn
, alphaThreshold
);
575 * Creates a pixmap and a mask bitmap which are returned in the pixmap_return
576 * and mask_return arguments, respectively, and renders a pixbuf and its
577 * corresponding tresholded alpha mask to them. This is merely a convenience
578 * function; applications that need to render pixbufs with dither offsets or to
579 * given drawables should use gdk_draw_pixbuf(), and gdk_pixbuf_render_threshold_alpha().
580 * The pixmap that is created uses the GdkColormap specified by colormap.
581 * This colormap must match the colormap of the window where the pixmap
582 * will eventually be used or an error will result.
583 * If the pixbuf does not have an alpha channel, then *mask_return will be set
590 * Location to store a pointer to the created pixmap,
591 * or NULL if the pixmap is not needed.
593 * Location to store a pointer to the created mask,
594 * or NULL if the mask is not needed.
596 * Threshold value for opacity values.
598 public void renderPixmapAndMaskForColormap(Colormap colormap
, GdkPixmap
** pixmapReturn
, GdkBitmap
** maskReturn
, int alphaThreshold
)
600 // void gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, GdkColormap *colormap, GdkPixmap **pixmap_return, GdkBitmap **mask_return, int alpha_threshold);
601 gdk_pixbuf_render_pixmap_and_mask_for_colormap(gdkPixbuf
, (colormap
is null) ?
null : colormap
.getColormapStruct(), pixmapReturn
, maskReturn
, alphaThreshold
);
606 * Same as gdk_pixbuf_get_from_drawable() but gets the pixbuf from
609 * Destination pixbuf, or NULL if a new pixbuf should be created.
613 * A colormap, or NULL to use the one for src
615 * Source X coordinate within drawable.
617 * Source Y coordinate within drawable.
619 * Destination X coordinate in pixbuf, or 0 if dest is NULL.
621 * Destination Y coordinate in pixbuf, or 0 if dest is NULL.
623 * Width in pixels of region to get.
625 * Height in pixels of region to get.
627 * dest, newly-created pixbuf if dest was NULL, NULL on error
629 public Pixbuf
getFromImage(ImageGdk src
, Colormap cmap
, int srcX
, int srcY
, int destX
, int destY
, int width
, int height
)
631 // GdkPixbuf* gdk_pixbuf_get_from_image (GdkPixbuf *dest, GdkImage *src, GdkColormap *cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);
632 return new Pixbuf( gdk_pixbuf_get_from_image(gdkPixbuf
, (src
is null) ?
null : src
.getImageGdkStruct(), (cmap
is null) ?
null : cmap
.getColormapStruct(), srcX
, srcY
, destX
, destY
, width
, height
) );
638 * GdkPixbuf* gdk_pixbuf_new (GdkColorspace colorspace,
639 * gboolean has_alpha,
640 * int bits_per_sample,
643 * Creates a new GdkPixbuf structure and allocates a buffer for it. The
644 * buffer has an optimal rowstride. Note that the buffer is not cleared;
645 * you will have to fill it completely yourself.
647 * Color space for image
649 * Whether the image should have transparency information
651 * Number of bits per color sample
653 * Width of image in pixels, must be > 0
655 * Height of image in pixels, must be > 0
657 * A newly-created GdkPixbuf with a reference count of 1, or
658 * NULL if not enough memory could be allocated for the image buffer.
660 public static GType
getType()
662 // GType gdk_pixbuf_get_type ();
663 return gdk_pixbuf_get_type();
667 * Creates a new GdkPixbuf out of in-memory image data. Currently only RGB
668 * images with 8 bits per sample are supported.
670 * Image data in 8-bit/sample packed format
672 * Colorspace for the image data
674 * Whether the data has an opacity channel
676 * Number of bits per sample
678 * Width of the image in pixels, must be > 0
680 * Height of the image in pixels, must be > 0
682 * Distance in bytes between row starts
684 * Function used to free the data when the pixbuf's reference count
685 * drops to zero, or NULL if the data should not be freed
687 * Closure data to pass to the destroy notification function
689 * A newly-created GdkPixbuf structure with a reference count of 1.
691 public this (char* data
, GdkColorspace colorspace
, int hasAlpha
, int bitsPerSample
, int width
, int height
, int rowstride
, GdkPixbufDestroyNotify destroyFn
, void* destroyFnData
)
693 // 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);
694 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_data(data
, colorspace
, hasAlpha
, bitsPerSample
, width
, height
, rowstride
, destroyFn
, destroyFnData
) );
698 * Creates a new pixbuf by parsing XPM data in memory. This data is commonly
699 * the result of including an XPM file into a program's C source.
701 * Pointer to inline XPM data.
703 * A newly-created pixbuf with a reference count of 1.
705 public this (char** data
)
707 // GdkPixbuf* gdk_pixbuf_new_from_xpm_data (const char **data);
708 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_xpm_data(data
) );
712 * Create a GdkPixbuf from a flat representation that is suitable for
713 * storing as inline data in a program. This is useful if you want to
714 * ship a program with images, but don't want to depend on any
716 * GTK+ ships with a program called gdk-pixbuf-csource
717 * which allows for conversion of GdkPixbufs into such a inline representation.
718 * In almost all cases, you should pass the --raw flag to
719 * gdk-pixbuf-csource. A sample invocation would be:
720 * gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
721 * For the typical case where the inline pixbuf is read-only static data,
722 * you don't need to copy the pixel data unless you intend to write to
723 * it, so you can pass FALSE for copy_pixels. (If you pass
724 * --rle to gdk-pixbuf-csource, a copy
725 * will be made even if copy_pixels is FALSE, so using this option is
726 * generally a bad idea.)
727 * If you create a pixbuf from const inline data compiled into your
728 * program, it's probably safe to ignore errors and disable length checks,
729 * since things will always succeed:
730 * pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
731 * For non-const inline data, you could get out of memory. For untrusted
732 * inline data located at runtime, you could have corrupt inline data in
735 * Length in bytes of the data argument or -1 to
736 * disable length checks
738 * Byte data containing a serialized GdkPixdata structure
740 * Whether to copy the pixel data, or use direct pointers
741 * data for the resulting pixbuf
743 * GError return location, may be NULL to ignore errors
745 * A newly-created GdkPixbuf structure with a reference,
746 * count of 1, or NULL if an error occurred.
748 public this (int dataLength
, byte* data
, int copyPixels
, GError
** error
)
750 // GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length, const guint8 *data, gboolean copy_pixels, GError **error);
751 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_inline(dataLength
, data
, copyPixels
, error
) );
755 * Creates a new pixbuf which represents a sub-region of
756 * src_pixbuf. The new pixbuf shares its pixels with the
757 * original pixbuf, so writing to one affects both.
758 * The new pixbuf holds a reference to src_pixbuf, so
759 * src_pixbuf will not be finalized until the new pixbuf
764 * X coord in src_pixbuf
766 * Y coord in src_pixbuf
768 * width of region in src_pixbuf
770 * height of region in src_pixbuf
774 public this (int srcX
, int srcY
, int width
, int height
)
776 // GdkPixbuf* gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf, int src_x, int src_y, int width, int height);
777 this(cast(GdkPixbuf
*)gdk_pixbuf_new_subpixbuf(gdkPixbuf
, srcX
, srcY
, width
, height
) );
781 * Creates a new GdkPixbuf with a copy of the information in the specified
786 * A newly-created pixbuf with a reference count of 1, or NULL if
787 * not enough memory could be allocated.
789 * gdk_pixbuf_finalize().
793 // GdkPixbuf* gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
794 return new Pixbuf( gdk_pixbuf_copy(gdkPixbuf
) );
803 * Queries the color space of a pixbuf.
809 public GdkColorspace
getColorspace()
811 // GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
812 return gdk_pixbuf_get_colorspace(gdkPixbuf
);
816 * Queries the number of channels of a pixbuf.
820 * Number of channels.
822 public int getNChannels()
824 // int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
825 return gdk_pixbuf_get_n_channels(gdkPixbuf
);
829 * Queries whether a pixbuf has an alpha channel (opacity information).
833 * TRUE if it has an alpha channel, FALSE otherwise.
835 public int getHasAlpha()
837 // gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
838 return gdk_pixbuf_get_has_alpha(gdkPixbuf
);
842 * Queries the number of bits per color sample in a pixbuf.
846 * Number of bits per color sample.
848 public int getBitsPerSample()
850 // int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
851 return gdk_pixbuf_get_bits_per_sample(gdkPixbuf
);
855 * Queries a pointer to the pixel data of a pixbuf.
859 * A pointer to the pixbuf's pixel data. Please see the section called Image Data
860 * for information about how the pixel data is stored in
863 public char* getPixels()
865 // guchar* gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
866 return gdk_pixbuf_get_pixels(gdkPixbuf
);
870 * Queries the width of a pixbuf.
876 public int getWidth()
878 // int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
879 return gdk_pixbuf_get_width(gdkPixbuf
);
883 * Queries the height of a pixbuf.
889 public int getHeight()
891 // int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
892 return gdk_pixbuf_get_height(gdkPixbuf
);
896 * Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
897 * and the start of the next row.
901 * Distance between row starts.
903 public int getRowstride()
905 // int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
906 return gdk_pixbuf_get_rowstride(gdkPixbuf
);
910 * Looks up key in the list of options that may have been attached to the
911 * pixbuf when it was loaded.
915 * a nul-terminated string.
917 * the value associated with key. This is a nul-terminated
918 * string that should not be freed or NULL if key was not found.
920 * The "bits-per-sample" property
921 * "bits-per-sample" gint : Read / Write / Construct Only
922 * The number of bits per sample.
923 * Currently only 8 bit per sample are supported.
924 * Allowed values: [1,16]
927 public char[] getOption(char[] key
)
929 // const gchar* gdk_pixbuf_get_option (GdkPixbuf *pixbuf, const gchar *key);
930 return Str
.toString(gdk_pixbuf_get_option(gdkPixbuf
, Str
.toStringz(key
)) );
944 * Creates a new pixbuf by loading an image from a file. The file format is
945 * detected automatically. If NULL is returned, then error will be set.
946 * Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
948 * Name of file to load, in the GLib file name encoding
950 * Return location for an error
952 * A newly-created pixbuf with a reference count of 1, or NULL if
953 * any of several error conditions occurred: the file could not be opened,
954 * there was no loader for the file's format, there was not enough memory to
955 * allocate the image buffer, or the image file contained invalid data.
957 public this (char[] filename
, GError
** error
)
959 // GdkPixbuf* gdk_pixbuf_new_from_file (const char *filename, GError **error);
960 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_file(Str
.toStringz(filename
), error
) );
964 * Creates a new pixbuf by loading an image from a file. The file format is
965 * detected automatically. If NULL is returned, then error will be set.
966 * Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
967 * The image will be scaled to fit in the requested size, preserving
968 * the image's aspect ratio.
970 * Name of file to load, in the GLib file name encoding
972 * The width the image should have or -1 to not constrain the width
974 * The height the image should have or -1 to not constrain the height
976 * Return location for an error
978 * A newly-created pixbuf with a reference count of 1, or
979 * NULL if any of several error conditions occurred: the file could not
980 * be opened, there was no loader for the file's format, there was not
981 * enough memory to allocate the image buffer, or the image file contained
985 public this (char[] filename
, int width
, int height
, GError
** error
)
987 // GdkPixbuf* gdk_pixbuf_new_from_file_at_size (const char *filename, int width, int height, GError **error);
988 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_file_at_size(Str
.toStringz(filename
), width
, height
, error
) );
992 * Creates a new pixbuf by loading an image from a file. The file format is
993 * detected automatically. If NULL is returned, then error will be set.
994 * Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
995 * The image will be scaled to fit in the requested size, optionally preserving
996 * the image's aspect ratio.
997 * When preserving the aspect ratio, a width of -1 will cause the image
998 * to be scaled to the exact given height, and a height of -1 will cause
999 * the image to be scaled to the exact given width. When not preserving
1000 * aspect ratio, a width or height of -1 means to not scale the image
1001 * at all in that dimension. Negative values for width and height are
1002 * allowed since 2.8.
1004 * Name of file to load, in the GLib file name encoding
1006 * The width the image should have or -1 to not constrain the width
1008 * The height the image should have or -1 to not constrain the height
1009 * preserve_aspect_ratio:
1010 * TRUE to preserve the image's aspect ratio
1012 * Return location for an error
1014 * A newly-created pixbuf with a reference count of 1, or NULL
1015 * if any of several error conditions occurred: the file could not be opened,
1016 * there was no loader for the file's format, there was not enough memory to
1017 * allocate the image buffer, or the image file contained invalid data.
1020 public this (char[] filename
, int width
, int height
, int preserveAspectRatio
, GError
** error
)
1022 // GdkPixbuf* gdk_pixbuf_new_from_file_at_scale (const char *filename, int width, int height, gboolean preserve_aspect_ratio, GError **error);
1023 this(cast(GdkPixbuf
*)gdk_pixbuf_new_from_file_at_scale(Str
.toStringz(filename
), width
, height
, preserveAspectRatio
, error
) );
1028 * Saves pixbuf to a file in type, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
1029 * If error is set, FALSE will be returned.
1030 * See gdk_pixbuf_save() for more details.
1034 * name of file to save.
1036 * name of file format.
1038 * name of options to set, NULL-terminated
1040 * values for named options
1042 * return location for error, or NULL
1044 * whether an error was set
1046 public int savev(char[] filename
, char[] type
, char** optionKeys
, char** optionValues
, GError
** error
)
1048 // gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf, const char *filename, const char *type, char **option_keys, char **option_values, GError **error);
1049 return gdk_pixbuf_savev(gdkPixbuf
, Str
.toStringz(filename
), Str
.toStringz(type
), optionKeys
, optionValues
, error
);
1053 * Saves pixbuf to a file in format type. By default, "jpeg", "png", "ico"
1054 * and "bmp" are possible file formats to save in, but more formats may be
1055 * installed. The list of all writable formats can be determined in the
1057 * void add_if_writable (GdkPixbufFormat *data, GSList **list)
1059 * if (gdk_pixbuf_format_is_writable (data))
1060 * *list = g_slist_prepend (*list, data);
1062 * GSList *formats = gdk_pixbuf_get_formats ();
1063 * GSList *writable_formats = NULL;
1064 * g_slist_foreach (formats, add_if_writable, writable_formats);
1065 * g_slist_free (formats);
1066 * If error is set, FALSE will be returned. Possible errors include
1067 * those in the GDK_PIXBUF_ERROR domain and those in the G_FILE_ERROR domain.
1068 * The variable argument list should be NULL-terminated; if not empty,
1069 * it should contain pairs of strings that modify the save
1070 * parameters. For example:
1071 * gdk_pixbuf_save (pixbuf, handle, "jpeg", error,
1072 * "quality", "100", NULL);
1073 * Currently only few parameters exist. JPEG images can be saved with a
1074 * "quality" parameter; its value should be in the range [0,100].
1075 * Text chunks can be attached to PNG images by specifying parameters of
1076 * the form "tEXt::key", where key is an ASCII string of length 1-79.
1077 * The values are UTF-8 encoded strings. The PNG compression level can
1078 * be specified using the "compression" parameter; it's value is in an
1079 * integer in the range of [0,9].
1080 * ICO images can be saved in depth 16, 24, or 32, by using the "depth"
1081 * parameter. When the ICO saver is given "x_hot" and "y_hot" parameters,
1082 * it produces a CUR instead of an ICO.
1086 * name of file to save.
1088 * name of file format.
1090 * return location for error, or NULL
1092 * list of key-value save options
1094 * whether an error was set
1096 public int save(char[] filename
, char[] type
, GError
** error
, ... )
1098 // gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf, const char *filename, const char *type, GError **error, ...);
1099 return gdk_pixbuf_save(gdkPixbuf
, Str
.toStringz(filename
), Str
.toStringz(type
), error
);
1104 * Saves pixbuf in format type by feeding the produced data to a
1105 * callback. Can be used when you want to store the image to something
1106 * other than a file, such as an in-memory buffer or a socket.
1107 * If error is set, FALSE will be returned. Possible errors
1108 * include those in the GDK_PIXBUF_ERROR domain and whatever the save
1109 * function generates.
1110 * See gdk_pixbuf_save() for more details.
1114 * a function that is called to save each block of data that
1115 * the save routine generates.
1117 * user data to pass to the save function.
1119 * name of file format.
1121 * return location for error, or NULL
1123 * list of key-value save options
1125 * whether an error was set
1128 public int saveToCallback(GdkPixbufSaveFunc saveFunc
, void* userData
, char[] type
, GError
** error
, ... )
1130 // gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, GError **error, ...);
1131 return gdk_pixbuf_save_to_callback(gdkPixbuf
, saveFunc
, userData
, Str
.toStringz(type
), error
);
1135 * Saves pixbuf to a callback in format type, which is currently "jpeg",
1136 * "png", "tiff", "ico" or "bmp". If error is set, FALSE will be returned. See
1137 * gdk_pixbuf_save_to_callback() for more details.
1141 * a function that is called to save each block of data that
1142 * the save routine generates.
1144 * user data to pass to the save function.
1146 * name of file format.
1148 * name of options to set, NULL-terminated
1150 * values for named options
1152 * return location for error, or NULL
1154 * whether an error was set
1157 public int saveToCallbackv(GdkPixbufSaveFunc saveFunc
, void* userData
, char[] type
, char** optionKeys
, char** optionValues
, GError
** error
)
1159 // 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);
1160 return gdk_pixbuf_save_to_callbackv(gdkPixbuf
, saveFunc
, userData
, Str
.toStringz(type
), optionKeys
, optionValues
, error
);
1164 * Saves pixbuf to a new buffer in format type, which is currently "jpeg",
1165 * "png", "tiff", "ico" or "bmp". This is a convenience function that uses
1166 * gdk_pixbuf_save_to_callback() to do the real work. Note that the buffer
1167 * is not nul-terminated and may contain embedded nuls.
1168 * If error is set, FALSE will be returned and string will be set to
1169 * NULL. Possible errors include those in the GDK_PIXBUF_ERROR
1171 * See gdk_pixbuf_save() for more details.
1175 * location to receive a pointer to the new buffer.
1177 * location to receive the size of the new buffer.
1179 * name of file format.
1181 * return location for error, or NULL
1183 * list of key-value save options
1185 * whether an error was set
1188 public int saveToBuffer(char** buffer
, uint* bufferSize
, char[] type
, GError
** error
, ... )
1190 // gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, GError **error, ...);
1191 return gdk_pixbuf_save_to_buffer(gdkPixbuf
, buffer
, bufferSize
, Str
.toStringz(type
), error
);
1195 * Saves pixbuf to a new buffer in format type, which is currently "jpeg",
1196 * "tiff", "png", "ico" or "bmp". See gdk_pixbuf_save_to_buffer() for more details.
1200 * location to receive a pointer to the new buffer.
1202 * location to receive the size of the new buffer.
1204 * name of file format.
1206 * name of options to set, NULL-terminated
1208 * values for named options
1210 * return location for error, or NULL
1212 * whether an error was set
1215 public int saveToBufferv(char** buffer
, uint* bufferSize
, char[] type
, char** optionKeys
, char** optionValues
, GError
** error
)
1217 // gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, char **option_keys, char **option_values, GError **error);
1218 return gdk_pixbuf_save_to_bufferv(gdkPixbuf
, buffer
, bufferSize
, Str
.toStringz(type
), optionKeys
, optionValues
, error
);
1223 * Create a new GdkPixbuf containing a copy of src scaled to
1224 * dest_width x dest_height. Leaves src unaffected. interp_type
1225 * should be GDK_INTERP_NEAREST if you want maximum speed (but when
1226 * scaling down GDK_INTERP_NEAREST is usually unusably ugly). The
1227 * default interp_type should be GDK_INTERP_BILINEAR which offers
1228 * reasonable quality and speed.
1229 * You can scale a sub-portion of src by creating a sub-pixbuf
1230 * pointing into src; see gdk_pixbuf_new_subpixbuf().
1231 * For more complicated scaling/compositing see gdk_pixbuf_scale()
1232 * and gdk_pixbuf_composite().
1236 * the width of destination image
1238 * the height of destination image
1240 * the interpolation type for the transformation.
1242 * the new GdkPixbuf, or NULL if not enough memory could be
1245 public Pixbuf
scaleSimple(int destWidth
, int destHeight
, GdkInterpType interpType
)
1247 // GdkPixbuf* gdk_pixbuf_scale_simple (const GdkPixbuf *src, int dest_width, int dest_height, GdkInterpType interp_type);
1248 return new Pixbuf( gdk_pixbuf_scale_simple(gdkPixbuf
, destWidth
, destHeight
, interpType
) );
1252 * Creates a transformation of the source image src by scaling by
1253 * scale_x and scale_y then translating by offset_x and offset_y,
1254 * then renders the rectangle (dest_x, dest_y, dest_width,
1255 * dest_height) of the resulting image onto the destination image
1256 * replacing the previous contents.
1257 * Try to use gdk_pixbuf_scale_simple() first, this function is
1258 * the industrial-strength power tool you can fall back to if
1259 * gdk_pixbuf_scale_simple() isn't powerful enough.
1263 * the GdkPixbuf into which to render the results
1265 * the left coordinate for region to render
1267 * the top coordinate for region to render
1269 * the width of the region to render
1271 * the height of the region to render
1273 * the offset in the X direction (currently rounded to an integer)
1275 * the offset in the Y direction (currently rounded to an integer)
1277 * the scale factor in the X direction
1279 * the scale factor in the Y direction
1281 * the interpolation type for the transformation.
1283 public void scale(Pixbuf dest
, int destX
, int destY
, int destWidth
, int destHeight
, double offsetX
, double offsetY
, double scaleX
, double scaleY
, GdkInterpType interpType
)
1285 // 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);
1286 gdk_pixbuf_scale(gdkPixbuf
, (dest
is null) ?
null : dest
.getPixbufStruct(), destX
, destY
, destWidth
, destHeight
, offsetX
, offsetY
, scaleX
, scaleY
, interpType
);
1290 * Creates a new GdkPixbuf by scaling src to dest_width x
1291 * dest_height and compositing the result with a checkboard of colors
1292 * color1 and color2.
1296 * the width of destination image
1298 * the height of destination image
1300 * the interpolation type for the transformation.
1302 * overall alpha for source image (0..255)
1304 * the size of checks in the checkboard (must be a power of two)
1306 * the color of check at upper left
1308 * the color of the other check
1310 * the new GdkPixbuf, or NULL if not enough memory could be
1313 public Pixbuf
compositeColorSimple(int destWidth
, int destHeight
, GdkInterpType interpType
, int overallAlpha
, int checkSize
, uint color1
, uint color2
)
1315 // 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);
1316 return new Pixbuf( gdk_pixbuf_composite_color_simple(gdkPixbuf
, destWidth
, destHeight
, interpType
, overallAlpha
, checkSize
, color1
, color2
) );
1320 * Creates a transformation of the source image src by scaling by
1321 * scale_x and scale_y then translating by offset_x and offset_y.
1322 * This gives an image in the coordinates of the destination pixbuf.
1323 * The rectangle (dest_x, dest_y, dest_width, dest_height)
1324 * is then composited onto the corresponding rectangle of the
1325 * original destination image.
1326 * When the destination rectangle contains parts not in the source
1327 * image, the data at the edges of the source image is replicated
1329 * Figure1.Compositing of pixbufs
1333 * the GdkPixbuf into which to render the results
1335 * the left coordinate for region to render
1337 * the top coordinate for region to render
1339 * the width of the region to render
1341 * the height of the region to render
1343 * the offset in the X direction (currently rounded to an integer)
1345 * the offset in the Y direction (currently rounded to an integer)
1347 * the scale factor in the X direction
1349 * the scale factor in the Y direction
1351 * the interpolation type for the transformation.
1353 * overall alpha for source image (0..255)
1355 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
)
1357 // 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);
1358 gdk_pixbuf_composite(gdkPixbuf
, (dest
is null) ?
null : dest
.getPixbufStruct(), destX
, destY
, destWidth
, destHeight
, offsetX
, offsetY
, scaleX
, scaleY
, interpType
, overallAlpha
);
1362 * Creates a transformation of the source image src by scaling by
1363 * scale_x and scale_y then translating by offset_x and offset_y,
1364 * then composites the rectangle (dest_x ,dest_y, dest_width,
1365 * dest_height) of the resulting image with a checkboard of the
1366 * colors color1 and color2 and renders it onto the destination
1368 * See gdk_pixbuf_composite_color_simple() for a simpler variant of this
1369 * function suitable for many tasks.
1373 * the GdkPixbuf into which to render the results
1375 * the left coordinate for region to render
1377 * the top coordinate for region to render
1379 * the width of the region to render
1381 * the height of the region to render
1383 * the offset in the X direction (currently rounded to an integer)
1385 * the offset in the Y direction (currently rounded to an integer)
1387 * the scale factor in the X direction
1389 * the scale factor in the Y direction
1391 * the interpolation type for the transformation.
1393 * overall alpha for source image (0..255)
1395 * the X offset for the checkboard (origin of checkboard is at -check_x, -check_y)
1397 * the Y offset for the checkboard
1399 * the size of checks in the checkboard (must be a power of two)
1401 * the color of check at upper left
1403 * the color of the other check
1405 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
)
1407 // 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);
1408 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
);
1413 * Rotates a pixbuf by a multiple of 90 degrees, and returns the
1414 * result in a new pixbuf.
1418 * the angle to rotate by
1423 public Pixbuf
rotateSimple(GdkPixbufRotation angle
)
1425 // GdkPixbuf* gdk_pixbuf_rotate_simple (const GdkPixbuf *src, GdkPixbufRotation angle);
1426 return new Pixbuf( gdk_pixbuf_rotate_simple(gdkPixbuf
, angle
) );
1430 * Flips a pixbuf horizontally or vertically and returns the
1431 * result in a new pixbuf.
1435 * TRUE to flip horizontally, FALSE to flip vertically
1442 public Pixbuf
flip(int horizontal
)
1444 // GdkPixbuf* gdk_pixbuf_flip (const GdkPixbuf *src, gboolean horizontal);
1445 return new Pixbuf( gdk_pixbuf_flip(gdkPixbuf
, horizontal
) );
1449 * Takes an existing pixbuf and adds an alpha channel to it.
1450 * If the existing pixbuf already had an alpha channel, the channel
1451 * values are copied from the original; otherwise, the alpha channel
1452 * is initialized to 255 (full opacity).
1453 * If substitute_color is TRUE, then the color specified by (r, g, b) will be
1454 * assigned zero opacity. That is, if you pass (255, 255, 255) for the
1455 * substitute color, all white pixels will become fully transparent.
1459 * Whether to set a color to zero opacity. If this
1460 * is FALSE, then the (r, g, b) arguments will be ignored.
1462 * Red value to substitute.
1464 * Green value to substitute.
1466 * Blue value to substitute.
1468 * A newly-created pixbuf with a reference count of 1.
1470 public Pixbuf
addAlpha(int substituteColor
, char r
, char g
, char b
)
1472 // GdkPixbuf* gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b);
1473 return new Pixbuf( gdk_pixbuf_add_alpha(gdkPixbuf
, substituteColor
, r
, g
, b
) );
1477 * Copies a rectangular area from src_pixbuf to dest_pixbuf. Conversion of
1478 * pixbuf formats is done automatically.
1482 * Source X coordinate within src_pixbuf.
1484 * Source Y coordinate within src_pixbuf.
1486 * Width of the area to copy.
1488 * Height of the area to copy.
1490 * Destination pixbuf.
1492 * X coordinate within dest_pixbuf.
1494 * Y coordinate within dest_pixbuf.
1496 public void copyArea(int srcX
, int srcY
, int width
, int height
, Pixbuf destPixbuf
, int destX
, int destY
)
1498 // 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);
1499 gdk_pixbuf_copy_area(gdkPixbuf
, srcX
, srcY
, width
, height
, (destPixbuf
is null) ?
null : destPixbuf
.getPixbufStruct(), destX
, destY
);
1503 * Modifies saturation and optionally pixelates src, placing the result in
1504 * dest. src and dest may be the same pixbuf with no ill effects. If
1505 * saturation is 1.0 then saturation is not changed. If it's less than 1.0,
1506 * saturation is reduced (the image turns toward grayscale); if greater than
1507 * 1.0, saturation is increased (the image gets more vivid colors). If pixelate
1508 * is TRUE, then pixels are faded in a checkerboard pattern to create a
1509 * pixelated image. src and dest must have the same image format, size, and
1514 * place to write modified version of src
1518 * whether to pixelate
1520 public void saturateAndPixelate(Pixbuf dest
, float saturation
, int pixelate
)
1522 // void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src, GdkPixbuf *dest, gfloat saturation, gboolean pixelate);
1523 gdk_pixbuf_saturate_and_pixelate(gdkPixbuf
, (dest
is null) ?
null : dest
.getPixbufStruct(), saturation
, pixelate
);
1527 * Clears a pixbuf to the given RGBA value, converting the RGBA value into
1528 * the pixbuf's pixel format. The alpha will be ignored if the pixbuf
1529 * doesn't have an alpha channel.
1533 * RGBA pixel to clear to
1534 * (0xffffffff is opaque white, 0x00000000 transparent black)
1538 public void fill(uint pixel
)
1540 // void gdk_pixbuf_fill (GdkPixbuf *pixbuf, guint32 pixel);
1541 gdk_pixbuf_fill(gdkPixbuf
, pixel
);