Bitmap.with_size


Description:

public Bitmap.with_size (Context context, uint width, uint height, PixelFormat format)

Creates a new Bitmap with the given width, height and format.

The initial contents of the bitmap are undefined.

The data for the bitmap will be stored in a newly created PixelBuffer. You can get a pointer to the pixel buffer using get_buffer. The Buffer API can then be used to fill the bitmap with data.

<note>Cogl will try its best to provide a hardware array you can map, write into and effectively do a zero copy upload when creating a texture from it with cogl_texture_new_from_bitmap. For various reasons, such arrays are likely to have a stride larger than width * bytes_per_pixel. The user must take the stride into account when writing into it. The stride can be retrieved with get_rowstride.</note>

Parameters:

context

A Context

width

width of the bitmap in pixels

height

height of the bitmap in pixels

format

the format of the pixels the array will store

Returns:

a PixelBuffer representing the newly created array or null on failure