Method

CoglFramebufferread_pixels_into_bitmap

Declaration [src]

gboolean
cogl_framebuffer_read_pixels_into_bitmap (
  CoglFramebuffer* framebuffer,
  int x,
  int y,
  CoglReadPixelsFlags source,
  CoglBitmap* bitmap
)

Description [src]

This reads a rectangle of pixels from the given framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and a rectangle of pixels with the same size as the bitmap is read right and downwards from that point.

Currently Cogl assumes that the framebuffer is in a premultiplied format so if the format of bitmap is non-premultiplied it will convert it. To read the pixel values without any conversion you should either specify a format that doesn’t use an alpha channel or use one of the formats ending in PRE.

If bitmap only allows write access, Cogl may use temporary storage to flip or convert the pixels before writing them to bitmap.

Parameters

x

Type: int

The x position to read from.

y

Type: int

The y position to read from.

source

Type: CoglReadPixelsFlags

Identifies which auxiliary buffer you want to read (only COGL_READ_PIXELS_COLOR_BUFFER supported currently).

bitmap

Type: CoglBitmap

The bitmap to store the results in.

The data is owned by the caller of the method.

Return value

Type: gboolean

TRUE if the read succeeded or FALSE otherwise. The function is only likely to fail if the bitmap points to a pixel buffer and it could not be mapped.