:right-sidebar: True MemoryTextureBuilder =================================================================== .. currentmodule:: gi.repository.Gdk .. versionadded:: 4.16 .. class:: MemoryTextureBuilder(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` ``GdkMemoryTextureBuilder`` is a builder used to construct :obj:`~gi.repository.Gdk.Texture` objects from system memory provided via :obj:`~gi.repository.GLib.Bytes`\. The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that the properties :obj:`~gi.repository.Gdk.MemoryTextureBuilder.props.bytes`\, :obj:`~gi.repository.Gdk.MemoryTextureBuilder.props.stride`\, :obj:`~gi.repository.Gdk.MemoryTextureBuilder.props.width`\, and :obj:`~gi.repository.Gdk.MemoryTextureBuilder.props.height` are mandatory - and then call :obj:`~gi.repository.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. Constructors ------------ .. rst-class:: interim-class .. class:: MemoryTextureBuilder :no-index: .. classmethod:: new() -> ~gi.repository.Gdk.MemoryTextureBuilder Creates a new texture builder. .. versionadded:: 4.16 Methods ------- .. rst-class:: interim-class .. class:: MemoryTextureBuilder :no-index: .. method:: build() -> ~gi.repository.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. .. versionadded:: 4.16 .. method:: get_bytes() -> ~gi.repository.GLib.Bytes | None Gets the bytes previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_bytes` or :const:`None` if none was set. .. versionadded:: 4.16 .. method:: get_color_state() -> ~gi.repository.Gdk.ColorState Gets the colorstate previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_color_state`. .. versionadded:: 4.16 .. method:: get_format() -> ~gi.repository.Gdk.MemoryFormat Gets the format previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_format`. .. versionadded:: 4.16 .. method:: get_height() -> int Gets the height previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_height` or 0 if the height wasn't set. .. versionadded:: 4.16 .. method:: get_stride() -> int Gets the stride previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_stride`. .. versionadded:: 4.16 .. method:: get_update_region() -> ~gi.repository.cairo.Region | None Gets the region previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_update_region` or :const:`None` if none was set. .. versionadded:: 4.16 .. method:: get_update_texture() -> ~gi.repository.Gdk.Texture | None Gets the texture previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_update_texture` or :const:`None` if none was set. .. versionadded:: 4.16 .. method:: get_width() -> int Gets the width previously set via :func:`~gi.repository.Gdk.MemoryTextureBuilder.set_width` or 0 if the width wasn't set. .. versionadded:: 4.16 .. method:: set_bytes(bytes: ~gi.repository.GLib.Bytes | None = None) -> None Sets the data to be shown but the texture. The bytes must be set before calling :obj:`~gi.repository.Gdk.MemoryTextureBuilder.build`\. .. versionadded:: 4.16 :param bytes: The bytes the texture shows or :const:`None` to unset .. method:: set_color_state(color_state: ~gi.repository.Gdk.ColorState | None = None) -> None 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. .. versionadded:: 4.16 :param color_state: The colorstate describing the data .. method:: set_format(format: ~gi.repository.Gdk.MemoryFormat) -> None Sets the format of the bytes. The default is ``GDK_MEMORY_R8G8B8A8_PREMULTIPLIED``\. .. versionadded:: 4.16 :param format: The texture's format .. method:: set_height(height: int) -> None Sets the height of the texture. The height must be set before calling :obj:`~gi.repository.Gdk.MemoryTextureBuilder.build`\. .. versionadded:: 4.16 :param height: The texture's height or 0 to unset .. method:: set_stride(stride: int) -> None Sets the rowstride of the bytes used. The rowstride must be set before calling :obj:`~gi.repository.Gdk.MemoryTextureBuilder.build`\. .. versionadded:: 4.16 :param stride: the stride or 0 to unset .. method:: set_update_region(region: ~gi.repository.cairo.Region | None = None) -> None Sets the region to be updated by this texture. Together with :obj:`~gi.repository.Gdk.MemoryTextureBuilder.props.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. .. versionadded:: 4.16 :param region: the region to update .. method:: set_update_texture(texture: ~gi.repository.Gdk.Texture | None = None) -> None Sets the texture to be updated by this texture. See :obj:`~gi.repository.Gdk.MemoryTextureBuilder.set_update_region` for an explanation. .. versionadded:: 4.16 :param texture: the texture to update .. method:: set_width(width: int) -> None Sets the width of the texture. The width must be set before calling :obj:`~gi.repository.Gdk.MemoryTextureBuilder.build`\. .. versionadded:: 4.16 :param width: The texture's width or 0 to unset Properties ---------- .. rst-class:: interim-class .. class:: MemoryTextureBuilder :no-index: .. attribute:: props.bytes :type: ~gi.repository.GLib.Bytes The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.color_state :type: ~gi.repository.Gdk.ColorState The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.format :type: ~gi.repository.Gdk.MemoryFormat The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.height :type: int The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.stride :type: int The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.update_region :type: ~gi.repository.cairo.Region The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.update_texture :type: ~gi.repository.Gdk.Texture The type of the None singleton. .. versionadded:: 4.16 .. attribute:: props.width :type: int The type of the None singleton. .. versionadded:: 4.16