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

#include <scene_shape.hpp>

Public Types

enum class  Kind {
  rect , rounded_rect , circle , ellipse ,
  line
}

Public Member Functions

 SceneShape ()
Kind shape_kind () const
float x () const
float y () const
float w () const
float h () const
float radius () const
void set_rect (float x, float y, float w, float h)
void set_rounded_rect (float x, float y, float w, float h, float radius)
void set_circle (float cx, float cy, float radius)
void set_ellipse (float cx, float cy, float rx, float ry)
void set_line (float x0, float y0, float x1, float y1)
bool fill_enabled () const
void set_fill_enabled (bool v)
bool stroke_enabled () const
void set_stroke_enabled (bool v)
Color fill_color () const
void set_fill_color (Color c)
Color stroke_color () const
void set_stroke_color (Color c)
float stroke_width () const
void set_stroke_width (float w)
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.

Static Public Member Functions

static std::unique_ptr< SceneShape > make_rect (float x, float y, float w, float h)
static std::unique_ptr< SceneShape > make_rounded_rect (float x, float y, float w, float h, float radius)
static std::unique_ptr< SceneShape > make_circle (float cx, float cy, float radius)
static std::unique_ptr< SceneShape > make_ellipse (float cx, float cy, float rx, float ry)
static std::unique_ptr< SceneShape > make_line (float x0, float y0, float x1, float y1)

Member Enumeration Documentation

◆ Kind

enum class pulp::canvas::SceneShape::Kind
strong
Enumerator
rect 
rounded_rect 
circle 
ellipse 
line 

Constructor & Destructor Documentation

◆ SceneShape()

pulp::canvas::SceneShape::SceneShape ( )
inline

Member Function Documentation

◆ dirty()

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

◆ fill_color()

Color pulp::canvas::SceneShape::fill_color ( ) const
inline

◆ fill_enabled()

bool pulp::canvas::SceneShape::fill_enabled ( ) const
inline

◆ h()

float pulp::canvas::SceneShape::h ( ) const
inline

◆ 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::SceneShape::local_bounds ( ) const
overridevirtual

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

Subclasses MUST compute this from current geometry.

Implements pulp::canvas::SceneNode.

◆ make_circle()

std::unique_ptr< SceneShape > pulp::canvas::SceneShape::make_circle ( float cx,
float cy,
float radius )
static

◆ make_ellipse()

std::unique_ptr< SceneShape > pulp::canvas::SceneShape::make_ellipse ( float cx,
float cy,
float rx,
float ry )
static

◆ make_line()

std::unique_ptr< SceneShape > pulp::canvas::SceneShape::make_line ( float x0,
float y0,
float x1,
float y1 )
static

◆ make_rect()

std::unique_ptr< SceneShape > pulp::canvas::SceneShape::make_rect ( float x,
float y,
float w,
float h )
static

◆ make_rounded_rect()

std::unique_ptr< SceneShape > pulp::canvas::SceneShape::make_rounded_rect ( float x,
float y,
float w,
float h,
float radius )
static

◆ 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::SceneShape::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

◆ radius()

float pulp::canvas::SceneShape::radius ( ) const
inline

◆ set_circle()

void pulp::canvas::SceneShape::set_circle ( float cx,
float cy,
float radius )

◆ set_ellipse()

void pulp::canvas::SceneShape::set_ellipse ( float cx,
float cy,
float rx,
float ry )

◆ set_fill_color()

void pulp::canvas::SceneShape::set_fill_color ( Color c)
inline

◆ set_fill_enabled()

void pulp::canvas::SceneShape::set_fill_enabled ( bool v)
inline

◆ set_id()

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

◆ set_line()

void pulp::canvas::SceneShape::set_line ( float x0,
float y0,
float x1,
float y1 )

◆ set_opacity()

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

◆ set_rect()

void pulp::canvas::SceneShape::set_rect ( float x,
float y,
float w,
float h )

◆ set_rounded_rect()

void pulp::canvas::SceneShape::set_rounded_rect ( float x,
float y,
float w,
float h,
float radius )

◆ set_stroke_color()

void pulp::canvas::SceneShape::set_stroke_color ( Color c)
inline

◆ set_stroke_enabled()

void pulp::canvas::SceneShape::set_stroke_enabled ( bool v)
inline

◆ set_stroke_width()

void pulp::canvas::SceneShape::set_stroke_width ( float w)
inline

◆ set_transform()

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

◆ set_visible()

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

◆ shape_kind()

Kind pulp::canvas::SceneShape::shape_kind ( ) const
inline

◆ stroke_color()

Color pulp::canvas::SceneShape::stroke_color ( ) const
inline

◆ stroke_enabled()

bool pulp::canvas::SceneShape::stroke_enabled ( ) const
inline

◆ stroke_width()

float pulp::canvas::SceneShape::stroke_width ( ) const
inline

◆ 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

◆ w()

float pulp::canvas::SceneShape::w ( ) const
inline

◆ x()

float pulp::canvas::SceneShape::x ( ) const
inline

◆ y()

float pulp::canvas::SceneShape::y ( ) const
inline

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