### Constructor

# Cogl Bitmap new_for_data

#### Declaration [src]

    CoglBitmap*
    cogl_bitmap_new_for_data (
      CoglContext* context,
      int width,
      int height,
      CoglPixelFormat format,
      int rowstride,
      uint8_t* data
    )

#### Description [src]

Creates a bitmap using some existing data. The data is not copied so the application must keep the buffer alive for the lifetime of the `CoglBitmap`. This can be used for example with `cogl_framebuffer_read_pixels_into_bitmap()` to read data directly into an application buffer with the specified rowstride.

#### Parameters

`context`

  Type: `CoglContext`

  A `CoglContext`.

  The data is owned by the caller of the function.

`width`

  Type: `int`

  The width of the bitmap.

`height`

  Type: `int`

  The height of the bitmap.

`format`

  Type: `CoglPixelFormat`

  The format of the pixel data.

`rowstride`

  Type: `int`

  The rowstride of the bitmap (the number of bytes from the start of one row of the bitmap to the next).

`data`

  Type: An array of `uint8_t`

  A pointer to the data. The bitmap will take ownership of this data.

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

#### Return value

Type: `CoglBitmap`

A new `CoglBitmap`.

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