AtlasTexture.from_data


Description:

public AtlasTexture.from_data (Context ctx, int width, int height, PixelFormat format, int rowstride, uint8 data) throws Error

Creates a new AtlasTexture texture based on data residing in memory.

A AtlasTexture represents a sub-region within one of Cogl's shared texture atlases.

<note>This api will always immediately allocate GPU memory for the texture and upload the given data so that the data pointer does not need to remain valid once this function returns. This means it is not possible to configure the texture before it is allocated. If you do need to configure the texture before allocation (to specify constraints on the internal format for example) then you can instead create a Bitmap for your data and use AtlasTexture.from_bitmap or use AtlasTexture.with_size and then upload data using set_data</note>

<note>Allocate call can fail if Cogl considers the internal format to be incompatible with the format of its internal atlases.< /note>

<note>The returned AtlasTexture is a high-level meta-texture with some limitations. See the documentation for MetaTexture for more details.</note>

Parameters:

ctx

A Context

width

width of texture in pixels

height

height of texture in pixels

format

the PixelFormat the buffer is stored in in RAM

rowstride

the memory offset in bytes between the start of each row in data. A value of 0 will make Cogl automatically calculate rowstride from width and format.

data

pointer to the memory region where the source buffer resides

Returns:

A new AtlasTexture object or null on failure and throws will be updated.