File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,20 @@ void Path2d::add_circle(const Vec2F ¢er, float radius) {
159159 close_path ();
160160}
161161
162+ void Path2d::add_path (const Path2d &other, const Transform2 &transform) {
163+ flush_current_contour ();
164+
165+ // We need to get the outline from the other path.
166+ // Since into_outline() might be destructive/mutating, we'll use a const_cast
167+ // or better, just access the internal outline if we are a member.
168+ Outline other_outline = const_cast <Path2d&>(other).into_outline ();
169+ other_outline.transform (transform);
170+
171+ for (const auto &contour : other_outline.contours ) {
172+ outline.push_contour (contour);
173+ }
174+ }
175+
162176Outline Path2d::into_outline () {
163177 flush_current_contour ();
164178 return outline;
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ class Path2d {
3131 void add_rect_with_corners (const RectF &rect, const RectF &corner_radius);
3232
3333 void add_circle (const Vec2F ¢er, float radius);
34+
35+ void add_path (const Path2d &other, const Transform2 &transform = Transform2::from_scale({1 .0f , 1 .0f }));
3436 // -----------------------------------------------
3537
3638 // / Returns the outline.
You can’t perform that action at this time.
0 commit comments