26 static std::unique_ptr<SceneShape>
make_rect(
float x,
float y,
31 static std::unique_ptr<SceneShape>
make_circle(
float cx,
float cy,
33 static std::unique_ptr<SceneShape>
make_ellipse(
float cx,
float cy,
35 static std::unique_ptr<SceneShape>
make_line(
float x0,
float y0,
45 float x()
const {
return x_; }
46 float y()
const {
return y_; }
47 float w()
const {
return w_; }
48 float h()
const {
return h_; }
49 float radius()
const {
return radius_; }
55 void set_line(
float x0,
float y0,
float x1,
float y1);
60 if (fill_enabled_ == v)
return;
67 if (stroke_enabled_ == v)
return;
74 if (fill_color_ == c)
return;
81 if (stroke_color_ == c)
return;
88 if (stroke_width_ ==
w)
return;
99 float x_ = 0, y_ = 0, w_ = 0, h_ = 0, radius_ = 0;
102 float stroke_width_ = 1.0f;
103 bool fill_enabled_ =
true;
104 bool stroke_enabled_ =
false;
Definition canvas.hpp:240
void mark_dirty()
Mark this node and (recursively) every ancestor dirty.
SceneNode(SceneNodeKind kind)
Definition scene_node.hpp:108
bool fill_enabled() const
Definition scene_shape.hpp:58
SceneShape()
Definition scene_shape.hpp:21
bool stroke_enabled() const
Definition scene_shape.hpp:65
float y() const
Definition scene_shape.hpp:46
float x() const
Definition scene_shape.hpp:45
void set_stroke_width(float w)
Definition scene_shape.hpp:87
void set_line(float x0, float y0, float x1, float y1)
Color fill_color() const
Definition scene_shape.hpp:72
void set_stroke_color(Color c)
Definition scene_shape.hpp:80
void set_ellipse(float cx, float cy, float rx, float ry)
void paint_geometry(Canvas &canvas) const override
Paint this node (and its sub-tree) into canvas.
void set_circle(float cx, float cy, float radius)
void set_rounded_rect(float x, float y, float w, float h, float radius)
float stroke_width() const
Definition scene_shape.hpp:86
SceneRect local_bounds() const override
Local-coordinate bounding box (pre-transform, pre-opacity).
void set_fill_enabled(bool v)
Definition scene_shape.hpp:59
void set_rect(float x, float y, float w, float h)
void set_fill_color(Color c)
Definition scene_shape.hpp:73
float w() const
Definition scene_shape.hpp:47
static std::unique_ptr< SceneShape > make_rect(float x, float y, float w, float h)
float h() const
Definition scene_shape.hpp:48
static std::unique_ptr< SceneShape > make_rounded_rect(float x, float y, float w, float h, float radius)
static std::unique_ptr< SceneShape > make_ellipse(float cx, float cy, float rx, float ry)
static std::unique_ptr< SceneShape > make_circle(float cx, float cy, float radius)
Kind
Definition scene_shape.hpp:13
@ rect
Definition scene_shape.hpp:14
@ ellipse
Definition scene_shape.hpp:17
@ line
Definition scene_shape.hpp:18
@ rounded_rect
Definition scene_shape.hpp:15
@ circle
Definition scene_shape.hpp:16
Kind shape_kind() const
Definition scene_shape.hpp:38
float radius() const
Definition scene_shape.hpp:49
void set_stroke_enabled(bool v)
Definition scene_shape.hpp:66
static std::unique_ptr< SceneShape > make_line(float x0, float y0, float x1, float y1)
Color stroke_color() const
Definition scene_shape.hpp:79
Definition affine_transform.hpp:24
SceneNodeKind
Kind discriminator — keeps dynamic_cast off the hot path.
Definition scene_node.hpp:91
@ shape
Definition scene_node.hpp:94
static constexpr Color rgba(float r, float g, float b, float a=1.0f)
Construct from float channels [0,1] (>1.0 allowed for HDR).
Definition canvas.hpp:56
Axis-aligned bounding box used for repaint-rect math.
Definition scene_node.hpp:27