:right-sidebar: True DmabufTextureBuilder =================================================================== .. currentmodule:: gi.repository.Gdk .. versionadded:: 4.14 .. class:: DmabufTextureBuilder(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: DmabufTextureBuilder(**properties) new() -> Gdk.DmabufTextureBuilder Constructors ------------ .. rst-class:: interim-class .. class:: DmabufTextureBuilder :no-index: .. classmethod:: new() -> ~gi.repository.Gdk.DmabufTextureBuilder Creates a new texture builder. .. versionadded:: 4.14 Methods ------- .. rst-class:: interim-class .. class:: DmabufTextureBuilder :no-index: .. method:: build(destroy: ~typing.Callable[[None], None] | None, data: None) -> ~gi.repository.Gdk.Texture | None Builds a new ``GdkTexture`` with the values set up in the builder. It is a programming error to call this function if any mandatory property has not been set. If the dmabuf is not supported by GTK, :const:`None` will be returned and ``error`` will be set. The ``destroy`` function gets called when the returned texture gets released. It is possible to call this function multiple times to create multiple textures, possibly with changing properties in between. It is the responsibility of the caller to keep the file descriptors for the planes open until the created texture is no longer used, and close them afterwards (possibly using the ``destroy`` notify). Not all formats defined in the ``drm_fourcc.h`` header are supported. You can use :obj:`~gi.repository.Gdk.Display.get_dmabuf_formats` to get a list of supported formats. .. versionadded:: 4.14 :param destroy: destroy function to be called when the texture is released :param data: user data to pass to the destroy function .. method:: get_display() -> ~gi.repository.Gdk.Display Returns the display that this texture builder is associated with. .. versionadded:: 4.14 .. method:: get_fd(plane: int) -> int Gets the file descriptor for a plane. .. versionadded:: 4.14 :param plane: the plane to get the fd for .. method:: get_fourcc() -> int Gets the format previously set via :func:`~gi.repository.Gdk.DmabufTextureBuilder.set_fourcc` or 0 if the format wasn't set. The format is specified as a fourcc code. .. versionadded:: 4.14 .. method:: get_height() -> int Gets the height previously set via :func:`~gi.repository.Gdk.DmabufTextureBuilder.set_height` or 0 if the height wasn't set. .. versionadded:: 4.14 .. method:: get_modifier() -> int Gets the modifier value. .. versionadded:: 4.14 .. method:: get_n_planes() -> int Gets the number of planes. .. versionadded:: 4.14 .. method:: get_offset(plane: int) -> int Gets the offset value for a plane. .. versionadded:: 4.14 :param plane: the plane to get the offset for .. method:: get_premultiplied() -> bool Whether the data is premultiplied. .. versionadded:: 4.14 .. method:: get_stride(plane: int) -> int Gets the stride value for a plane. .. versionadded:: 4.14 :param plane: the plane to get the stride for .. method:: get_update_region() -> ~gi.repository.cairo.Region | None Gets the region previously set via :func:`~gi.repository.Gdk.DmabufTextureBuilder.set_update_region` or :const:`None` if none was set. .. versionadded:: 4.14 .. method:: get_update_texture() -> ~gi.repository.Gdk.Texture | None Gets the texture previously set via :func:`~gi.repository.Gdk.DmabufTextureBuilder.set_update_texture` or :const:`None` if none was set. .. versionadded:: 4.14 .. method:: get_width() -> int Gets the width previously set via :func:`~gi.repository.Gdk.DmabufTextureBuilder.set_width` or 0 if the width wasn't set. .. versionadded:: 4.14 .. method:: set_display(display: ~gi.repository.Gdk.Display) -> None Sets the display that this texture builder is associated with. The display is used to determine the supported dma-buf formats. .. versionadded:: 4.14 :param display: the display .. method:: set_fd(plane: int, fd: int) -> None Sets the file descriptor for a plane. .. versionadded:: 4.14 :param plane: the plane to set the fd for :param fd: the file descriptor .. method:: set_fourcc(fourcc: int) -> None Sets the format of the texture. The format is specified as a fourcc code. The format must be set before calling :obj:`~gi.repository.Gdk.GLTextureBuilder.build`. .. versionadded:: 4.14 :param fourcc: the texture's format or 0 to unset .. method:: set_height(height: int) -> None Sets the height of the texture. The height must be set before calling :obj:`~gi.repository.Gdk.GLTextureBuilder.build`. .. versionadded:: 4.14 :param height: the texture's height or 0 to unset .. method:: set_modifier(modifier: int) -> None Sets the modifier. .. versionadded:: 4.14 :param modifier: the modifier value .. method:: set_n_planes(n_planes: int) -> None Sets the number of planes of the texture. .. versionadded:: 4.14 :param n_planes: the number of planes .. method:: set_offset(plane: int, offset: int) -> None Sets the offset for a plane. .. versionadded:: 4.14 :param plane: the plane to set the offset for :param offset: the offset value .. method:: set_premultiplied(premultiplied: bool) -> None Sets whether the data is premultiplied. Unless otherwise specified, all formats including alpha channels are assumed to be premultiplied. .. versionadded:: 4.14 :param premultiplied: whether the data is premultiplied .. method:: set_stride(plane: int, stride: int) -> None Sets the stride for a plane. The stride must be set for all planes before calling :obj:`~gi.repository.Gdk.GLTextureBuilder.build`. .. versionadded:: 4.14 :param plane: the plane to set the stride for :param stride: the stride value .. 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.DmabufTextureBuilder.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.14 :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.DmabufTextureBuilder.set_update_region` for an explanation. .. versionadded:: 4.14 :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.GLTextureBuilder.build`. .. versionadded:: 4.14 :param width: The texture's width or 0 to unset Properties ---------- .. rst-class:: interim-class .. class:: DmabufTextureBuilder :no-index: .. attribute:: props.display :type: ~gi.repository.Gdk.Display The display that this texture will be used on. .. versionadded:: 4.14 .. attribute:: props.fourcc :type: int The format of the texture, as a fourcc value. .. versionadded:: 4.14 .. attribute:: props.height :type: int The height of the texture. .. versionadded:: 4.14 .. attribute:: props.modifier :type: int The modifier. .. versionadded:: 4.14 .. attribute:: props.n_planes :type: int The number of planes of the texture. Note that you can set properties for other planes, but they will be ignored when constructing the texture. .. versionadded:: 4.14 .. attribute:: props.premultiplied :type: bool Whether the alpha channel is premultiplied into the others. Only relevant if the format has alpha. .. versionadded:: 4.14 .. attribute:: props.update_region :type: ~gi.repository.cairo.Region The update region for :obj:`~gi.repository.Gdk.GLTextureBuilder.props.update_texture`. .. versionadded:: 4.14 .. attribute:: props.update_texture :type: ~gi.repository.Gdk.Texture The texture :obj:`~gi.repository.Gdk.DmabufTextureBuilder.props.update_region` is an update for. .. versionadded:: 4.14 .. attribute:: props.width :type: int The width of the texture. .. versionadded:: 4.14