Struct gsk4::RenderNode
source · #[repr(transparent)]pub struct RenderNode { /* private fields */ }
Expand description
RenderNode
is the basic block in a scene graph to be
rendered using 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 Renderer
it’s safe to release any reference you have on
them. All RenderNode
s are immutable, you can only specify their
properties during construction.
This is an Abstract Base Class, you cannot instantiate it.
Implementations§
source§impl RenderNode
impl RenderNode
source§impl RenderNode
impl RenderNode
pub const NONE: Option<&'static RenderNode> = None
sourcepub fn draw(&self, cr: &Context)
pub fn draw(&self, cr: &Context)
Draw the contents of @self to the given cairo context.
Typically, you’ll use this function to implement fallback rendering
of RenderNode
s on an intermediate Cairo context, instead of using
the drawing context associated to a 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.
cr
cairo context to draw to
sourcepub fn node_type(&self) -> RenderNodeType
pub fn node_type(&self) -> RenderNodeType
sourcepub fn serialize(&self) -> Bytes
pub fn serialize(&self) -> Bytes
Serializes the @self for later deserialization via gsk_render_node_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 gsk_render_node_serialize() and gsk_render_node_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.
Returns
a GBytes
representing the node.
sourcepub fn write_to_file(&self, filename: impl AsRef<Path>) -> Result<(), Error>
pub fn write_to_file(&self, filename: impl AsRef<Path>) -> Result<(), Error>
This function is equivalent to calling serialize()
followed by 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.
filename
the file to save it to.
Returns
true
if saving was successful
source§impl RenderNode
impl RenderNode
pub fn is<T: IsRenderNode>(&self) -> bool
pub fn type_(&self) -> Type
sourcepub fn deserialize(bytes: &Bytes) -> Option<Self>
pub fn deserialize(bytes: &Bytes) -> Option<Self>
Loads data previously created via serialize()
.
For a discussion of the supported format, see that function.
bytes
the bytes containing the data
error_func
Callback on parsing errors
Returns
a new RenderNode
pub fn deserialize_with_error_func<P: FnMut(&ParseLocation, &ParseLocation, &Error)>( bytes: &Bytes, error_func: P ) -> Option<Self>
pub fn downcast<T: IsRenderNode>(self) -> Result<T, Self>
pub fn downcast_ref<T: IsRenderNode>(&self) -> Option<&T>
Trait Implementations§
source§impl AsRef<RenderNode> for BlendNode
impl AsRef<RenderNode> for BlendNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for BlurNode
impl AsRef<RenderNode> for BlurNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for BorderNode
impl AsRef<RenderNode> for BorderNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for CairoNode
impl AsRef<RenderNode> for CairoNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ClipNode
impl AsRef<RenderNode> for ClipNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ColorMatrixNode
impl AsRef<RenderNode> for ColorMatrixNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ColorNode
impl AsRef<RenderNode> for ColorNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ConicGradientNode
impl AsRef<RenderNode> for ConicGradientNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ContainerNode
impl AsRef<RenderNode> for ContainerNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for CrossFadeNode
impl AsRef<RenderNode> for CrossFadeNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for DebugNode
impl AsRef<RenderNode> for DebugNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for GLShaderNode
impl AsRef<RenderNode> for GLShaderNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for InsetShadowNode
impl AsRef<RenderNode> for InsetShadowNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for LinearGradientNode
impl AsRef<RenderNode> for LinearGradientNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for MaskNode
Available on crate feature v4_10
only.
impl AsRef<RenderNode> for MaskNode
v4_10
only.source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for OpacityNode
impl AsRef<RenderNode> for OpacityNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for OutsetShadowNode
impl AsRef<RenderNode> for OutsetShadowNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for RadialGradientNode
impl AsRef<RenderNode> for RadialGradientNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for RepeatNode
impl AsRef<RenderNode> for RepeatNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for RepeatingLinearGradientNode
impl AsRef<RenderNode> for RepeatingLinearGradientNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for RepeatingRadialGradientNode
impl AsRef<RenderNode> for RepeatingRadialGradientNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for RoundedClipNode
impl AsRef<RenderNode> for RoundedClipNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for ShadowNode
impl AsRef<RenderNode> for ShadowNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for TextNode
impl AsRef<RenderNode> for TextNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for TextureNode
impl AsRef<RenderNode> for TextureNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for TextureScaleNode
Available on crate feature v4_10
only.
impl AsRef<RenderNode> for TextureScaleNode
v4_10
only.source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl AsRef<RenderNode> for TransformNode
impl AsRef<RenderNode> for TransformNode
source§fn as_ref(&self) -> &RenderNode
fn as_ref(&self) -> &RenderNode
source§impl Clone for RenderNode
impl Clone for RenderNode
source§impl Debug for RenderNode
impl Debug for RenderNode
source§impl Display for RenderNode
impl Display for RenderNode
source§impl StaticType for RenderNode
impl StaticType for RenderNode
source§fn static_type() -> Type
fn static_type() -> Type
Self
.