#include <path_builder.h>
Classes | |
| struct | RoundingRadii |
Public Member Functions | |
| PathBuilder () | |
| ~PathBuilder () | |
| Path | CopyPath (FillType fill=FillType::kNonZero) const |
| Path | TakePath (FillType fill=FillType::kNonZero) |
| const Path & | GetCurrentPath () const |
| 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 & | SmoothQuadraticCurveTo (Point point, bool relative=false) |
| 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 & | SmoothCubicCurveTo (Point controlPoint2, Point point, bool relative=false) |
| 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, Scalar radius) |
| PathBuilder & | AddPath (const Path &path) |
Static Public Attributes | |
| constexpr static const Scalar | kArcApproximationMagic = 0.551915024494f |
Definition at line 13 of file path_builder.h.
|
default |
|
default |
| PathBuilder & impeller::PathBuilder::AddArc | ( | const Rect & | oval_bounds, |
| Radians | start, | ||
| Radians | sweep, | ||
| bool | use_center = false |
||
| ) |
Definition at line 325 of file path_builder.cc.
References Close(), impeller::TSize< T >::height, impeller::k2Pi, kArcApproximationMagic, impeller::kPiOver2, LineTo(), MoveTo(), impeller::TRect< T >::origin, impeller::Radians::radians, impeller::TRect< T >::size, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::DlDispatcher::drawArc().
| PathBuilder & impeller::PathBuilder::AddCircle | ( | const Point & | center, |
| Scalar | radius | ||
| ) |
Definition at line 198 of file path_builder.cc.
References AddOval(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by impeller::Canvas::DrawCircle(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| 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 172 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 433 of file path_builder.cc.
References MoveTo().
Referenced by impeller::DlDispatcher::drawLine(), impeller::DlDispatcher::drawPoints(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddOval | ( | const Rect & | rect | ) |
Definition at line 385 of file path_builder.cc.
References Close(), impeller::TSize< T >::height, kArcApproximationMagic, MoveTo(), impeller::TRect< T >::origin, impeller::TRect< T >::size, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by AddCircle(), impeller::DlDispatcher::drawOval(), and impeller::testing::TEST().
| PathBuilder & impeller::PathBuilder::AddPath | ( | const Path & | path | ) |
Definition at line 443 of file path_builder.cc.
References impeller::Path::EnumerateComponents().
Referenced by impeller::DlDispatcher::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 166 of file path_builder.cc.
References MoveTo().
Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddRect | ( | Rect | rect | ) |
Definition at line 181 of file path_builder.cc.
References Close(), impeller::TSize< T >::height, MoveTo(), impeller::TRect< T >::origin, impeller::TRect< T >::size, and impeller::TSize< T >::width.
Referenced by AddRoundedRect(), impeller::testing::CreatePassWithRectPath(), impeller::Canvas::DrawRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
| RoundingRadii | radii | ||
| ) |
Definition at line 207 of file path_builder.cc.
References AddRect(), impeller::PathBuilder::RoundingRadii::AreAllZero(), impeller::PathBuilder::RoundingRadii::bottom_left, impeller::PathBuilder::RoundingRadii::bottom_right, Close(), impeller::TSize< T >::height, MoveTo(), impeller::TRect< T >::origin, impeller::TRect< T >::size, impeller::PathBuilder::RoundingRadii::top_left, impeller::PathBuilder::RoundingRadii::top_right, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
Referenced by AddRoundedRect(), impeller::Canvas::ClipRRect(), impeller::Canvas::DrawRRect(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().
| PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
| Scalar | radius | ||
| ) |
| PathBuilder & impeller::PathBuilder::Close | ( | ) |
Definition at line 39 of file path_builder.cc.
References LineTo().
Referenced by AddArc(), AddOval(), AddRect(), AddRoundedRect(), impeller::Close(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().
| Path impeller::PathBuilder::CopyPath | ( | FillType | fill = FillType::kNonZero | ) | const |
Definition at line 15 of file path_builder.cc.
Referenced by impeller::Tessellate().
| 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 116 of file path_builder.cc.
Referenced by impeller::CubicTo(), SmoothCubicCurveTo(), and impeller::skia_conversions::ToPath().
| const Path & impeller::PathBuilder::GetCurrentPath | ( | ) | const |
Definition at line 439 of file path_builder.cc.
| PathBuilder & impeller::PathBuilder::HorizontalLineTo | ( | Scalar | x, |
| bool | relative = false |
||
| ) |
Definition at line 53 of file path_builder.cc.
References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
| 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 46 of file path_builder.cc.
Referenced by AddArc(), Close(), impeller::LineTo(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().
| PathBuilder & impeller::PathBuilder::MoveTo | ( | Point | point, |
| bool | relative = false |
||
| ) |
Definition at line 32 of file path_builder.cc.
Referenced by AddArc(), AddCubicCurve(), AddLine(), AddOval(), AddQuadraticCurve(), AddRect(), AddRoundedRect(), impeller::MoveTo(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().
| 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 69 of file path_builder.cc.
Referenced by SmoothQuadraticCurveTo(), and impeller::skia_conversions::ToPath().
| 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 465 of file path_builder.cc.
Referenced by impeller::skia_conversions::ToPath().
| PathBuilder & impeller::PathBuilder::SetConvexity | ( | Convexity | value | ) |
Definition at line 111 of file path_builder.cc.
Referenced by impeller::Canvas::ClipRRect(), impeller::Canvas::DrawCircle(), impeller::DlDispatcher::drawLine(), impeller::DlDispatcher::drawOval(), impeller::Canvas::DrawRRect(), impeller::testing::TEST_P(), 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 460 of file path_builder.cc.
Referenced by impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
| PathBuilder & impeller::PathBuilder::SmoothCubicCurveTo | ( | Point | controlPoint2, |
| Point | point, | ||
| bool | relative = false |
||
| ) |
| PathBuilder & impeller::PathBuilder::SmoothQuadraticCurveTo | ( | Point | point, |
| bool | relative = false |
||
| ) |
| Path impeller::PathBuilder::TakePath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 21 of file path_builder.cc.
Referenced by impeller::Canvas::ClipRRect(), impeller::DlDispatcher::drawArc(), impeller::Canvas::DrawCircle(), impeller::DlDispatcher::drawDRRect(), impeller::DlDispatcher::drawLine(), impeller::DlDispatcher::drawOval(), impeller::DlDispatcher::drawPoints(), 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 61 of file path_builder.cc.
References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
|
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 22 of file path_builder.h.