### Method

# Cogl Framebuffer read_pixels

#### Declaration [src]

    gboolean
    cogl_framebuffer_read_pixels (
      CoglFramebuffer* framebuffer,
      int x,
      int y,
      int width,
      int height,
      CoglPixelFormat format,
      uint8_t* pixels
    )

#### Description [src]

This is a convenience wrapper around `cogl_framebuffer_read_pixels_into_bitmap()` which allocates a temporary `CoglBitmap` 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_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);

#### Parameters

`x`

  Type: `int`

  The x position to read from.

`y`

  Type: `int`

  The y position to read from.

`width`

  Type: `int`

  The width of the region of rectangles to read.

`height`

  Type: `int`

  The height of the region of rectangles to read.

`format`

  Type: `CoglPixelFormat`

  The pixel format to store the data in.

`pixels`

  Type: `uint8_t*`

  The address of the buffer to store the data in.

  The data is owned by the caller of the function.

#### Return value

Type: `gboolean`

`TRUE` if the read succeeded or `FALSE` otherwise.