Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype Renderer = Renderer (ManagedPtr Renderer)
- class (GObject o, IsDescendantOf Renderer o) => IsRenderer o
- toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer
- rendererGetSurface :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m (Maybe Surface)
- rendererIsRealized :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m Bool
- rendererNewForSurface :: (HasCallStack, MonadIO m, IsSurface a) => a -> m (Maybe Renderer)
- rendererRealize :: (HasCallStack, MonadIO m, IsRenderer a, IsSurface b) => a -> Maybe b -> m ()
- rendererRealizeForDisplay :: (HasCallStack, MonadIO m, IsRenderer a, IsDisplay b) => a -> b -> m ()
- rendererRender :: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) => a -> b -> Maybe Region -> m ()
- rendererRenderTexture :: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) => a -> b -> Maybe Rect -> m Texture
- rendererUnrealize :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m ()
- getRendererRealized :: (MonadIO m, IsRenderer o) => o -> m Bool
- getRendererSurface :: (MonadIO m, IsRenderer o) => o -> m (Maybe Surface)
Exported types
Memory-managed wrapper type.
Instances
Eq Renderer Source # | |
GObject Renderer Source # | |
Defined in GI.Gsk.Objects.Renderer | |
ManagedPtrNewtype Renderer Source # | |
Defined in GI.Gsk.Objects.Renderer toManagedPtr :: Renderer -> ManagedPtr Renderer | |
TypedObject Renderer Source # | |
Defined in GI.Gsk.Objects.Renderer | |
HasParentTypes Renderer Source # | |
Defined in GI.Gsk.Objects.Renderer | |
IsGValue (Maybe Renderer) Source # | Convert |
Defined in GI.Gsk.Objects.Renderer gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Renderer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Renderer) | |
type ParentTypes Renderer Source # | |
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
(GObject o, IsDescendantOf Renderer o) => IsRenderer o Source # | |
Defined in GI.Gsk.Objects.Renderer |
toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer Source #
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, isRealized, notify, notifyByPspec, realize, realizeForDisplay, ref, refSink, render, renderTexture, runDispose, stealData, stealQdata, thawNotify, unrealize, unref, watchClosure.
Getters
getData, getProperty, getQdata, getSurface.
Setters
getSurface
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m (Maybe Surface) | Returns: a |
Retrieves the GdkSurface
set using gsk_enderer_realize()
.
If the renderer has not been realized yet, Nothing
will be returned.
isRealized
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m Bool | Returns: |
Checks whether the renderer
is realized or not.
newForSurface
rendererNewForSurface Source #
:: (HasCallStack, MonadIO m, IsSurface a) | |
=> a |
|
-> m (Maybe Renderer) | Returns: a |
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
:: (HasCallStack, MonadIO m, IsRenderer a, IsSurface b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
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 #
:: (HasCallStack, MonadIO m, IsRenderer a, IsDisplay b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
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
:: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) | |
=> a |
|
-> b |
|
-> Maybe Region |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsRenderer a, IsRenderNode b) | |
=> a |
|
-> b |
|
-> Maybe Rect |
|
-> m Texture | Returns: a |
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
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> 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