| Flutter Impeller |

Classes | Public Member Functions | Static Public Attributes | List of all members
impeller::PathBuilder Class Reference

`#include <path_builder.h>`

## Classes
struct | RoundingRadii

## Public Member Functions
| PathBuilder ()
| ~PathBuilder ()
Path | CopyPath (FillType fill=FillType::kNonZero)
Path | TakePath (FillType fill=FillType::kNonZero)
void | Reserve (size_t point_size, size_t verb_size)
| Reserve [point_size] points and [verb_size] verbs in the underlying path buffer. More...
PathBuilder & | SetConvexity (Convexity value)
PathBuilder & | MoveTo (Point point, bool relative=false)
PathBuilder & | Close ()
PathBuilder & | LineTo (Point point, bool relative=false)
| Insert a line from the current position to `point`. More...
PathBuilder & | HorizontalLineTo (Scalar x, bool relative=false)
PathBuilder & | VerticalLineTo (Scalar y, bool relative=false)
PathBuilder & | QuadraticCurveTo (Point controlPoint, Point point, bool relative=false)
| Insert a quadradic curve from the current position to `point` using the control point `controlPoint`. More...
PathBuilder & | CubicCurveTo (Point controlPoint1, Point controlPoint2, Point point, bool relative=false)
| Insert a cubic curve from the curren position to `point` using the control points `controlPoint1` and `controlPoint2`. More...
PathBuilder & | AddRect (Rect rect)
PathBuilder & | AddCircle (const Point &center, Scalar radius)
PathBuilder & | AddArc (const Rect &oval_bounds, Radians start, Radians sweep, bool use_center=false)
PathBuilder & | AddOval (const Rect &rect)
PathBuilder & | AddLine (const Point &p1, const Point &p2)
| Move to point `p1`, then insert a line from `p1` to `p2`. More...
PathBuilder & | AddQuadraticCurve (Point p1, Point cp, Point p2)
| Move to point `p1`, then insert a quadradic curve from `p1` to `p2` with the control point `cp`. More...
PathBuilder & | AddCubicCurve (Point p1, Point cp1, Point cp2, Point p2)
| Move to point `p1`, then insert a cubic curve from `p1` to `p2` with control points `cp1` and `cp2`. More...
PathBuilder & | Shift (Point offset)
| Transform the existing path segments and contours by the given `offset`. More...
PathBuilder & | SetBounds (Rect bounds)
| Set the bounding box that will be used by `Path.GetBoundingBox` in place of performing the computation. More...
PathBuilder & | AddRoundedRect (Rect rect, RoundingRadii radii)
PathBuilder & | AddRoundedRect (Rect rect, Size radii)
PathBuilder & | AddRoundedRect (Rect rect, Scalar radius)
PathBuilder & | AddPath (const Path &path)

## Static Public Attributes
constexpr static const Scalar | kArcApproximationMagic = 0.551915024494f

## Detailed Description

Definition at line 14 of file path_builder.h.

## Constructor & Destructor Documentation

## ◆ PathBuilder()

impeller::PathBuilder::PathBuilder | ( |  | ) |

Definition at line 13 of file path_builder.cc.

13 {
14 AddContourComponent({});
15 }

## ◆ ~PathBuilder()

impeller::PathBuilder::~PathBuilder | ( |  | ) |
| default

## Member Function Documentation

## ◆ AddArc()

PathBuilder & impeller::PathBuilder::AddArc | ( | const Rect & | oval_bounds,
|  | Radians | start,
|  | Radians | sweep,
|  | bool | use_center = `false`
| ) |  |

Definition at line 323 of file path_builder.cc.

