:right-sidebar: True RenderNode =================================================================== .. currentmodule:: gi.repository.Gsk .. class:: RenderNode(*args, **kwargs) :no-contents-entry: Subclasses: :class:`~gi.repository.Gsk.BlendNode`, :class:`~gi.repository.Gsk.BlurNode`, :class:`~gi.repository.Gsk.BorderNode`, :class:`~gi.repository.Gsk.CairoNode`, :class:`~gi.repository.Gsk.ClipNode`, :class:`~gi.repository.Gsk.ColorMatrixNode`, :class:`~gi.repository.Gsk.ColorNode`, :class:`~gi.repository.Gsk.ConicGradientNode`, :class:`~gi.repository.Gsk.ContainerNode`, :class:`~gi.repository.Gsk.CrossFadeNode`, :class:`~gi.repository.Gsk.DebugNode`, :class:`~gi.repository.Gsk.FillNode`, :class:`~gi.repository.Gsk.GLShaderNode`, :class:`~gi.repository.Gsk.InsetShadowNode`, :class:`~gi.repository.Gsk.LinearGradientNode`, :class:`~gi.repository.Gsk.MaskNode`, :class:`~gi.repository.Gsk.OpacityNode`, :class:`~gi.repository.Gsk.OutsetShadowNode`, :class:`~gi.repository.Gsk.RadialGradientNode`, :class:`~gi.repository.Gsk.RepeatNode`, :class:`~gi.repository.Gsk.RepeatingLinearGradientNode`, :class:`~gi.repository.Gsk.RepeatingRadialGradientNode`, :class:`~gi.repository.Gsk.RoundedClipNode`, :class:`~gi.repository.Gsk.ShadowNode`, :class:`~gi.repository.Gsk.StrokeNode`, :class:`~gi.repository.Gsk.SubsurfaceNode`, :class:`~gi.repository.Gsk.TextNode`, :class:`~gi.repository.Gsk.TextureNode`, :class:`~gi.repository.Gsk.TextureScaleNode`, :class:`~gi.repository.Gsk.TransformNode` :Constructors: :: RenderNode(**properties) Methods ------- .. rst-class:: interim-class .. class:: RenderNode :no-index: .. method:: deserialize(bytes: ~gi.repository.GLib.Bytes, error_func: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> ~gi.repository.Gsk.RenderNode | None Loads data previously created via :obj:`~gi.repository.Gsk.RenderNode.serialize`. For a discussion of the supported format, see that function. :param bytes: the bytes containing the data :param error_func: Callback on parsing errors :param user_data: user_data for ``error_func`` .. method:: draw(cr: ~cairo.Context) -> None Draw the contents of ``node`` to the given cairo context. Typically, you'll use this function to implement fallback rendering of ``GskRenderNode``'s on an intermediate Cairo context, instead of using the drawing context associated to a :obj:`~gi.repository.Gdk.Surface`'s rendering buffer. For advanced nodes that cannot be supported using Cairo, in particular for nodes doing 3D operations, this function may fail. :param cr: cairo context to draw to .. method:: get_bounds() -> ~gi.repository.Graphene.Rect Retrieves the boundaries of the ``node``. The node will not draw outside of its boundaries. .. method:: get_node_type() -> ~gi.repository.Gsk.RenderNodeType Returns the type of the ``node``. .. method:: serialize() -> ~gi.repository.GLib.Bytes Serializes the ``node`` for later deserialization via :func:`~gi.repository.Gsk.RenderNode.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 :func:`~gi.repository.Gsk.RenderNode.serialize` and :func:`~gi.repository.Gsk.RenderNode.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:: write_to_file(filename: str) -> bool This function is equivalent to calling :obj:`~gi.repository.Gsk.RenderNode.serialize` followed by :obj:`~gi.repository.GLib.file_set_contents`. 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. :param filename: the file to save it to.