Up: cl-cffi-gtk API documentation

Package gdk-pixbuf

GDK-Pixbuf is a library for image loading and manipulation. The GDK-Pixbuf documentation contains both the programmer's guide and the API reference. This is the API documentation of a Lisp binding to the GDK-Pixbuf library.

About This Package

Library version numbers
The GdkPixbuf object
File Loading
File Saving
Image Data in Memory
Scaling
Utilities
Animations
GdkPixbufLoader
Module Interface

Library version numbers

These macros and variables let you check the version of GDK-Pixbuf you are linking against.

Contains the full version of the GDK-Pixbuf library as a string. ...

The major version number of the GDK-Pixbuf library. ...

The minor version number of the GDK-Pixbuf library. ...

The micro version number of the GDK-Pixbuf library. ...

The GdkPixbuf object

Information that describes an image.

This enumeration defines the color spaces that are supported by the GDK-Pixbuf library. ...

The gdk-pixbuf object contains information that describes an image in memory. ...

Accessor of the bits-per-sample slot of the gdk-pixbuf class. ...

Accessor of the colorspace slot of the gdk-pixbuf class. ...

Accessor of the has-alpha slot of the gdk-pixbuf class. ...

Accessor of the height slot of the gdk-pixbuf class. ...

Accessor of the n-channels slot of the gdk-pixbuf class. ...

Accessor of the pixel-bytes slot of the gdk-pixbuf class. ...

Accessor of the pixels slot of the gdk-pixbuf class. ...

Accessor of the rowstride slot of the gdk-pixbuf class. ...

Accessor of the width slot of the gdk-pixbuf class. ...

Queries a pointer to the pixel data of a pixbuf. ...

Returns the length of the pixel data, in bytes. ...

Accessor of an option that may have been attached to the pixbuf. ...

Remove the key/value pair option attached to a pixbuf. ...

Copy the key/value pair options attached to a pixbuf to another. ...

Returns a read-only pointer to the raw pixel data. ...

File Loading

Loading a pixbuf from a file.

The GDK-Pixbuf library provides a simple mechanism for loading an image from a file in synchronous fashion. This means that the library takes control of the application while the file is being loaded. From the user's point of view, the application will block until the image is done loading.

This interface can be used by applications in which blocking is acceptable while an image is being loaded. It can also be used to load small images in general. Applications that need progressive loading can use the gdk-pixbuf-loader API functionality instead.

Parses an image file far enough to determine its format and size. ...

Creates a new pixbuf by loading an image from a file. ...

Creates a new pixbuf by loading an image from a file. ...

Creates a new pixbuf by loading an image from a file. ...

Creates a new pixbuf by loading an image from a resource. ...

Creates a new pixbuf by loading an image from an resource. ...

File Saving

Saving a pixbuf to a file.

These functions allow to save a gdk-pixbuf object in a number of file formats. The formatted data can be written to a file or to a memory buffer. The gdk-pixbuf library can also call a user-defined callback on the data, which allows to e.g. write the image to a socket or store it in a database.

Saves pixbuf to a file in format type. By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed. ...

Image Data in Memory

Creating a pixbuf from image data that is already in memory.

The most basic way to create a pixbuf is to wrap an existing pixel buffer with a gdk-pixbuf object. You can use the gdk-pixbuf-new-from-data function to do this. You need to specify the destroy notification function that will be called when the data buffer needs to be freed. This will happen when a gdk-pixbuf object is finalized by the reference counting functions If you have a chunk of static data compiled into your application, you can pass in nil as the destroy notification function so that the data will not be freed.

The gdk-pixbuf-new function can be used as a convenience to create a pixbuf with an empty buffer. This is equivalent to allocating a data buffer using malloc() and then wrapping it with the gdk-pixbuf-new-from-data function. The gdk-pixbuf-new function will compute an optimal rowstride so that rendering can be performed with an efficient algorithm.

As a special case, you can use the gdk-pixbuf-new-from-xpm-data function to create a pixbuf from inline XPM image data.

You can also copy an existing pixbuf with the gdk-pixbuf-copy function. This is not the same as just doing a g-object-ref call on the old pixbuf. The copy function will actually duplicate the pixel data in memory and create a new gdk-pixbuf instance for it.