326 {
327 if (sweep.radians < 0) {
328 start.radians += sweep.radians;
329 sweep.radians *= -1;
330 }
331 sweep.radians = std::min(k2Pi, sweep.radians);
332 start.radians = std::fmod(start.radians, k2Pi);
333
334 const Point center = oval_bounds.GetCenter();
335 const Point radius = center - oval_bounds.GetOrigin();
336
337 Vector2 p1_unit(std::cos(start.radians), std::sin(start.radians));
338
339 if (use_center) {
340 MoveTo(center);
341 LineTo(center + p1_unit * radius);
342 } else {
343 MoveTo(center + p1_unit * radius);
344 }
345
346 while (sweep.radians > 0) {
347 Vector2 p2_unit;
348 Scalar quadrant_angle;
349 if (sweep.radians < kPiOver2) {
350 quadrant_angle = sweep.radians;
351 p2_unit = Vector2(std::cos(start.radians + quadrant_angle),
352 std::sin(start.radians + quadrant_angle));
353 } else {
354 quadrant_angle = kPiOver2;
355 p2_unit = Vector2(-p1_unit.y, p1_unit.x);
356 }
357
358 Vector2 arc_cp_lengths =
359 (quadrant_angle / kPiOver2) * kArcApproximationMagic * radius;
360
361 Point p1 = center + p1_unit * radius;
362 Point p2 = center + p2_unit * radius;
363 Point cp1 = p1 + Vector2(-p1_unit.y, p1_unit.x) * arc_cp_lengths;
364 Point cp2 = p2 + Vector2(p2_unit.y, -p2_unit.x) * arc_cp_lengths;
365
366 AddCubicComponent(p1, cp1, cp2, p2);
367 current_ = p2;
368
369 start.radians += quadrant_angle;
370 sweep.radians -= quadrant_angle;
371 p1_unit = p2_unit;
372 }
373
374 if (use_center) {
375 Close();
376 }
377
378 return *this;
379 }

