#include <path_builder.h>
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 & | ConicCurveTo (Point controlPoint, Point point, Scalar weight, bool relative=false) |
Insert a conic curve from the current position to point using the control point controlPoint and the weight weight. 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 (const Rect &rect) |
| PathBuilder & | AddCircle (const Point ¢er, 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 (const Point &p1, const Point &cp, const Point &p2) |
Move to point p1, then insert a quadradic curve from p1 to p2 with the control point cp. More... | |
| PathBuilder & | AddConicCurve (const Point &p1, const Point &cp, const Point &p2, Scalar weight) |
Move to point p1, then insert a conic curve from p1 to p2 with the control point cp and weight weight. More... | |
| PathBuilder & | AddCubicCurve (const Point &p1, const Point &cp1, const Point &cp2, const 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 & | AddRoundRect (RoundRect rect) |
| PathBuilder & | AddRoundSuperellipse (RoundSuperellipse rse) |
| PathBuilder & | AddPath (const Path &path) |
Static Public Attributes | |
| constexpr static const Scalar | kArcApproximationMagic = 0.551915024494f |
Definition at line 16 of file path_builder.h.
| impeller::PathBuilder::PathBuilder | ( | ) |
Definition at line 15 of file path_builder.cc.
|
default |
| PathBuilder & impeller::PathBuilder::AddArc | ( | const Rect & | oval_bounds, |
| Radians | start, | ||
| Radians | sweep, | ||
| bool | use_center = false |
||
| ) |
Definition at line 397 of file path_builder.cc.
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().
| PathBuilder & impeller::PathBuilder::AddCircle | ( | const Point & | center, |
| Scalar | radius | ||
| ) |
Definition at line 171 of file path_builder.cc.
References AddOval(), impeller::TRect< Scalar >::MakeXYWH(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddConicCurve | ( | const Point & | p1, |
| const Point & | cp, | ||
| const Point & | p2, | ||
| Scalar | weight | ||
| ) |
Move to point p1, then insert a conic curve from p1 to p2 with the control point cp and weight weight.
Definition at line 135 of file path_builder.cc.
References MoveTo().
Referenced by impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddCubicCurve | ( | const Point & | p1, |
| const Point & | cp1, | ||
| const Point & | cp2, | ||
| const Point & | p2 | ||
| ) |
Move to point p1, then insert a cubic curve from p1 to p2 with control points cp1 and cp2.
Definition at line 144 of file path_builder.cc.
References MoveTo().
Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().
| 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 503 of file path_builder.cc.
References MoveTo().
Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddOval | ( | const Rect & | rect | ) |
Definition at line 455 of file path_builder.cc.
References Close(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetOrigin(), kArcApproximationMagic, MoveTo(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by AddCircle(), AddRoundSuperellipse(), impeller::Canvas::DrawOval(), and impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddPath | ( | const Path & | path | ) |
Definition at line 509 of file path_builder.cc.
References impeller::Path::kContour, and impeller::Path::VerbToOffset().
Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddQuadraticCurve | ( | const Point & | p1, |
| const Point & | cp, | ||
| const Point & | p2 | ||
| ) |
Move to point p1, then insert a quadradic curve from p1 to p2 with the control point cp.
Definition at line 127 of file path_builder.cc.
References MoveTo().
Referenced by impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddRect | ( | const Rect & | rect | ) |
Definition at line 153 of file path_builder.cc.
References Close(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), LineTo(), and MoveTo().
Referenced by AddRoundRect(), AddRoundSuperellipse(), impeller::Canvas::DrawRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddRoundRect | ( | RoundRect | rect | ) |
Definition at line 175 of file path_builder.cc.
References AddRect(), Close(), impeller::RoundRect::GetBounds(), impeller::RoundRect::GetRadii(), and MoveTo().
Referenced by impeller::DlDispatcherBase::clipRoundRect(), impeller::DlDispatcherBase::drawDiffRoundRect(), impeller::Canvas::DrawRoundRect(), and impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddRoundSuperellipse | ( | RoundSuperellipse | rse | ) |
Definition at line 246 of file path_builder.cc.
References AddOval(), AddRect(), impeller::RoundSuperellipseParam::AddToPath(), impeller::RoundSuperellipse::GetBounds(), impeller::RoundSuperellipse::GetRadii(), impeller::RoundSuperellipse::IsOval(), impeller::RoundSuperellipse::IsRect(), and impeller::RoundSuperellipseParam::MakeBoundsRadii().
Referenced by impeller::Canvas::DrawRoundSuperellipse(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::Close | ( | ) |
Definition at line 54 of file path_builder.cc.
References LineTo().
Referenced by AddArc(), AddOval(), AddRect(), AddRoundRect(), impeller::RoundSuperellipseParam::AddToPath(), impeller::Close(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::ConicCurveTo | ( | Point | controlPoint, |
| Point | point, | ||
| Scalar | weight, | ||
| bool | relative = false |
||
| ) |
Insert a conic curve from the current position to point using the control point controlPoint and the weight weight.
If relative is true the point and controlPoint are relative to current location.
Definition at line 99 of file path_builder.cc.
Referenced by impeller::testing::TEST().
| Path impeller::PathBuilder::CopyPath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 21 of file path_builder.cc.
References impeller::Path::kContour.
Referenced by impeller::Tessellate(), and impeller::testing::TEST().
| 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 115 of file path_builder.cc.
Referenced by impeller::CubicTo(), and impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::HorizontalLineTo | ( | Scalar | x, |
| bool | relative = false |
||
| ) |
Definition at line 73 of file path_builder.cc.
References x, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
| 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 66 of file path_builder.cc.
Referenced by AddArc(), AddRect(), impeller::RoundSuperellipseParam::AddToPath(), Close(), impeller::DlDispatcherBase::drawDashedLine(), impeller::LineTo(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::MoveTo | ( | Point | point, |
| bool | relative = false |
||
| ) |
Definition at line 47 of file path_builder.cc.
Referenced by AddArc(), AddConicCurve(), AddCubicCurve(), AddLine(), AddOval(), AddQuadraticCurve(), AddRect(), AddRoundRect(), impeller::RoundSuperellipseParam::AddToPath(), impeller::DlDispatcherBase::drawDashedLine(), impeller::MoveTo(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| 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 89 of file path_builder.cc.
Referenced by impeller::testing::TEST().
| 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 42 of file path_builder.cc.
| 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 576 of file path_builder.cc.
Referenced by impeller::DlDispatcherBase::drawDiffRoundRect(), impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::SetConvexity | ( | Convexity | value | ) |
Definition at line 110 of file path_builder.cc.
References value.
Referenced by impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::Shift | ( | Point | offset | ) |
Transform the existing path segments and contours by the given offset.
Definition at line 529 of file path_builder.cc.
References impeller::ContourComponent::destination, impeller::Path::kConic, impeller::Path::kContour, impeller::Path::kCubic, impeller::Path::kLinear, impeller::Path::kQuadratic, offset, impeller::LinearPathComponent::p1, impeller::QuadraticPathComponent::p1, impeller::ConicPathComponent::p1, impeller::CubicPathComponent::p1, and impeller::Path::VerbToOffset().
Referenced by impeller::testing::TEST().
| Path impeller::PathBuilder::TakePath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 30 of file path_builder.cc.
References impeller::Path::kContour.
Referenced by impeller::DlDispatcherBase::drawArc(), impeller::DlDispatcherBase::drawDashedLine(), impeller::DlDispatcherBase::drawDiffRoundRect(), impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::VerticalLineTo | ( | Scalar | y, |
| bool | relative = false |
||
| ) |
Definition at line 81 of file path_builder.cc.
References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::testing::TEST().
|
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 25 of file path_builder.h.
Referenced by AddArc(), AddOval(), and flutter::testing::TEST_P().