Gnome::Gsk4::RenderNode
Description
Gnome::Gsk4::RenderNode is the basic block in a scene graph to be rendered using Gnome::Gsk4::Renderer.
Each node has a parent, except the top-level node; each node may have children nodes.
Each node has an associated drawing surface, which has the size of the rectangle set when creating it.
Render nodes are meant to be transient; once they have been associated to a Gnome::Gsk4::Renderer it's safe to release any reference you have on them. All Gnome::Gsk4::RenderNodes are immutable, you can only specify their properties during construction.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
Methods
draw
Draw the contents of $node
to the given cairo context.
Typically, you'll use this function to implement fallback rendering of Gnome::Gsk4::RenderNodes on an intermediate Cairo context, instead of using the drawing context associated to a Gnome::Gdk4::Surface's rendering buffer.
For advanced nodes that cannot be supported using Cairo, in particular for nodes doing 3D operations, this function may fail.
method draw ( N-Object $cr )
$cr; cairo context to draw to
get-bounds
Retrieves the boundaries of the $node
.
The node will not draw outside of its boundaries.
method get-bounds ( N-Object $bounds )
$bounds; return location for the boundaries
get-node-type
Returns the type of the $node
.
method get-node-type (--> GskRenderNodeType )
Return value; the type of the Gnome::Gsk4::RenderNode.
ref
Acquires a reference on the given Gnome::Gsk4::RenderNode.
method ref (--> N-Object )
Return value; the Gnome::Gsk4::RenderNode with an additional reference.
serialize
Serializes the $node
for later deserialization via .deserialize()
. No guarantees are made about the format used other than that the same version of GTK will be able to deserialize the result of a call to .serialize()
and .deserialize()
will correctly reject files it cannot open that were created with previous versions of GTK.
The intended use of this functions is testing, benchmarking and debugging. The format is not meant as a permanent storage format.
method serialize (--> N-Object )
Return value; a Gnome::Glib::N-Bytes representing the node..
unref
Releases a reference on the given Gnome::Gsk4::RenderNode.
If the reference was the last, the resources associated to the $node
are freed.
method unref ( )
write-to-file
This function is equivalent to calling .serialize()
followed by .file-set-contents() in package Gnome::GLib
.
See those two functions for details on the arguments.
It is mostly intended for use inside a debugger to quickly dump a render node to a file for later inspection.
method write-to-file ( Str $filename, CArray[N-Error] $err --> Bool )
$filename; the file to save it to..
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if saving was successful.
Functions
deserialize
Loads data previously created via .serialize()
.
For a discussion of the supported format, see that function.
method deserialize ( N-Object $bytes, &error-func, gpointer $user-data --> N-Object )
$bytes; the bytes containing the data
&error-func; Callback on parsing errors. Tthe function must be specified with following signature;
:( N-Object $start, N-Object $end, N-Object $error, gpointer $user-data )
.$user-data; user_data for
$error-func
.
Return value; a new Gnome::Gsk4::RenderNode.