33 constexpr bool empty()
const {
return w <= 0.0f ||
h <= 0.0f; }
37 if (
empty())
return other;
38 if (other.empty())
return *
this;
39 const float minx =
x < other.x ?
x : other.x;
40 const float miny =
y < other.y ?
y : other.y;
41 const float maxx = (
x +
w) > (other.x + other.w) ? (
x +
w) : (other.x + other.w);
42 const float maxy = (
y +
h) > (other.y + other.h) ? (
y +
h) : (other.y + other.h);
43 return {minx, miny, maxx - minx, maxy - miny};
47 return x == o.x &&
y == o.y &&
w == o.w &&
h == o.h;
57 float a = 1.0f,
b = 0.0f;
58 float c = 0.0f,
d = 1.0f;
59 float e = 0.0f,
f = 0.0f;
63 return {1, 0, 0, 1, tx, ty};
67 return a == 1.0f &&
b == 0.0f &&
c == 0.0f &&
d == 1.0f &&
e == 0.0f &&
f == 0.0f;
78 a * r.e +
c * r.f +
e,
79 b * r.e +
d * r.f +
f,
117 const std::string&
id()
const {
return id_; }
118 void set_id(std::string v) { id_ = std::move(v); }
123 if (visible_ == v)
return;
131 if (opacity_ == a)
return;
139 if (transform_.a == t.a && transform_.b == t.b &&
140 transform_.c == t.c && transform_.d == t.d &&
141 transform_.e == t.e && transform_.f == t.f)
return;
167 bool dirty()
const {
return dirty_; }
180 last_painted_bounds_ = painted_scene_bounds;
197 float opacity_ = 1.0f;
198 bool visible_ =
true;
Definition canvas.hpp:240
Definition scene_group.hpp:18
bool dirty() const
Definition scene_node.hpp:167
friend class SceneGroup
Definition scene_node.hpp:190
void mark_dirty()
Mark this node and (recursively) every ancestor dirty.
SceneNodeKind kind() const
Definition scene_node.hpp:114
const SceneTransform & transform() const
Definition scene_node.hpp:137
void set_transform(const SceneTransform &t)
Definition scene_node.hpp:138
const std::string & id() const
Definition scene_node.hpp:117
SceneNode & operator=(const SceneNode &)=delete
virtual SceneRect local_bounds() const =0
Local-coordinate bounding box (pre-transform, pre-opacity).
float opacity() const
Definition scene_node.hpp:129
virtual ~SceneNode()=default
const SceneRect & last_painted_bounds() const
The scene-space rect this node occupied at the last paint.
Definition scene_node.hpp:187
SceneNode(const SceneNode &)=delete
SceneRect transformed_local_bounds() const
Bounds after the node's own transform — used for parent group unions.
Definition scene_node.hpp:155
void set_id(std::string v)
Definition scene_node.hpp:118
void set_opacity(float a)
Definition scene_node.hpp:130
SceneNode(SceneNodeKind kind)
Definition scene_node.hpp:108
void mark_clean(const SceneRect &painted_scene_bounds)
Called by the scene walker after a full paint.
Definition scene_node.hpp:178
void set_visible(bool v)
Definition scene_node.hpp:122
SceneGroup * parent() const
Definition scene_node.hpp:147
virtual void paint_geometry(Canvas &canvas) const =0
Paint this node (and its sub-tree) into canvas.
bool visible() const
Definition scene_node.hpp:121
Definition affine_transform.hpp:24
SceneNodeKind
Kind discriminator — keeps dynamic_cast off the hot path.
Definition scene_node.hpp:91
@ text
Definition scene_node.hpp:96
@ image
Definition scene_node.hpp:95
@ shape
Definition scene_node.hpp:94
@ path
Definition scene_node.hpp:93
@ group
Definition scene_node.hpp:92
Axis-aligned bounding box used for repaint-rect math.
Definition scene_node.hpp:27
float y
Definition scene_node.hpp:29
float h
Definition scene_node.hpp:31
constexpr bool operator!=(const SceneRect &o) const
Definition scene_node.hpp:49
float w
Definition scene_node.hpp:30
constexpr bool operator==(const SceneRect &o) const
Definition scene_node.hpp:46
constexpr bool empty() const
Definition scene_node.hpp:33
constexpr SceneRect united(const SceneRect &other) const
Union with other, treating empty rects as "no contribution".
Definition scene_node.hpp:36
float x
Definition scene_node.hpp:28