Cogl.Framebuffer.prototype.read_pixels
function read_pixels(x: Number(gint), y: Number(gint), width: Number(gint), height: Number(gint), format: Cogl.PixelFormat, pixels: Number(guint8)): Cogl.Bool { // Gjs wrapper for cogl_framebuffer_read_pixels() }
This is a convenience wrapper around Cogl.Framebuffer.prototype.read_pixels_into_bitmap which allocates a temporary Cogl.Bitmap to read pixel data directly into the given buffer. The rowstride of the buffer is assumed to be the width of the region times the bytes per pixel of the format. The source for the data is always taken from the color buffer. If you want to use any other rowstride or source, please use the Cogl.Framebuffer.prototype.read_pixels_into_bitmap function directly.
The implementation of the function looks like this:
|[ bitmap = cogl_bitmap_new_for_data (context, width, height, format, /<!-- -->* rowstride *<!-- -->/ bpp * width, pixels); cogl_framebuffer_read_pixels_into_bitmap (framebuffer, x, y, COGL_READ_PIXELS_COLOR_BUFFER, bitmap); cogl_object_unref (bitmap); ]|
Since 1.10
- x
The x position to read from
- y
The y position to read from
- width
The width of the region of rectangles to read
- height
The height of the region of rectangles to read
- format
The pixel format to store the data in
- pixels
The address of the buffer to store the data in
- Returns
true if the read succeeded or false otherwise.