pub trait GskRendererExt: IsA<Renderer> + Sealed + 'static {
    // Provided methods
    fn surface(&self) -> Option<Surface> { ... }
    fn is_realized(&self) -> bool { ... }
    fn realize(&self, surface: Option<&Surface>) -> Result<(), Error> { ... }
    fn render(&self, root: impl AsRef<RenderNode>, region: Option<&Region>) { ... }
    fn render_texture(
        &self,
        root: impl AsRef<RenderNode>,
        viewport: Option<&Rect>
    ) -> Texture { ... }
    fn unrealize(&self) { ... }
    fn connect_realized_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId { ... }
    fn connect_surface_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId { ... }
}
Expand description

Provided Methods§

source

fn surface(&self) -> Option<Surface>

Retrieves the gdk::Surface set using gsk_enderer_realize().

If the renderer has not been realized yet, None will be returned.

Returns

a gdk::Surface

source

fn is_realized(&self) -> bool

Checks whether the @self is realized or not.

Returns

true if the Renderer was realized, and false otherwise

source

fn realize(&self, surface: Option<&Surface>) -> Result<(), Error>

Creates the resources needed by the @self to render the scene graph.

Since GTK 4.6, the surface may be NULL, which allows using renderers without having to create a surface.

Note that it is mandatory to call unrealize() before destroying the renderer.

surface

the gdk::Surface renderer will be used on

Returns

Whether the renderer was successfully realized

source

fn render(&self, root: impl AsRef<RenderNode>, region: Option<&Region>)

Renders the scene graph, described by a tree of RenderNode instances to the renderer’s surface, ensuring that the given @region gets redrawn.

If the renderer has no associated surface, this function does nothing.

Renderers must ensure that changes of the contents given by the @root node as well as the area given by @region are redrawn. They are however free to not redraw any pixel outside of @region if they can guarantee that it didn’t change.

The @self will acquire a reference on the RenderNode tree while the rendering is in progress.

root

a RenderNode

region

the cairo::Region that must be redrawn or None for the whole window

source

fn render_texture( &self, root: impl AsRef<RenderNode>, viewport: Option<&Rect> ) -> Texture

Renders the scene graph, described by a tree of RenderNode instances, to a gdk::Texture.

The @self will acquire a reference on the RenderNode tree while the rendering is in progress.

If you want to apply any transformations to @root, you should put it into a transform node and pass that node instead.

root

a RenderNode

viewport

the section to draw or None to use @root’s bounds

Returns

a gdk::Texture with the rendered contents of @root.

source

fn unrealize(&self)

Releases all the resources created by gsk_renderer_realize().

source

fn connect_realized_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_surface_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

Implementors§