Cogl.Bitmap.new_with_size
function new_with_size(context: Cogl.Context, width: Number(guint), height: Number(guint), format: Cogl.PixelFormat): Cogl.Bitmap { // Gjs wrapper for cogl_bitmap_new_with_size() }
Creates a new Cogl.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 Cogl.PixelBuffer. You can get a pointer to the pixel buffer using Cogl.Bitmap.prototype.get_buffer. The Cogl.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 Cogl.Bitmap.prototype.get_rowstride.</note>
Since 1.10
- 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 Cogl.PixelBuffer representing the newly created array or null on failure