Gdk.GLTextureBuilder¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gdk.GLTextureBuilder(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Constructs [class`Gdk`.Texture] objects from GL textures.
The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that the properties [property`Gdk`.GLTextureBuilder:context], [property`Gdk`.GLTextureBuilder:id], [property`Gdk`.GLTextureBuilder:width], and [property`Gdk`.GLTextureBuilder:height] are mandatory - and then call [method`Gdk`.GLTextureBuilder.build] to create the new texture.
GdkGLTextureBuildercan be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.New in version 4.12.
- classmethod new()[source]¶
- Returns:
the new
GdkTextureBuilder- Return type:
Creates a new texture builder.
New in version 4.12.
- build(destroy, data)[source]¶
- Parameters:
destroy (
GLib.DestroyNotifyorNone) – destroy function to be called when the texture is releaseddata (
objectorNone) – user data to pass to the destroy function
- Returns:
a newly built
GdkTexture- Return type:
Builds a new
GdkTexturewith the values set up in the builder.The
destroyfunction gets called when the returned texture gets released; either when the texture is finalized or by an explicit call to [method`Gdk`.GLTexture.release]. It should release all GL resources associated with the texture, such as the [property`Gdk`.GLTextureBuilder:id] and the [property`Gdk`.GLTextureBuilder:sync].Note that it is a programming error to call this function if any mandatory property has not been set.
It is possible to call this function multiple times to create multiple textures, possibly with changing properties in between.
New in version 4.12.
- get_color_state()[source]¶
- Returns:
the color state
- Return type:
Gets the color state previously set via
Gdk.GLTextureBuilder.set_color_state().New in version 4.16.
- get_context()[source]¶
- Returns:
The context
- Return type:
Gets the context previously set via
Gdk.GLTextureBuilder.set_context() orNoneif none was set.New in version 4.12.
- get_format()[source]¶
- Returns:
The format
- Return type:
Gets the format previously set via
Gdk.GLTextureBuilder.set_format().New in version 4.12.
- get_has_mipmap()[source]¶
- Returns:
Whether the texture has a mipmap
- Return type:
Gets whether the texture has a mipmap.
New in version 4.12.
- get_height()[source]¶
- Returns:
The height
- Return type:
Gets the height previously set via
Gdk.GLTextureBuilder.set_height() or 0 if the height wasn’t set.New in version 4.12.
- get_id()[source]¶
- Returns:
The id
- Return type:
Gets the texture id previously set via
Gdk.GLTextureBuilder.set_id() or 0 if the id wasn’t set.New in version 4.12.
- get_sync()[source]¶
-
Gets the
GLsyncpreviously set viaGdk.GLTextureBuilder.set_sync().New in version 4.12.
- get_update_region()[source]¶
- Returns:
The region
- Return type:
cairo.RegionorNone
Gets the region previously set via
Gdk.GLTextureBuilder.set_update_region() orNoneif none was set.New in version 4.12.
- get_update_texture()[source]¶
- Returns:
The texture
- Return type:
Gdk.TextureorNone
Gets the texture previously set via
Gdk.GLTextureBuilder.set_update_texture() orNoneif none was set.New in version 4.12.
- get_width()[source]¶
- Returns:
The width
- Return type:
Gets the width previously set via
Gdk.GLTextureBuilder.set_width() or 0 if the width wasn’t set.New in version 4.12.
- set_color_state(color_state)[source]¶
- Parameters:
color_state (
Gdk.ColorState) – aGdkColorState
Sets the color state for the texture.
By default, the sRGB colorstate is used. If you don’t know what colorstates are, this is probably the right thing.
New in version 4.16.
- set_context(context)[source]¶
- Parameters:
context (
Gdk.GLContextorNone) – The context the texture belongs to orNoneto unset
Sets the context to be used for the texture. This is the context that owns the texture.
The context must be set before calling [method`Gdk`.GLTextureBuilder.build].
New in version 4.12.
- set_format(format)[source]¶
- Parameters:
format (
Gdk.MemoryFormat) – The texture’s format
Sets the format of the texture. The default is
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED.The format is the preferred format the texture data should be downloaded to. The format must be supported by the GL version of [property`Gdk`.GLTextureBuilder:context].
GDK’s texture download code assumes that the format corresponds to the storage parameters of the GL texture in an obvious way. For example, a format of
GDK_MEMORY_R16G16B16A16_PREMULTIPLIEDis expected to be stored asGL_RGBA16texture, andGDK_MEMORY_G8A8is expected to be stored asGL_RG8texture.Setting the right format is particularly useful when using high bit depth textures to preserve the bit depth, to set the correct value for unpremultiplied textures and to make sure opaque textures are treated as such.
Non-RGBA textures need to have swizzling parameters set up properly to be usable in GSK’s shaders.
New in version 4.12.
- set_has_mipmap(has_mipmap)[source]¶
- Parameters:
has_mipmap (
bool) – Whether the texture has a mipmap
Sets whether the texture has a mipmap. This allows the renderer and other users of the generated texture to use a higher quality downscaling.
Typically, the
glGenerateMipmapfunction is used to generate a mimap.New in version 4.12.
- set_height(height)[source]¶
- Parameters:
height (
int) – The texture’s height or 0 to unset
Sets the height of the texture.
The height must be set before calling [method`Gdk`.GLTextureBuilder.build].
New in version 4.12.
- set_id(id)[source]¶
- Parameters:
id (
int) – The texture id to be used for creating the texture
Sets the texture id of the texture. The texture id must remain unmodified until the texture was finalized. See [method`Gdk`.GLTextureBuilder.build] for a longer discussion.
The id must be set before calling [method`Gdk`.GLTextureBuilder.build].
New in version 4.12.
- set_sync(sync)[source]¶
-
Sets the GLSync object to use for the texture.
GTK will wait on this object before using the created
GdkTexture.The
destroyfunction that is passed to [method`Gdk`.GLTextureBuilder.build] is responsible for freeing the sync object when it is no longer needed. The texture builder does not destroy it and it is the callers responsibility to make sure it doesn’t leak.New in version 4.12.
- set_update_region(region)[source]¶
- Parameters:
region (
cairo.RegionorNone) – the region to update
Sets the region to be updated by this texture. Together with [property`Gdk`.GLTextureBuilder:update-texture] this describes an update of a previous texture.
When rendering animations of large textures, it is possible that consecutive textures are only updating contents in parts of the texture. It is then possible to describe this update via these two properties, so that GTK can avoid rerendering parts that did not change.
An example would be a screen recording where only the mouse pointer moves.
New in version 4.12.
- set_update_texture(texture)[source]¶
- Parameters:
texture (
Gdk.TextureorNone) – the texture to update
Sets the texture to be updated by this texture. See [method`Gdk`.GLTextureBuilder.set_update_region] for an explanation.
New in version 4.12.
Property Details¶
- Gdk.GLTextureBuilder.props.color_state¶
- Name:
color-state- Type:
- Default Value:
- Flags:
The color state of the texture.
New in version 4.16.
- Gdk.GLTextureBuilder.props.context¶
- Name:
context- Type:
- Default Value:
- Flags:
The context owning the texture.
New in version 4.12.
- Gdk.GLTextureBuilder.props.format¶
- Name:
format- Type:
- Default Value:
- Flags:
The format when downloading the texture.
New in version 4.12.
- Gdk.GLTextureBuilder.props.has_mipmap¶
- Name:
has-mipmap- Type:
- Default Value:
- Flags:
If the texture has a mipmap.
New in version 4.12.
- Gdk.GLTextureBuilder.props.height¶
- Name:
height- Type:
- Default Value:
0- Flags:
The height of the texture.
New in version 4.12.
- Gdk.GLTextureBuilder.props.id¶
- Name:
id- Type:
- Default Value:
0- Flags:
The texture ID to use.
New in version 4.12.
- Gdk.GLTextureBuilder.props.sync¶
- Name:
sync- Type:
- Default Value:
- Flags:
An optional
GLSyncobject.If this is set, GTK will wait on it before using the texture.
New in version 4.12.
- Gdk.GLTextureBuilder.props.update_region¶
- Name:
update-region- Type:
- Default Value:
- Flags:
The update region for [property`Gdk`.GLTextureBuilder:update-texture].
New in version 4.12.
- Gdk.GLTextureBuilder.props.update_texture¶
- Name:
update-texture- Type:
- Default Value:
- Flags:
The texture [property`Gdk`.GLTextureBuilder:update-region] is an update for.
New in version 4.12.
- Gdk.GLTextureBuilder.props.width¶
- Name:
width- Type:
- Default Value:
0- Flags:
The width of the texture.
New in version 4.12.