Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::SceneGroup Class Reference

#include <scene_group.hpp>

Public Member Functions

 SceneGroup ()
SceneNode * add_child (std::unique_ptr< SceneNode > child)
 Take ownership of child and re-parent it to this group.
template<class T, class... Args>
T * emplace_child (Args &&... args)
 Convenience for the common in-place construction case.
bool remove_child (size_t index)
 Detach + destroy a child by index. Returns true on success.
bool remove_child (SceneNode *node)
 Detach + destroy a child by raw pointer. Returns true on success.
size_t child_count () const
SceneNode * child_at (size_t i) const
const std::vector< std::unique_ptr< SceneNode > > & children () const
template<class Fn>
void for_each_descendant (Fn fn) const
 Walk the sub-tree depth-first, applying fn(node).
SceneRect local_bounds () const override
 Local-coordinate bounding box (pre-transform, pre-opacity).
void paint_geometry (Canvas &canvas) const override
 Paint this node (and its sub-tree) into canvas.
SceneNodeKind kind () const
const std::string & id () const
void set_id (std::string v)
bool visible () const
void set_visible (bool v)
float opacity () const
void set_opacity (float a)
const SceneTransform & transform () const
void set_transform (const SceneTransform &t)
SceneGroup * parent () const
SceneRect transformed_local_bounds () const
 Bounds after the node's own transform — used for parent group unions.
bool dirty () const
void mark_dirty ()
 Mark this node and (recursively) every ancestor dirty.
void mark_clean (const SceneRect &painted_scene_bounds)
 Called by the scene walker after a full paint.
const SceneRect & last_painted_bounds () const
 The scene-space rect this node occupied at the last paint.

Constructor & Destructor Documentation

◆ SceneGroup()

pulp::canvas::SceneGroup::SceneGroup ( )
inline

Member Function Documentation

◆ add_child()

SceneNode * pulp::canvas::SceneGroup::add_child ( std::unique_ptr< SceneNode > child)
inline

Take ownership of child and re-parent it to this group.

Returns a non-owning pointer for the caller to address the child without re-walking children().

◆ child_at()

SceneNode * pulp::canvas::SceneGroup::child_at ( size_t i) const
inline

◆ child_count()

size_t pulp::canvas::SceneGroup::child_count ( ) const
inline

◆ children()

const std::vector< std::unique_ptr< SceneNode > > & pulp::canvas::SceneGroup::children ( ) const
inline

◆ dirty()

bool pulp::canvas::SceneNode::dirty ( ) const
inlineinherited

◆ emplace_child()

template<class T, class... Args>
T * pulp::canvas::SceneGroup::emplace_child ( Args &&... args)
inline

Convenience for the common in-place construction case.

◆ for_each_descendant()

template<class Fn>
void pulp::canvas::SceneGroup::for_each_descendant ( Fn fn) const
inline

Walk the sub-tree depth-first, applying fn(node).

Used by VectorScene::take_dirty_rect() and by tests / inspectors.

◆ id()

const std::string & pulp::canvas::SceneNode::id ( ) const
inlineinherited

◆ kind()

SceneNodeKind pulp::canvas::SceneNode::kind ( ) const
inlineinherited

◆ last_painted_bounds()

const SceneRect & pulp::canvas::SceneNode::last_painted_bounds ( ) const
inlineinherited

The scene-space rect this node occupied at the last paint.

Always united with the post-mutation bounds to derive the "what needs repainting" rect — this is the whole point of the retained scene graph: small mutations → small repaint rects.

◆ local_bounds()

SceneRect pulp::canvas::SceneGroup::local_bounds ( ) const
overridevirtual

Local-coordinate bounding box (pre-transform, pre-opacity).

Subclasses MUST compute this from current geometry.

Implements pulp::canvas::SceneNode.

◆ mark_clean()

void pulp::canvas::SceneNode::mark_clean ( const SceneRect & painted_scene_bounds)
inlineinherited

Called by the scene walker after a full paint.

Captures the bounding box that was painted (in scene coordinates) so the next mutation knows what to invalidate.

◆ mark_dirty()

void pulp::canvas::SceneNode::mark_dirty ( )
inherited

Mark this node and (recursively) every ancestor dirty.

Returning the current node's last_painted_bounds() union with the new transformed_local_bounds() lets VectorScene::take_dirty_rect() report the exact rect that needs to be re-painted.

◆ opacity()

float pulp::canvas::SceneNode::opacity ( ) const
inlineinherited

◆ paint_geometry()

void pulp::canvas::SceneGroup::paint_geometry ( Canvas & canvas) const
overridevirtual

Paint this node (and its sub-tree) into canvas.

The walker calls save() / restore() around this call, applies the composed CTM, and pushes opacity if opacity_ < 1.0. Implementations therefore emit geometry/state only — they MUST NOT touch save/restore.

Implements pulp::canvas::SceneNode.

◆ parent()

SceneGroup * pulp::canvas::SceneNode::parent ( ) const
inlineinherited

◆ remove_child() [1/2]

bool pulp::canvas::SceneGroup::remove_child ( SceneNode * node)
inline

Detach + destroy a child by raw pointer. Returns true on success.

◆ remove_child() [2/2]

bool pulp::canvas::SceneGroup::remove_child ( size_t index)
inline

Detach + destroy a child by index. Returns true on success.

◆ set_id()

void pulp::canvas::SceneNode::set_id ( std::string v)
inlineinherited

◆ set_opacity()

void pulp::canvas::SceneNode::set_opacity ( float a)
inlineinherited

◆ set_transform()

void pulp::canvas::SceneNode::set_transform ( const SceneTransform & t)
inlineinherited

◆ set_visible()

void pulp::canvas::SceneNode::set_visible ( bool v)
inlineinherited

◆ transform()

const SceneTransform & pulp::canvas::SceneNode::transform ( ) const
inlineinherited

◆ transformed_local_bounds()

SceneRect pulp::canvas::SceneNode::transformed_local_bounds ( ) const
inlineinherited

Bounds after the node's own transform — used for parent group unions.

◆ visible()

bool pulp::canvas::SceneNode::visible ( ) const
inlineinherited

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/canvas/include/pulp/canvas/scene/scene_group.hpp