Function

CoglTexturenew_from_data

Declaration [src]

CoglTexture*
cogl_texture_new_from_data (
  int width,
  int height,
  CoglTextureFlags flags,
  CoglPixelFormat format,
  CoglPixelFormat internal_format,
  int rowstride,
  const uint8_t* data
)

Description [src]

Creates a new CoglTexture based on data residing in memory.

Available since:0.8
Deprecated since:1.18

Use specific constructors such as cogl_texture_2d_new_from_data()

Parameters

width int
 

Width of texture in pixels.

height int
 

Height of texture in pixels.

flags CoglTextureFlags
 

Optional flags for the texture, or COGL_TEXTURE_NONE.

format CoglPixelFormat
 

The CoglPixelFormat the buffer is stored in in RAM.

internal_format CoglPixelFormat
 

The CoglPixelFormat that will be used for storing the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a premultiplied format similar to the format of the source data will be used. The default blending equations of Cogl expect premultiplied color data; the main use of passing a non-premultiplied format here is if you have non-premultiplied source data and are going to adjust the blend mode (see cogl_material_set_blend()) or use the data for something other than straight blending.

rowstride int
 

The memory offset in bytes between the starts of scanlines in data.

data An array of uint8_t
 

Pointer the memory region where the source buffer resides.

 The data is owned by the caller of the function.

Return value

Returns: CoglTexture
 

A newly created CoglTexture or NULL on failure.

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