Creates a new gdk.Pixbuf out of in-memory image data. Currently only RGB images with 8 bits per sample are supported.

Since you are providing a pre-allocated pixel buffer, you must also specify a way to free that data. This is done with a function of type GdkPixbufDestroyNotify When a pixbuf created with is finalized, your destroy notification function will be called, and it is its responsibility to free the pixel array.

See also Pixbuf.newFromBytes.


data char[]

Image data in 8-bit/sample packed format

colorspace GdkColorspace

Colorspace for the image data

hasAlpha bool

Whether the data has an opacity channel

bitsPerSample int

Number of bits per sample

width int

Width of the image in pixels, must be > 0

height int

Height of the image in pixels, must be > 0

rowstride int

Distance in bytes between row starts

destroyFn GdkPixbufDestroyNotify

Function used to free the data when the pixbuf's reference count drops to zero, or NULL if the data should not be freed

destroyFnData void*

Closure data to pass to the destroy notification function

Return Value

A newly-created gdk.Pixbuf structure with a reference count of 1.


ConstructionException GTK+ fails to create the object.