Cogl.SubTexture.new
function new(ctx: Cogl.Context, parent_texture: Cogl.Texture, sub_x: Number(gint), sub_y: Number(gint), sub_width: Number(gint), sub_height: Number(gint)): Cogl.SubTexture { // Gjs wrapper for cogl_sub_texture_new() }
Creates a high-level Cogl.SubTexture representing a sub-region of any other Cogl.Texture. The sub-region must strictly lye within the bounds of the parent_texture. The returned texture implements the Cogl.MetaTexture interface because it's not a low level texture that hardware can understand natively.
<note>Remember: Unless you are using high level drawing APIs such as cogl_rectangle() or other APIs documented to understand the Cogl.MetaTexture interface then you need to use the Cogl.MetaTexture interface to resolve a Cogl.SubTexture into a low-level texture before drawing.</note>
Since 1.10
- ctx
A Cogl.Context pointer
- parent_texture
The full texture containing a sub-region you want to make a Cogl.SubTexture 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 Cogl.SubTexture representing a sub-region of parent_texture.