Creates a new gdk-pixbuf object and allocates a buffer for it. ...

Creates a new pixbuf which represents a sub-region of pixbuf. ...

Creates a new gdk-pixbuf object with a copy of the information in the specified pixbuf. ...

Scaling

Scaling pixbufs and scaling and compositing pixbufs.

The gdk-pixbuf library contains functions to scale pixbufs, to scale pixbufs and composite against an existing image, and to scale pixbufs and composite against a solid color or checkerboard. Compositing a checkerboard is a common way to show an image with an alpha channel in image-viewing and editing software.

Since the full-featured gdk-pixbuf-scale, gdk-pixbuf-composite, and gdk-pixbuf-composite-color functions are rather complex to use and have many arguments, two simple convenience functions are provided, the gdk-pixbuf-scale-simple and gdk-pixbuf-composite-color-simple functions which create a new pixbuf of a given size, scale an original image to fit, and then return the new pixbuf.

If the destination pixbuf was created from a readonly source, these operations will force a copy into a mutable buffer.

Scaling and compositing functions take advantage of MMX hardware acceleration on systems where MMX is supported. If the gdk-pixbuf library is built with the Sun mediaLib library, these functions are instead accelerated using mediaLib, which provides hardware acceleration on Intel, AMD, and Sparc chipsets. If desired, mediaLib support can be turned off by setting the GDK_DISABLE_MEDIALIB environment variable.

The following example demonstrates handling an expose event by rendering the appropriate area of a source image, which is scaled to fit the widget, onto the window of the widget. The source image is rendered against a checkerboard, which provides a visual representation of the alpha channel if the image has one. If the image does not have an alpha channel, calling the gdk-pixbuf-composite-color function has exactly the same effect as calling the gdk-pixbuf-scale function.

Example: Handling an expose event.
gboolean
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
  GdkPixbuf *dest;

dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);

gdk_pixbuf_composite_color (pixbuf, dest, 0, 0, event->area.width, event->area.height, -event->area.x, -event->area.y, (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf), (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf), GDK_INTERP_BILINEAR, 255, event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);

gdk_draw_pixbuf (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], dest, 0, 0, event->area.x, event->area.y, event->area.width, event->area.height, GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);

gdk_pixbuf_unref (dest);

return TRUE; }
This enumeration describes the different interpolation modes that can be used with the scaling functions. ...

The possible rotations which can be passed to the gdk-pixbuf-rotate-simple function. ...

Create a new gdk-pixbuf object containing a copy of src scaled to width x height. ...

Creates a transformation of the source image src by scaling by xscale and yscale then translating by xoffset and yoffset, then renders the rectangle (x, y, width, height) of the resulting image onto the destination image replacing the previous contents. ...

Creates a new gdk-pixbuf object by scaling src to width x height and compositing the result with a checkboard of colors color1 and color2. ...

Creates a transformation of the source image src by scaling by xscale and yscale then translating by xoffset and yoffset. ...

Creates a transformation of the source image src by scaling by xscale and yscale then translating by xoffset and yoffset, then composites the rectangle (x, y, width, height) of the resulting image with a checkboard of the colors color1 and color2 and renders it onto the destination image. ...

Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf. ...

Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf. ...

Utilities

Utility and miscellaneous convenience functions.

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.

Takes an existing pixbuf and adds an alpha channel to it. ...

Copies a rectangular area from src to dest. ...

Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixel format of the pixbuf. ...

Animations

Animated images.

The gdk-pixbuf library provides a simple mechanism to load and represent animations. ...

Accessor of the loop of the gdk-pixbuf-animation class. ...

Creates a new animation by loading it from a file. ...

Creates a new pixbuf animation by loading an image from an resource. ...

If an animation is really just a plain image, has only one frame, this function returns that image. ...

GdkPixbufLoader

Application-driven progressive image loading.

The gdk-pixbuf-loader class provides a way for applications to drive the process of loading an image, by letting them send the image data directly to the loader instead of having the loader read the data from a file. ...

Creates a new pixbuf loader object. ...

This will cause a pixbuf loader to parse the next count bytes of an image. ...

Causes the image to be scaled while it is loaded. ...