References Close(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetOrigin(), impeller::k2Pi, kArcApproximationMagic, impeller::kPiOver2, LineTo(), MoveTo(), impeller::Radians::radians, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::DlDispatcherBase::drawArc(), and impeller::testing::TEST().

## ◆ AddCircle()

PathBuilder & impeller::PathBuilder::AddCircle | ( | const Point & | center,
|  | Scalar | radius
| ) |  |

Definition at line 138 of file path_builder.cc.

138 {
139 return AddOval(Rect::MakeXYWH(c.x - r, c.y - r, 2.0f * r, 2.0f * r));
140 }

References AddOval(), impeller::TRect< Scalar >::MakeXYWH(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ AddCubicCurve()

PathBuilder & impeller::PathBuilder::AddCubicCurve | ( | Point | p1,
|  | Point | cp1,
|  | Point | cp2,
|  | Point | p2
| ) |  |

Move to point `p1`, then insert a cubic curve from `p1` to `p2` with control points `cp1` and `cp2`.

Definition at line 111 of file path_builder.cc.

114 {
115 MoveTo(p1);
116 AddCubicComponent(p1, cp1, cp2, p2);
117 return *this;
118 }

References MoveTo().

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ AddLine()

PathBuilder & impeller::PathBuilder::AddLine | ( | const Point & | p1,
|  | const Point & | p2
| ) |  |

Move to point `p1`, then insert a line from `p1` to `p2`.

Definition at line 429 of file path_builder.cc.

429 {
430 MoveTo(p1);
431 AddLinearComponent(p1, p2);
432 return *this;
433 }

References MoveTo().

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ AddOval()

PathBuilder & impeller::PathBuilder::AddOval | ( | const Rect & | rect | ) |

Definition at line 381 of file path_builder.cc.

381 {
382 const Point c = container.GetCenter();
383 const Point r = c - container.GetOrigin();
384 const Point m = r * kArcApproximationMagic;
385
386 MoveTo({c.x, c.y - r.y});
387
388 //----------------------------------------------------------------------------
389 // Top right arc.
390 //
391 AddCubicComponent({c.x, c.y - r.y}, // p1
392 {c.x + m.x, c.y - r.y}, // cp1
393 {c.x + r.x, c.y - m.y}, // cp2
394 {c.x + r.x, c.y} // p2
395 );
396
397 //----------------------------------------------------------------------------
398 // Bottom right arc.
399 //
400 AddCubicComponent({c.x + r.x, c.y}, // p1
401 {c.x + r.x, c.y + m.y}, // cp1
402 {c.x + m.x, c.y + r.y}, // cp2
403 {c.x, c.y + r.y} // p2
404 );
405
406 //----------------------------------------------------------------------------
407 // Bottom left arc.
408 //
409 AddCubicComponent({c.x, c.y + r.y}, // p1
410 {c.x - m.x, c.y + r.y}, // cp1
411 {c.x - r.x, c.y + m.y}, // cp2
412 {c.x - r.x, c.y} // p2
413 );
414
415 //----------------------------------------------------------------------------
416 // Top left arc.
417 //
418 AddCubicComponent({c.x - r.x, c.y}, // p1
419 {c.x - r.x, c.y - m.y}, // cp1
420 {c.x - m.x, c.y - r.y}, // cp2
421 {c.x, c.y - r.y} // p2
422 );
423
424 Close();
425
426 return *this;
427 }

References Close(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetOrigin(), kArcApproximationMagic, MoveTo(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by AddCircle(), impeller::Canvas::DrawOval(), and impeller::testing::TEST().

## ◆ AddPath()

PathBuilder & impeller::PathBuilder::AddPath | ( | const Path & | path | ) |

Definition at line 435 of file path_builder.cc.

435 {
436 auto& points = prototype_.points;
437 auto& components = prototype_.components;
438
439 points.insert(points.end(), path.data_->points.begin(),
440 path.data_->points.end());
441 components.insert(components.end(), path.data_->components.begin(),
442 path.data_->components.end());
443
444 size_t source_offset = points.size();
445 for (auto component : path.data_->components) {
446 if (component == Path::ComponentType::kContour) {
447 current_contour_location_ = source_offset;
448 }
449 source_offset += Path::VerbToOffset(component);
450 }
451 return *this;
452 }

References impeller::Path::kContour, and impeller::Path::VerbToOffset().

Referenced by impeller::DlDispatcherBase::drawDRRect().

## ◆ AddQuadraticCurve()

PathBuilder & impeller::PathBuilder::AddQuadraticCurve | ( | Point | p1,
|  | Point | cp,
|  | Point | p2
| ) |  |

Move to point `p1`, then insert a quadradic curve from `p1` to `p2` with the control point `cp`.

Definition at line 105 of file path_builder.cc.

105 {
106 MoveTo(p1);
107 AddQuadraticComponent(p1, cp, p2);
108 return *this;
109 }

References MoveTo().

Referenced by impeller::testing::TEST().

## ◆ AddRect()

PathBuilder & impeller::PathBuilder::AddRect | ( | Rect | rect | ) |

Definition at line 120 of file path_builder.cc.

120 {
121 auto origin = rect.GetOrigin();
122 auto size = rect.GetSize();
123
124 auto tl = origin;
125 auto bl = origin + Point{0.0, size.height};
126 auto br = origin + size;
127 auto tr = origin + Point{size.width, 0.0};
128
129 MoveTo(tl);
130 LineTo(tr);
131 LineTo(br);
132 LineTo(bl);
133 Close();
134
135 return *this;
136 }

References Close(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), LineTo(), and MoveTo().

Referenced by AddRoundedRect(), impeller::Canvas::DrawRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ AddRoundedRect() [1/3]

PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect,
|  | RoundingRadii | radii
| ) |  |

Definition at line 153 of file path_builder.cc.

153 {
154 if (radii.AreAllZero()) {
155 return AddRect(rect);
156 }
157
158 auto rect_origin = rect.GetOrigin();
159 auto rect_size = rect.GetSize();
160
161 current_ = rect_origin + Point{radii.top_left.x, 0.0};
162
163 MoveTo({rect_origin.x + radii.top_left.x, rect_origin.y});
164
165 //----------------------------------------------------------------------------
166 // Top line.
167 //
168 AddLinearComponent(
169 {rect_origin.x + radii.top_left.x, rect_origin.y},
170 {rect_origin.x + rect_size.width - radii.top_right.x, rect_origin.y});
171
172 //----------------------------------------------------------------------------
173 // Top right arc.
174 //
175 AddRoundedRectTopRight(rect, radii);
176
177 //----------------------------------------------------------------------------
178 // Right line.
179 //
180 AddLinearComponent(
181 {rect_origin.x + rect_size.width, rect_origin.y + radii.top_right.y},
182 {rect_origin.x + rect_size.width,
183 rect_origin.y + rect_size.height - radii.bottom_right.y});
184
185 //----------------------------------------------------------------------------
186 // Bottom right arc.
187 //
188 AddRoundedRectBottomRight(rect, radii);
189
190 //----------------------------------------------------------------------------
191 // Bottom line.
192 //
193 AddLinearComponent(
194 {rect_origin.x + rect_size.width - radii.bottom_right.x,
195 rect_origin.y + rect_size.height},
196 {rect_origin.x + radii.bottom_left.x, rect_origin.y + rect_size.height});
197
198 //----------------------------------------------------------------------------
199 // Bottom left arc.
200 //
201 AddRoundedRectBottomLeft(rect, radii);
202
203 //----------------------------------------------------------------------------
204 // Left line.
205 //
206 AddLinearComponent(
207 {rect_origin.x, rect_origin.y + rect_size.height - radii.bottom_left.y},
208 {rect_origin.x, rect_origin.y + radii.top_left.y});
209
210 //----------------------------------------------------------------------------
211 // Top left arc.
212 //
213 AddRoundedRectTopLeft(rect, radii);
214
215 Close();
216
217 return *this;
218 }

References AddRect(), impeller::PathBuilder::RoundingRadii::AreAllZero(), impeller::PathBuilder::RoundingRadii::bottom_left, impeller::PathBuilder::RoundingRadii::bottom_right, Close(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), MoveTo(), impeller::PathBuilder::RoundingRadii::top_left, impeller::PathBuilder::RoundingRadii::top_right, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by AddRoundedRect(), impeller::Canvas::DrawRRect(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().

## ◆ AddRoundedRect() [2/3]

PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect,
|  | Scalar | radius
| ) |  |

Definition at line 142 of file path_builder.cc.

142 {
143 return radius <= 0.0 ? AddRect(rect)
144 : AddRoundedRect(rect, RoundingRadii(radius));
145 }

References AddRect(), and AddRoundedRect().

## ◆ AddRoundedRect() [3/3]

PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect,
|  | Size | radii
| ) |  |

Definition at line 147 of file path_builder.cc.

147 {
148 return radii.width <= 0 || radii.height <= 0
149 ? AddRect(rect)
150 : AddRoundedRect(rect, RoundingRadii(radii));
151 }

References AddRect(), AddRoundedRect(), impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by AddRoundedRect().

## ◆ Close()

PathBuilder & impeller::PathBuilder::Close | ( |  | ) |

Definition at line 43 of file path_builder.cc.

43 {
44 // If the subpath start is the same as the current position, this
45 // is an empty contour and inserting a line segment will just
46 // confuse the tessellator.
47 if (subpath_start_ != current_) {
48 LineTo(subpath_start_);
49 }
50 SetContourClosed(true);
51 AddContourComponent(current_);
52 return *this;
53 }

References LineTo().

Referenced by AddArc(), AddOval(), AddRect(), AddRoundedRect(), impeller::Close(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ CopyPath()

Path impeller::PathBuilder::CopyPath | ( | FillType | fill = `FillType::kNonZero` | ) |

Definition at line 19 of file path_builder.cc.

19 {
20 prototype_.fill = fill;
21 return Path(prototype_);
22 }

Referenced by impeller::Tessellate(), and impeller::testing::TEST().

## ◆ CubicCurveTo()

PathBuilder & impeller::PathBuilder::CubicCurveTo | ( | Point | controlPoint1,
|  | Point | controlPoint2,
|  | Point | point,
|  | bool | relative = `false`
| ) |  |

Insert a cubic curve from the curren position to `point` using the control points `controlPoint1` and `controlPoint2`.

If `relative` is true the `point`, `controlPoint1`, and `controlPoint2` are relative to current location.

Definition at line 93 of file path_builder.cc.

96 {
97 controlPoint1 = relative ? current_ + controlPoint1 : controlPoint1;
98 controlPoint2 = relative ? current_ + controlPoint2 : controlPoint2;
99 point = relative ? current_ + point : point;
100 AddCubicComponent(current_, controlPoint1, controlPoint2, point);
101 current_ = point;
102 return *this;
103 }

Referenced by impeller::CubicTo(), and impeller::testing::TEST().

## ◆ HorizontalLineTo()

PathBuilder & impeller::PathBuilder::HorizontalLineTo | ( | Scalar | x,
|  | bool | relative = `false`
| ) |  |

Definition at line 62 of file path_builder.cc.

62 {
63 Point endpoint =
64 relative ? Point{current_.x + x, current_.y} : Point{x, current_.y};
65 AddLinearComponent(current_, endpoint);
66 current_ = endpoint;
67 return *this;
68 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ LineTo()

PathBuilder & impeller::PathBuilder::LineTo | ( | Point | point,
|  | bool | relative = `false`
| ) |  |

Insert a line from the current position to `point`.

If `relative` is true, then `point` is relative to the current location.

Definition at line 55 of file path_builder.cc.

55 {
56 point = relative ? current_ + point : point;
57 AddLinearComponent(current_, point);
58 current_ = point;
59 return *this;
60 }

Referenced by AddArc(), AddRect(), Close(), impeller::DlDispatcherBase::drawDashedLine(), impeller::LineTo(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ MoveTo()

PathBuilder & impeller::PathBuilder::MoveTo | ( | Point | point,
|  | bool | relative = `false`
| ) |  |

Definition at line 36 of file path_builder.cc.

36 {
37 current_ = relative ? current_ + point : point;
38 subpath_start_ = current_;
39 AddContourComponent(current_);
40 return *this;
41 }

Referenced by AddArc(), AddCubicCurve(), AddLine(), AddOval(), AddQuadraticCurve(), AddRect(), AddRoundedRect(), impeller::DlDispatcherBase::drawDashedLine(), impeller::MoveTo(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ QuadraticCurveTo()

PathBuilder & impeller::PathBuilder::QuadraticCurveTo | ( | Point | controlPoint,
|  | Point | point,
|  | bool | relative = `false`
| ) |  |

Insert a quadradic curve from the current position to `point` using the control point `controlPoint`.

If `relative` is true the `point` and `controlPoint` are relative to current location.

Definition at line 78 of file path_builder.cc.

80 {
81 point = relative ? current_ + point : point;
82 controlPoint = relative ? current_ + controlPoint : controlPoint;
83 AddQuadraticComponent(current_, controlPoint, point);
84 current_ = point;
85 return *this;
86 }

Referenced by impeller::testing::TEST().

## ◆ Reserve()

void impeller::PathBuilder::Reserve | ( | size_t | point_size,
|  | size_t | verb_size
| ) |  |

Reserve [point_size] points and [verb_size] verbs in the underlying path buffer.

Definition at line 31 of file path_builder.cc.

31 {
32 prototype_.points.reserve(point_size);
33 prototype_.components.reserve(verb_size);
34 }

## ◆ SetBounds()

PathBuilder & impeller::PathBuilder::SetBounds | ( | Rect | bounds | ) |

Set the bounding box that will be used by `Path.GetBoundingBox` in place of performing the computation.

       When Impeller recieves Skia Path objects, many of these already
       have computed bounds. This method is used to avoid needlessly
       recomputing these bounds.

Definition at line 494 of file path_builder.cc.

494 {
495 prototype_.bounds = bounds;
496 return *this;
497 }

Referenced by impeller::Canvas::DrawRRect(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().

## ◆ SetConvexity()

PathBuilder & impeller::PathBuilder::SetConvexity | ( | Convexity | value | ) |

Definition at line 88 of file path_builder.cc.

88 {
89 prototype_.convexity = value;
90 return *this;
91 }

Referenced by impeller::Canvas::DrawRRect(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().

## ◆ Shift()

PathBuilder & impeller::PathBuilder::Shift | ( | Point | offset | ) |

Transform the existing path segments and contours by the given `offset`.

Definition at line 454 of file path_builder.cc.

454 {
455 auto& points = prototype_.points;
456 size_t storage_offset = 0u;
457 for (const auto& component : prototype_.components) {
458 switch (component) {
459 case Path::ComponentType::kLinear: {
460 auto* linear =
461 reinterpret_cast<LinearPathComponent*>(&points[storage_offset]);
462 linear->p1 += offset;
463 linear->p2 += offset;
464 break;
465 }
466 case Path::ComponentType::kQuadratic: {
467 auto* quad =
468 reinterpret_cast<QuadraticPathComponent*>(&points[storage_offset]);
469 quad->p1 += offset;
470 quad->p2 += offset;
471 quad->cp += offset;
472 } break;
473 case Path::ComponentType::kCubic: {
474 auto* cubic =
475 reinterpret_cast<CubicPathComponent*>(&points[storage_offset]);
476 cubic->p1 += offset;
477 cubic->p2 += offset;
478 cubic->cp1 += offset;
479 cubic->cp2 += offset;
480 } break;
481 case Path::ComponentType::kContour:
482 auto* contour =
483 reinterpret_cast<ContourComponent*>(&points[storage_offset]);
484 contour->destination += offset;
485 break;
486 }
487 storage_offset += Path::VerbToOffset(component);
488 }
489
490 prototype_.bounds.reset();
491 return *this;
492 }

References impeller::ContourComponent::destination, impeller::Path::kContour, impeller::Path::kCubic, impeller::Path::kLinear, impeller::Path::kQuadratic, offset, impeller::LinearPathComponent::p1, impeller::QuadraticPathComponent::p1, impeller::CubicPathComponent::p1, and impeller::Path::VerbToOffset().

Referenced by impeller::testing::TEST().

## ◆ TakePath()

Path impeller::PathBuilder::TakePath | ( | FillType | fill = `FillType::kNonZero` | ) |

Definition at line 24 of file path_builder.cc.

24 {
25 prototype_.fill = fill;
26 UpdateBounds();
27 current_contour_location_ = 0u;
28 return Path(std::move(prototype_));
29 }

Referenced by impeller::DlDispatcherBase::drawArc(), impeller::DlDispatcherBase::drawDashedLine(), impeller::DlDispatcherBase::drawDRRect(), impeller::Canvas::DrawRRect(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().

## ◆ VerticalLineTo()

PathBuilder & impeller::PathBuilder::VerticalLineTo | ( | Scalar | y,
|  | bool | relative = `false`
| ) |  |

Definition at line 70 of file path_builder.cc.

70 {
71 Point endpoint =
72 relative ? Point{current_.x, current_.y + y} : Point{current_.x, y};
73 AddLinearComponent(current_, endpoint);
74 current_ = endpoint;
75 return *this;
76 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## Member Data Documentation

## ◆ kArcApproximationMagic

constexpr static const Scalar impeller::PathBuilder::kArcApproximationMagic = 0.551915024494f
| staticconstexpr

Used for approximating quarter circle arcs with cubic curves. This is the control point distance which results in the smallest possible unit circle integration for a right angle arc. It can be used to approximate arcs less than 90 degrees to great effect by simply reducing it proportionally to the angle. However, accuracy rapidly diminishes if magnified for obtuse angle arcs, and so multiple cubic curves should be used when approximating arcs greater than 90 degrees.

Definition at line 23 of file path_builder.h.

Referenced by AddArc(), AddOval(), and flutter::testing::TEST_P().

The documentation for this class was generated from the following files:

- impeller/geometry/path_builder.h
- impeller/geometry/path_builder.cc

impeller::TPoint::y
Type y
Definition: point.h:31
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::TRect< Scalar >::MakeXYWH
constexpr static TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition: rect.h:136
impeller::Path::ComponentType::kLinear
@ kLinear
impeller::Path::ComponentType::kCubic
@ kCubic
impeller::Vector2
Point Vector2
Definition: point.h:331
impeller::Path::ComponentType::kQuadratic
@ kQuadratic
impeller::PathBuilder::AddRoundedRect
PathBuilder & AddRoundedRect(Rect rect, RoundingRadii radii)
Definition: path_builder.cc:153
impeller::PathBuilder::kArcApproximationMagic
constexpr static const Scalar kArcApproximationMagic
Definition: path_builder.h:23
offset
SeparatedVector2 offset
Definition: stroke_path_geometry.cc:304
impeller::PathBuilder::AddRect
PathBuilder & AddRect(Rect rect)
Definition: path_builder.cc:120
impeller::kPiOver2
constexpr float kPiOver2
Definition: constants.h:32
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::k2Pi
constexpr float k2Pi
Definition: constants.h:29
impeller::PathBuilder::LineTo
PathBuilder & LineTo(Point point, bool relative=false)
Insert a line from the current position to point.
Definition: path_builder.cc:55
impeller::TPoint::x
Type x
Definition: point.h:30
impeller::PathBuilder::Close
PathBuilder & Close()
Definition: path_builder.cc:43
impeller::PathBuilder::MoveTo
PathBuilder & MoveTo(Point point, bool relative=false)
Definition: path_builder.cc:36
impeller::Path::VerbToOffset
static constexpr size_t VerbToOffset(Path::ComponentType verb)
Definition: path.h:61
impeller::PathBuilder::AddOval
PathBuilder & AddOval(const Rect &rect)
Definition: path_builder.cc:381
impeller::Path::ComponentType::kContour
@ kContour