gtk.graphics_offload

Module for [GraphicsOffload] class

Types 3

A widget that allows to bypass gsk rendering for its child by passing the content directly to the compositor.

Graphics offload is an optimization to reduce overhead and battery use that is most useful for video content. It only works on some platforms and in certain situations. GTK will automatically fall back to normal rendering if it doesn't.

Graphics offload is most efficient if there are no controls drawn on top of the video content.

You should consider using graphics offload for your main widget if it shows frequently changing content (such as a video, or a VM display) and you provide the content in the form of dmabuf textures (see gdk.dmabuf_texture_builder.DmabufTextureBuilder), in particular if it may be fullscreen.

Numerous factors can prohibit graphics offload:

  • Unsupported platforms. Currently, graphics offload only works on Linux with Wayland.
  • Clipping, such as rounded corners that cause the video content to not be rectangular
  • Unsupported dmabuf formats (see gdk.display.Display.getDmabufFormats)
  • Translucent video content (content with an alpha channel, even if it isn't used)
  • Transforms that are more complex than translations and scales
  • Filters such as opacity, grayscale or similar

To investigate problems related graphics offload, GTK offers debug flags to print out information about graphics offload and dmabuf use:

GDK_DEBUG=offload GDK_DEBUG=dmabuf

The GTK inspector provides a visual debugging tool for graphics offload.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
GraphicsOffload self() nothrowReturns `this`, for use in `with` statements.
GraphicsOffloadGidBuilder builder() static nothrowGet builder for [gtk.graphics_offload.GraphicsOffload] Returns: New builder object
gtk.widget.Widget child() @property nothrowGet `child` property. Returns: The child widget.
void child(gtk.widget.Widget propval) @property nothrowSet `child` property. Params: propval = The child widget.
gtk.types.GraphicsOffloadEnabled enabled() @property nothrowGet `enabled` property. Returns: Whether graphics offload is enabled.
void enabled(gtk.types.GraphicsOffloadEnabled propval) @property nothrowSet `enabled` property. Params: propval = Whether graphics offload is enabled.
gtk.widget.Widget getChild() nothrowGets the child of self. Returns: the child widget
gtk.types.GraphicsOffloadEnabled getEnabled() nothrowReturns whether offload is enabled for self. Returns: whether offload is enabled
void setChild(gtk.widget.Widget child = null) nothrowSets the child of self.
void setEnabled(gtk.types.GraphicsOffloadEnabled enabled) nothrowSets whether this GtkGraphicsOffload widget will attempt to offload the content of its child widget.
Constructors
this(void * ptr, Flag!"Take" take)
this(gtk.widget.Widget child = null)Creates a new GtkGraphicsOffload widget.

Fluent builder implementation template for gtk.graphics_offload.GraphicsOffload

Methods
T child(gtk.widget.Widget propval) nothrowSet `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chaining
T enabled(gtk.types.GraphicsOffloadEnabled propval) nothrowSet `enabled` property. Params: propval = Whether graphics offload is enabled. Returns: Builder instance for fluent chaining
Methods
GraphicsOffload build() nothrowCreate object from builder. Returns: New object