Queries the gdk-pixbuf object that a pixbuf loader is currently creating. ...

Queries the gdk-pixbuf-animation object that a pixbuf loader is currently creating. ...

Informs a pixbuf loader that no further writes with the gdk-pixbuf-loader-write function will occur, so that it can free its internal loading structures. ...

Module Interface

Extending GdkPixbuf.

A gdk-pixbuf-format structure contains information about the image format accepted by a module. ...

Obtains the available information about the image formats supported by the gdk-pixbuf API. ...

Returns the name of the image format. ...

Returns a description of the image format. ...

Returns the MIME types supported by the image format. ...

Returns the filename extensions typically used for files in the given image format. ...

Returns true if the save option specified by option is supported when saving a pixbuf using the module implementing the image format. ...

Returns whether pixbufs can be saved in the given image format. ...

Returns whether this image format is scalable. ...

Returns whether this image format is disabled. ...

Disables or enables an image format. ...

Returns information about the license of the image loader for the image format. ...

Exported Symbol Index

+gdk-pixbuf-major-version+, Constant
+gdk-pixbuf-micro-version+, Constant
+gdk-pixbuf-minor-version+, Constant
+gdk-pixbuf-version+, Constant
gdk-colorspace, GEnum
gdk-interp-type, GEnum
gdk-pixbuf, Class
gdk-pixbuf-add-alpha, Function
gdk-pixbuf-animation, Class
gdk-pixbuf-animation-loop, Accessor
gdk-pixbuf-animation-new-from-file, Function
gdk-pixbuf-animation-new-from-resource, Function
gdk-pixbuf-animation-static-image, Function
gdk-pixbuf-bits-per-sample, Accessor
gdk-pixbuf-byte-length, Function
gdk-pixbuf-colorspace, Accessor
gdk-pixbuf-composite, Function
gdk-pixbuf-composite-color, Function
gdk-pixbuf-composite-color-simple, Function
gdk-pixbuf-copy, Function
gdk-pixbuf-copy-area, Function
gdk-pixbuf-copy-options, Function
gdk-pixbuf-file-info, Function
gdk-pixbuf-fill, Function
gdk-pixbuf-flip, Function
gdk-pixbuf-format, CStruct
gdk-pixbuf-format-description, Function
gdk-pixbuf-format-extensions, Function
gdk-pixbuf-format-is-disabled, Function
gdk-pixbuf-format-is-save-option-supported, Function
gdk-pixbuf-format-is-scalable, Function
gdk-pixbuf-format-is-writable, Function
gdk-pixbuf-format-license, Function
gdk-pixbuf-format-mime-types, Function
gdk-pixbuf-format-name, Function
gdk-pixbuf-format-set-disabled, Function
gdk-pixbuf-formats, Function
gdk-pixbuf-has-alpha, Accessor
gdk-pixbuf-height, Accessor
gdk-pixbuf-loader, Class
gdk-pixbuf-loader-animation, Function
gdk-pixbuf-loader-close, Function
gdk-pixbuf-loader-new, Function
gdk-pixbuf-loader-pixbuf, Function
gdk-pixbuf-loader-set-size, Function
gdk-pixbuf-loader-write, Function
gdk-pixbuf-n-channels, Accessor
gdk-pixbuf-new, Function
gdk-pixbuf-new-from-file, Function
gdk-pixbuf-new-from-file-at-scale, Function
gdk-pixbuf-new-from-file-at-size, Function
gdk-pixbuf-new-from-resource, Function
gdk-pixbuf-new-from-resource-at-scale, Function
gdk-pixbuf-new-subpixbuf, Function
gdk-pixbuf-option, Function
gdk-pixbuf-pixel-bytes, Accessor
gdk-pixbuf-pixels, Accessor
gdk-pixbuf-pixels-with-length, Function
gdk-pixbuf-read-pixels, Function
gdk-pixbuf-remove-option, Function
gdk-pixbuf-rotate-simple, Function
gdk-pixbuf-rotation, GEnum
gdk-pixbuf-rowstride, Accessor
gdk-pixbuf-save, Function
gdk-pixbuf-scale, Function
gdk-pixbuf-scale-simple, Function
gdk-pixbuf-width, Accessor