gi-gsk-4.0.8: Gsk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gsk.Objects.Renderer

Description

GskRenderer is a class that renders a scene graph defined via a tree of RenderNode instances.

Typically you will use a GskRenderer instance to repeatedly call rendererRender to update the contents of its associated Surface.

It is necessary to realize a GskRenderer instance using rendererRealize before calling rendererRender, in order to create the appropriate windowing system resources needed to render the scene.

Synopsis

Exported types

newtype Renderer Source #

Memory-managed wrapper type.

Constructors

Renderer (ManagedPtr Renderer) 

Instances

Instances details
Eq Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

GObject Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

ManagedPtrNewtype Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

Methods

toManagedPtr :: Renderer -> ManagedPtr Renderer

TypedObject Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

Methods

glibType :: IO GType

HasParentTypes Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

IsGValue (Maybe Renderer) Source #

Convert Renderer to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gsk.Objects.Renderer

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Renderer -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Renderer)

type ParentTypes Renderer Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

type ParentTypes Renderer = '[Object]

class (GObject o, IsDescendantOf Renderer o) => IsRenderer o Source #

Type class for types which can be safely cast to Renderer, for instance with toRenderer.

Instances

Instances details
(GObject o, IsDescendantOf Renderer o) => IsRenderer o Source # 
Instance details

Defined in GI.Gsk.Objects.Renderer

toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer Source #

Cast to Renderer, for types for which this is known to be safe. For general casts, use castTo.

Methods

getSurface

rendererGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a GskRenderer

-> m (Maybe Surface)

Returns: a GdkSurface

Retrieves the GdkSurface set using gsk_enderer_realize().

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

isRealized

rendererIsRealized Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a GskRenderer

-> m Bool

Returns: True if the GskRenderer was realized, and False otherwise

Checks whether the renderer is realized or not.

newForSurface

rendererNewForSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsSurface a) 
=> a

surface: a GdkSurface

-> m (Maybe Renderer)

Returns: a GskRenderer

Creates an appropriate GskRenderer instance for the given surface.

If the GSK_RENDERER environment variable is set, GSK will try that renderer first, before trying the backend-specific default. The ultimate fallback is the cairo renderer.

The renderer will be realized before it is returned.

realize

rendererRealize Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsSurface b) 
=> a

renderer: a GskRenderer

-> Maybe b

surface: the GdkSurface renderer will be used on

-> m ()

(Can throw GError)

Creates the resources needed by the renderer to render the scene graph.

Since GTK 4.6, the surface may be NULL, which allows using renderers without having to create a surface. Since GTK 4.14, it is recommended to use rendererRealizeForDisplay instead.

Note that it is mandatory to call rendererUnrealize before destroying the renderer.

realizeForDisplay

rendererRealizeForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsDisplay b) 
=> a

renderer: a GskRenderer

-> b

display: the GdkDisplay renderer will be used on

-> m ()

(Can throw GError)

Creates the resources needed by the renderer to render the scene graph.

Note that it is mandatory to call rendererUnrealize before destroying the renderer.

Since: 4.14

render

rendererRender Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) 
=> a

renderer: a realized GskRenderer

-> b

root: a GskRenderNode

-> Maybe Region

region: the cairo_region_t that must be redrawn or Nothing for the whole window

-> m () 

Renders the scene graph, described by a tree of GskRenderNode 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 renderer will acquire a reference on the GskRenderNode tree while the rendering is in progress.

renderTexture

rendererRenderTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) 
=> a

renderer: a realized GskRenderer

-> b

root: a GskRenderNode

-> Maybe Rect

viewport: the section to draw or Nothing to use root's bounds

-> m Texture

Returns: a GdkTexture with the rendered contents of root.

Renders the scene graph, described by a tree of GskRenderNode instances, to a GdkTexture.

The renderer will acquire a reference on the GskRenderNode 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.

unrealize

rendererUnrealize Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a GskRenderer

-> m () 

Releases all the resources created by rendererRealize.

Properties

realized

Whether the renderer has been associated with a surface or draw context.

getRendererRealized :: (MonadIO m, IsRenderer o) => o -> m Bool Source #

Get the value of the “realized” property. When overloading is enabled, this is equivalent to

get renderer #realized

surface

The surface associated with renderer.

getRendererSurface :: (MonadIO m, IsRenderer o) => o -> m (Maybe Surface) Source #

Get the value of the “surface” property. When overloading is enabled, this is equivalent to

get renderer #surface