#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 ¢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 (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 |
Definition at line 14 of file path_builder.h.
| impeller::PathBuilder::PathBuilder | ( | ) |
Definition at line 13 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 323 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 138 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::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.
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 429 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 381 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(), impeller::Canvas::DrawOval(), and impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddPath | ( | const Path & | path | ) |
Definition at line 435 of file path_builder.cc.
References impeller::Path::kContour, and impeller::Path::VerbToOffset().
Referenced by impeller::DlDispatcherBase::drawDRRect().
| 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.
References MoveTo().
Referenced by impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddRect | ( | Rect | rect | ) |
Definition at line 120 of file path_builder.cc.
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().
| PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
| RoundingRadii | radii | ||
| ) |
Definition at line 153 of file path_builder.cc.
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().
| PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
| Scalar | radius | ||
| ) |
| PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
| Size | radii | ||
| ) |
Definition at line 147 of file path_builder.cc.
References AddRect(), AddRoundedRect(), impeller::TSize< T >::height, and impeller::TSize< T >::width.
Referenced by AddRoundedRect().
| PathBuilder & impeller::PathBuilder::Close | ( | ) |
Definition at line 43 of file path_builder.cc.
References LineTo().
Referenced by AddArc(), AddOval(), AddRect(), AddRoundedRect(), impeller::Close(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| Path impeller::PathBuilder::CopyPath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 19 of file path_builder.cc.
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 93 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 62 of file path_builder.cc.
References 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 55 of file path_builder.cc.
Referenced by AddArc(), AddRect(), 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 36 of file path_builder.cc.
Referenced by AddArc(), AddCubicCurve(), AddLine(), AddOval(), AddQuadraticCurve(), AddRect(), AddRoundedRect(), 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 78 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 31 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 494 of file path_builder.cc.
Referenced by impeller::Canvas::DrawRRect(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
| PathBuilder & impeller::PathBuilder::SetConvexity | ( | Convexity | value | ) |
Definition at line 88 of file path_builder.cc.
Referenced by impeller::Canvas::DrawRRect(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
| 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.
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().
| Path impeller::PathBuilder::TakePath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 24 of file path_builder.cc.
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().
| PathBuilder & impeller::PathBuilder::VerticalLineTo | ( | Scalar | y, |
| bool | relative = false |
||
| ) |
Definition at line 70 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 23 of file path_builder.h.
Referenced by AddArc(), AddOval(), and flutter::testing::TEST_P().