Declaration [src]

cogl_bitmap_new_with_size (
  CoglContext* context,
  unsigned int width,
  unsigned int height,
  CoglPixelFormat format

Description [src]

Creates a new CoglBitmap 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 CoglPixelBuffer. You can get a pointer to the pixel buffer using cogl_bitmap_get_buffer(). The CoglBuffer API can then be used to fill the bitmap with data.

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 cogl_bitmap_get_rowstride().



Type: CoglContext

A CoglContext.

The data is owned by the caller of the function.

Type: unsigned int

Width of the bitmap in pixels.


Type: unsigned int

Height of the bitmap in pixels.


Type: CoglPixelFormat

The format of the pixels the array will store.

Return value

Type: CoglBitmap

A CoglPixelBuffer representing the newly created array or NULL on failure.

The caller of the function takes ownership of the data, and is responsible for freeing it.