Sub Textures

## Sub Textures Sub Textures — Functions for creating and manipulating sub-textures. |

## Functions

CoglSubTexture * | cogl_sub_texture_new ()
CoglBool | cogl_is_sub_texture ()

## Types and Values

| CoglSubTexture

## Description

These functions allow high-level textures to be created that represent a sub-region of another texture. For example these can be used to implement custom texture atlasing schemes.

## Functions

### cogl_sub_texture_new ()

    CoglSubTexture *
    cogl_sub_texture_new (CoglContext *ctx,
                          CoglTexture *parent_texture,
                          int sub_x,
                          int sub_y,
                          int sub_width,
                          int sub_height);

Creates a high-level CoglSubTexture representing a sub-region of any other CoglTexture. The sub-region must strictly lye within the bounds of the `parent_texture` . The returned texture implements the CoglMetaTexture interface because it's not a low level texture that hardware can understand natively.

Remember: Unless you are using high level drawing APIs such as `cogl_rectangle()` or other APIs documented to understand the CoglMetaTexture interface then you need to use the CoglMetaTexture interface to resolve a CoglSubTexture into a low-level texture before drawing.

#### Parameters

ctx | A CoglContext pointer |
parent_texture | The full texture containing a sub-region you want to make a CoglSubTexture from. |
sub_x | The top-left x coordinate of the parent region to make a texture from. |
sub_y | The top-left y coordinate of the parent region to make a texture from. |
sub_width | The width of the parent region to make a texture from. |
sub_height | The height of the parent region to make a texture from. |

#### Returns

A newly allocated CoglSubTexture representing a sub-region of `parent_texture` .

[transfer full]

Since 1.10

Stability Level: Unstable

### cogl_is_sub_texture ()

    CoglBool
    cogl_is_sub_texture (void *object);

Checks whether `object` is a CoglSubTexture.

#### Parameters

object | a CoglObject |

#### Returns

`TRUE` if the passed `object` represents a CoglSubTexture and `FALSE` otherwise.

Since 1.10

Stability Level: Unstable

## Types and Values

### CoglSubTexture

    typedef struct _CoglSubTexture CoglSubTexture;