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.
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
Source§impl RenderNode
impl RenderNode
Sourcepub fn as_ptr(&self) -> *mut GskRenderNode
pub fn as_ptr(&self) -> *mut GskRenderNode
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskRenderNode) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskRenderNode) -> &Self
Borrows the underlying C value.
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 opaque_rect(&self) -> Option<Rect>
Available on crate feature v4_16
only.
pub fn opaque_rect(&self) -> Option<Rect>
v4_16
only.Gets an opaque rectangle inside the node that GTK can determine to be fully opaque.
There is no guarantee that this is indeed the largest opaque rectangle or that regions outside the rectangle are not opaque. This function is a best effort with that goal.
The rectangle will be fully contained in the bounds of the node.
§Returns
true
if part or all of the rendernode is opaque, false
if no
opaque region could be found.
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 FillNode
Available on crate feature v4_14
only.
impl AsRef<RenderNode> for FillNode
v4_14
only.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 StrokeNode
Available on crate feature v4_14
only.
impl AsRef<RenderNode> for StrokeNode
v4_14
only.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 StaticType for RenderNode
impl StaticType for RenderNode
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.Auto Trait Implementations§
impl Freeze for RenderNode
impl RefUnwindSafe for RenderNode
impl !Send for RenderNode
impl !Sync for RenderNode
impl Unpin for RenderNode
impl UnwindSafe for RenderNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)