Pixbuf.with_unowned_data


Description:

[ CCode ( cname = "gdk_pixbuf_new_from_data" , has_construct_function = false ) ]
public Pixbuf.with_unowned_data (uint8[] data, Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, PixbufDestroyNotify? destroy_fn = null)

Creates a new 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: [ctorGdkPixbuf.Pixbuf.new_from_bytes]

Parameters:

data

Image data in 8-bit/sample packed format

colorspace

Colorspace for the image data

has_alpha

Whether the data has an opacity channel

bits_per_sample

Number of bits per sample

width

Width of the image in pixels, must be > 0

height

Height of the image in pixels, must be > 0

rowstride

Distance in bytes between row starts

destroy_fn

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

destroy_fn_data

Closure data to pass to the destroy notification function

Returns:

A newly-created pixbuf