The gdk-pixbuf Library
<<< Previous Page | Home | Up | Next Page >>>

# Utilities

## Name

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

## 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 original pixbuf already had alpha information, then the contents of the new pixbuf are exactly the same as the original's. Otherwise, the new pixbuf will have all pixels with full opacity if `substitute_color` is FALSE. If `substitute_color` is TRUE, then the color specified by (`r`, `g`, `b`) will be substituted for zero opacity.

`pixbuf` : | A pixbuf.
`substitute_color` : | Whether to substitute a color for 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.

`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`.

## See Also

GdkPixbuf

<<< Previous Page | Home | Up | Next Page >>>
Drawables to Pixbufs | Animations