### Constructor

# Cogl PixelBuffer new

#### Declaration [src]

    CoglPixelBuffer*
    cogl_pixel_buffer_new (
      CoglContext* context,
      size_t size,
      void* data
    )

#### Description [src]

Declares a new `CoglPixelBuffer` of `size` bytes to contain arrays of pixels. Once declared, data can be set using `cogl_buffer_set_data()` or by mapping it into the application’s address space using cogl_buffer_map().

If `data` isn’t `NULL` then `size` bytes will be read from `data` and immediately copied into the new buffer.

#### Parameters

`context`

  Type: `CoglContext`

  A `CoglContext`.

  The data is owned by the caller of the function.

`size`

  Type: `size_t`

  The number of bytes to allocate for the pixel data.

`data`

  Type: An array of `guint8`

  An optional pointer to vertex data to upload immediately.

  The length of the array is specified in the `size` argument.
  The data is owned by the caller of the function.

#### Return value

Type: `CoglPixelBuffer`

A newly allocated `CoglPixelBuffer`.

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