### Method

# Cogl Texture get_data

#### Declaration [src]

    int
    cogl_texture_get_data (
      CoglTexture* texture,
      CoglPixelFormat format,
      unsigned int rowstride,
      uint8_t* data
    )

#### Description [src]

Copies the pixel data from a cogl texture to system memory.

Don’t pass the value of `cogl_texture_get_rowstride()` as the `rowstride` argument, the rowstride should be the rowstride you want for the destination `data` buffer not the rowstride of the source texture.

#### Parameters

`format`

  Type: `CoglPixelFormat`

  The `CoglPixelFormat` to store the texture as.

`rowstride`

  Type: `unsigned int`

  The rowstride of `data` in bytes or pass 0 to calculate from the bytes-per-pixel of `format` multiplied by the `texture` width.

`data`

  Type: An array of `uint8_t`

  Memory location to write the `texture`‘s contents, or `NULL` to only query the data size through the return value.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

#### Return value

Type: `int`

The size of the texture data in bytes.