Gdk.MemoryTextureBuilder

g GObject.Object GObject.Object Gdk.MemoryTextureBuilder Gdk.MemoryTextureBuilder GObject.Object->Gdk.MemoryTextureBuilder

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

build ()

get_bytes ()

get_color_state ()

get_format ()

get_height ()

get_offset (plane)

get_stride ()

get_stride_for_plane (plane)

get_update_region ()

get_update_texture ()

get_width ()

set_bytes (bytes)

set_color_state (color_state)

set_format (format)

set_height (height)

set_offset (plane, offset)

set_stride (stride)

set_stride_for_plane (plane, stride)

set_update_region (region)

set_update_texture (texture)

set_width (width)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

bytes

GLib.Bytes

r/w/en

color-state

Gdk.ColorState

r/w/en

format

Gdk.MemoryFormat

r/w/en

height

int

r/w/en

stride

int

r/w/en

update-region

cairo.Region

r/w/en

update-texture

Gdk.Texture

r/w/en

width

int

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gdk.MemoryTextureBuilder(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gdk.MemoryTextureBuilderClass

Constructs [class`Gdk`.Texture] objects from system memory provided via [struct`GLib`.Bytes].

The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that the properties [property`Gdk`.MemoryTextureBuilder:bytes], [property`Gdk`.MemoryTextureBuilder:stride], [property`Gdk`.MemoryTextureBuilder:width], and [property`Gdk`.MemoryTextureBuilder:height] are mandatory - and then call [method`Gdk`.MemoryTextureBuilder.build] to create the new texture.

GdkMemoryTextureBuilder can be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.

Added in version 4.16.

classmethod new()[source]
Returns:

the new GdkTextureBuilder

Return type:

Gdk.MemoryTextureBuilder

Creates a new texture builder.

Added in version 4.16.

build()[source]
Returns:

a newly built GdkTexture

Return type:

Gdk.Texture

Builds a new GdkTexture with the values set up in the builder.

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.

Added in version 4.16.

get_bytes()[source]
Returns:

The bytes

Return type:

GLib.Bytes or None

Gets the bytes previously set via Gdk.MemoryTextureBuilder.set_bytes() or None if none was set.

Added in version 4.16.

get_color_state()[source]
Returns:

The colorstate

Return type:

Gdk.ColorState

Gets the colorstate previously set via Gdk.MemoryTextureBuilder.set_color_state().

Added in version 4.16.

get_format()[source]
Returns:

The format

Return type:

Gdk.MemoryFormat

Gets the format previously set via Gdk.MemoryTextureBuilder.set_format().

Added in version 4.16.

get_height()[source]
Returns:

The height

Return type:

int

Gets the height previously set via Gdk.MemoryTextureBuilder.set_height() or 0 if the height wasn’t set.

Added in version 4.16.

get_offset(plane)[source]
Parameters:

plane (int) – a plane

Returns:

The offset associated to a plane

Return type:

int

Gets the offset previously set via Gdk.MemoryTextureBuilder.set_offset().

Added in version 4.20.

get_stride()[source]
Returns:

the stride

Return type:

int

Gets the stride previously set via Gdk.MemoryTextureBuilder.set_stride().

Added in version 4.16.

get_stride_for_plane(plane)[source]
Parameters:

plane (int) – a plane

Returns:

The stride associated to a plane

Return type:

int

Gets the stride previously set via Gdk.MemoryTextureBuilder.set_stride_for_plane().

Added in version 4.20.

get_update_region()[source]
Returns:

The update region

Return type:

cairo.Region or None

Gets the region previously set via Gdk.MemoryTextureBuilder.set_update_region() or None if none was set.

Added in version 4.16.

get_update_texture()[source]
Returns:

The update texture

Return type:

Gdk.Texture or None

Gets the texture previously set via Gdk.MemoryTextureBuilder.set_update_texture() or None if none was set.

Added in version 4.16.

get_width()[source]
Returns:

The width

Return type:

int

Gets the width previously set via Gdk.MemoryTextureBuilder.set_width() or 0 if the width wasn’t set.

Added in version 4.16.

set_bytes(bytes)[source]
Parameters:

bytes (GLib.Bytes or None) – The bytes the texture shows or None to unset

Sets the data to be shown but the texture.

The bytes must be set before calling [method`Gdk`.MemoryTextureBuilder.build].

Added in version 4.16.

set_color_state(color_state)[source]
Parameters:

color_state (Gdk.ColorState) – The colorstate describing the data

Sets the colorstate describing the data.

By default, the sRGB colorstate is used. If you don’t know what colorstates are, this is probably the right thing.

Added in version 4.16.

set_format(format)[source]
Parameters:

format (Gdk.MemoryFormat) – The texture’s format

Sets the format of the bytes.

The default is GDK_MEMORY_R8G8B8A8_PREMULTIPLIED.

Added in version 4.16.

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`.MemoryTextureBuilder.build] and conform to size requirements of the provided format.

Added in version 4.16.

set_offset(plane, offset)[source]
Parameters:
  • plane (int) – a plane

  • offset (int) – the texture’s offset for plane

Sets the offset of the texture for plane.

Added in version 4.20.

set_stride(stride)[source]
Parameters:

stride (int) – the stride or 0 to unset

Sets the rowstride of the bytes used.

The rowstride must be set before calling [method`Gdk`.MemoryTextureBuilder.build].

Added in version 4.16.

set_stride_for_plane(plane, stride)[source]
Parameters:
  • plane (int) – a plane

  • stride (int) – the texture’s stride for plane

Sets the stride of the texture for plane.

Added in version 4.20.

set_update_region(region)[source]
Parameters:

region (cairo.Region or None) – the region to update

Sets the region to be updated by this texture.

Together with [property`Gdk`.MemoryTextureBuilder: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.

Added in version 4.16.

set_update_texture(texture)[source]
Parameters:

texture (Gdk.Texture or None) – the texture to update

Sets the texture to be updated by this texture.

See [method`Gdk`.MemoryTextureBuilder.set_update_region] for an explanation.

Added in version 4.16.

set_width(width)[source]
Parameters:

width (int) – The texture’s width or 0 to unset

Sets the width of the texture.

The width must be set before calling [method`Gdk`.MemoryTextureBuilder.build] and conform to size requirements of the provided format.

Added in version 4.16.

Property Details

Gdk.MemoryTextureBuilder.props.bytes
Name:

bytes

Type:

GLib.Bytes

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The bytes holding the data.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.color_state
Name:

color-state

Type:

Gdk.ColorState

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The colorstate describing the data.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.format
Name:

format

Type:

Gdk.MemoryFormat

Default Value:

Gdk.MemoryFormat.R8G8B8A8_PREMULTIPLIED

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The format of the data.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.height
Name:

height

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The height of the texture.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.stride
Name:

stride

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The rowstride of the texture.

The rowstride is the number of bytes between the first pixel in a row of image data, and the first pixel in the next row.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.update_region
Name:

update-region

Type:

cairo.Region

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The update region for [property`Gdk`.MemoryTextureBuilder:update-texture].

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.update_texture
Name:

update-texture

Type:

Gdk.Texture

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The texture [property`Gdk`.MemoryTextureBuilder:update-region] is an update for.

Added in version 4.16.

Gdk.MemoryTextureBuilder.props.width
Name:

width

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The width of the texture.

Added in version 4.16.