#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 11 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 313 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::DlDispatcher::drawArc(), impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST(), and impeller::testing::TEST_P().
PathBuilder & impeller::PathBuilder::AddCircle | ( | const Point & | center, |
Scalar | radius | ||
) |
Definition at line 130 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(), 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 103 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 419 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 371 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 425 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 97 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 112 of file path_builder.cc.
References Close(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), LineTo(), and MoveTo().
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 145 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(), impeller::testing::TEST_P(), and impeller::skia_conversions::ToPath().
PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
Scalar | radius | ||
) |
PathBuilder & impeller::PathBuilder::AddRoundedRect | ( | Rect | rect, |
Size | radii | ||
) |
Definition at line 139 of file path_builder.cc.
References AddRect(), AddRoundedRect(), impeller::TSize< T >::height, and impeller::TSize< T >::width.
PathBuilder & impeller::PathBuilder::Close | ( | ) |
Definition at line 40 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 | ) |
Definition at line 17 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 85 of file path_builder.cc.
Referenced by impeller::CubicTo(), impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
PathBuilder & impeller::PathBuilder::HorizontalLineTo | ( | Scalar | x, |
bool | relative = false |
||
) |
Definition at line 54 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 47 of file path_builder.cc.
Referenced by AddArc(), AddRect(), 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 33 of file path_builder.cc.
Referenced by AddArc(), AddCubicCurve(), AddLine(), AddOval(), AddQuadraticCurve(), AddRect(), AddRoundedRect(), impeller::testing::MaskBlurVariantTest(), 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 70 of file path_builder.cc.
Referenced by impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
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 28 of file path_builder.cc.
Referenced by 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 453 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 80 of file path_builder.cc.
Referenced by impeller::Canvas::DrawRRect(), impeller::testing::TEST(), 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 442 of file path_builder.cc.
References offset.
Referenced by impeller::testing::TEST(), and impeller::skia_conversions::ToPath().
Path impeller::PathBuilder::TakePath | ( | FillType | fill = FillType::kNonZero | ) |
Definition at line 22 of file path_builder.cc.
Referenced by impeller::DlDispatcher::drawArc(), impeller::DlDispatcher::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 62 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.