Utilities

Utilities — Utility and miscellaneous convenience functions.

Synopsis


#include <gdk-pixbuf/gdk-pixbuf.h>

GdkPixbuf*          gdk_pixbuf_add_alpha                (const GdkPixbuf *pixbuf,
                                                         gboolean substitute_color,
                                                         guchar r,
                                                         guchar g,
                                                         guchar b);
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);
void                gdk_pixbuf_saturate_and_pixelate    (const GdkPixbuf *src,
                                                         GdkPixbuf *dest,
                                                         gfloat saturation,
                                                         gboolean pixelate);
GdkPixbuf*          gdk_pixbuf_apply_embedded_orientation
                                                        (GdkPixbuf *src);
void                gdk_pixbuf_fill                     (GdkPixbuf *pixbuf,
                                                         guint32 pixel);

Description

These functions provide miscellaneous utilities for manipulating pixbufs. The pixel data in pixbufs may of course be manipulated directly by applications, but several common operations can be performed by these functions instead.

Details

gdk_pixbuf_add_alpha ()

GdkPixbuf*          gdk_pixbuf_add_alpha                (const GdkPixbuf *pixbuf,
                                                         gboolean substitute_color,
                                                         guchar r,
                                                         guchar g,
                                                         guchar b);

Takes an existing pixbuf and adds an alpha channel to it. If the existing pixbuf already had an alpha channel, the channel values are copied from the original; otherwise, the alpha channel is initialized to 255 (full opacity).

If substitute_color is TRUE, then the color specified by (r, g, b) will be assigned zero opacity. That is, if you pass (255, 255, 255) for the substitute color, all white pixels will become fully transparent.

pixbuf : A GdkPixbuf.
substitute_color : Whether to set a color to zero opacity. If this is FALSE, then the (r, g, b) arguments will be ignored.
r : Red value to substitute.
g : Green value to substitute.
b : Blue value to substitute.
Returns : A newly-created pixbuf with a reference count of 1.

gdk_pixbuf_copy_area ()

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);

Copies a rectangular area from src_pixbuf to dest_pixbuf. Conversion of pixbuf formats is done automatically.

If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the copy operation. Therefore, you can not use this function to scroll a pixbuf.

src_pixbuf : Source pixbuf.
src_x : Source X coordinate within src_pixbuf.
src_y : Source Y coordinate within src_pixbuf.
width : Width of the area to copy.
height : Height of the area to copy.
dest_pixbuf : Destination pixbuf.
dest_x : X coordinate within dest_pixbuf.
dest_y : Y coordinate within dest_pixbuf.

gdk_pixbuf_saturate_and_pixelate ()

void                gdk_pixbuf_saturate_and_pixelate    (const GdkPixbuf *src,
                                                         GdkPixbuf *dest,
                                                         gfloat saturation,
                                                         gboolean pixelate);

Modifies saturation and optionally pixelates src, placing the result in dest. src and dest may be the same pixbuf with no ill effects. If saturation is 1.0 then saturation is not changed. If it's less than 1.0, saturation is reduced (the image turns toward grayscale); if greater than 1.0, saturation is increased (the image gets more vivid colors). If pixelate is TRUE, then pixels are faded in a checkerboard pattern to create a pixelated image. src and dest must have the same image format, size, and rowstride.

src : source image
dest : place to write modified version of src
saturation : saturation factor
pixelate : whether to pixelate

gdk_pixbuf_apply_embedded_orientation ()

GdkPixbuf*          gdk_pixbuf_apply_embedded_orientation
                                                        (GdkPixbuf *src);

Takes an existing pixbuf and checks for the presence of an associated "orientation" option, which may be provided by the jpeg loader (which reads the exif orientation tag) or the tiff loader (which reads the tiff orientation tag, and compensates it for the partial transforms performed by libtiff). If an orientation option/tag is present, the appropriate transform will be performed so that the pixbuf is oriented correctly.

src : A GdkPixbuf.
Returns : A newly-created pixbuf, or a reference to the input pixbuf (with an increased reference count). Since 2.12

gdk_pixbuf_fill ()

void                gdk_pixbuf_fill                     (GdkPixbuf *pixbuf,
                                                         guint32 pixel);

Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixbuf's pixel format. The alpha will be ignored if the pixbuf doesn't have an alpha channel.

pixbuf : a GdkPixbuf
pixel : RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black)

See Also

GdkPixbuf