Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments. These segments may be broken up by move commands, which are effectively linear commands that pick up the pen rather than continuing to draw. More...
#include <path.h>
Classes | |
| struct | Polyline |
| struct | PolylineContour |
Public Types | |
| enum | ComponentType { ComponentType::kLinear, ComponentType::kQuadratic, ComponentType::kCubic, ComponentType::kContour } |
| template<class T > | |
| using | Applier = std::function< void(size_t index, const T &component)> |
Public Member Functions | |
| Path () | |
| ~Path () | |
| Path (Path &&other)=default | |
| Path | Clone () const |
| Deeply clone this path and all data associated with it. More... | |
| size_t | GetComponentCount (std::optional< ComponentType > type={}) const |
| FillType | GetFillType () const |
| bool | IsConvex () const |
| void | EnumerateComponents (const Applier< LinearPathComponent > &linear_applier, const Applier< QuadraticPathComponent > &quad_applier, const Applier< CubicPathComponent > &cubic_applier, const Applier< ContourComponent > &contour_applier) const |
| bool | GetLinearComponentAtIndex (size_t index, LinearPathComponent &linear) const |
| bool | GetQuadraticComponentAtIndex (size_t index, QuadraticPathComponent &quadratic) const |
| bool | GetCubicComponentAtIndex (size_t index, CubicPathComponent &cubic) const |
| bool | GetContourComponentAtIndex (size_t index, ContourComponent &contour) const |
| Polyline | CreatePolyline (Scalar scale, Polyline::PointBufferPtr point_buffer=std::make_unique< std::vector< Point >>(), Polyline::ReclaimPointBufferCallback reclaim=nullptr) const |
| std::optional< Rect > | GetBoundingBox () const |
| std::optional< Rect > | GetTransformedBoundingBox (const Matrix &transform) const |
| std::optional< std::pair< Point, Point > > | GetMinMaxCoveragePoints () const |
Friends | |
| class | PathBuilder |
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments. These segments may be broken up by move commands, which are effectively linear commands that pick up the pen rather than continuing to draw.
All shapes supported by Impeller are paths either directly or via approximation (in the case of circles).
Paths are externally immutable once created, Creating paths must be done using a path builder.
| using impeller::Path::Applier = std::function<void(size_t index, const T& component)> |
|
strong |
| impeller::Path::Path | ( | ) |
|
default |
|
default |
| Path impeller::Path::Clone | ( | ) | const |
Deeply clone this path and all data associated with it.
Definition at line 76 of file path.cc.
Referenced by impeller::PathBuilder::CopyPath(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| Path::Polyline impeller::Path::CreatePolyline | ( | Scalar | scale, |
| Polyline::PointBufferPtr | point_buffer = std::make_unique<std::vector<Point>>(), |
||
| Polyline::ReclaimPointBufferCallback | reclaim = nullptr |
||
| ) | const |
Callers must provide the scale factor for how this path will be transformed.
It is suitable to use the max basis length of the matrix used to transform the path. If the provided scale is 0, curves will revert to straight lines.
Definition at line 253 of file path.cc.
References impeller::Path::Polyline::contours, kContour, kCubic, kLinear, kQuadratic, and impeller::Path::Polyline::points.
Referenced by impeller::Tessellator::Tessellate(), impeller::Tessellator::TessellateConvex(), and impeller::testing::TEST().
| void impeller::Path::EnumerateComponents | ( | const Applier< LinearPathComponent > & | linear_applier, |
| const Applier< QuadraticPathComponent > & | quad_applier, | ||
| const Applier< CubicPathComponent > & | cubic_applier, | ||
| const Applier< ContourComponent > & | contour_applier | ||
| ) | const |
Definition at line 129 of file path.cc.
References kContour, kCubic, kLinear, and kQuadratic.
Referenced by impeller::PathBuilder::AddPath(), and impeller::ComputeTessellator::Tessellate().
| std::optional< Rect > impeller::Path::GetBoundingBox | ( | ) | const |
Definition at line 388 of file path.cc.
Referenced by impeller::Canvas::ClipPath(), GetTransformedBoundingBox(), and impeller::testing::TEST().
| size_t impeller::Path::GetComponentCount | ( | std::optional< ComponentType > | type = {} | ) | const |
Definition at line 34 of file path.cc.
References kContour.
Referenced by impeller::ComputeTessellator::Tessellate().
| bool impeller::Path::GetContourComponentAtIndex | ( | size_t | index, |
| ContourComponent & | contour | ||
| ) | const |
Definition at line 220 of file path.cc.
References kContour.
Referenced by impeller::testing::TEST().
| bool impeller::Path::GetCubicComponentAtIndex | ( | size_t | index, |
| CubicPathComponent & | cubic | ||
| ) | const |
| FillType impeller::Path::GetFillType | ( | ) | const |
Definition at line 55 of file path.cc.
Referenced by impeller::Tessellator::Tessellate().
| bool impeller::Path::GetLinearComponentAtIndex | ( | size_t | index, |
| LinearPathComponent & | linear | ||
| ) | const |
Definition at line 413 of file path.cc.
References impeller::QuadraticPathComponent::Extrema(), impeller::CubicPathComponent::Extrema(), kContour, kCubic, kLinear, and kQuadratic.
| bool impeller::Path::GetQuadraticComponentAtIndex | ( | size_t | index, |
| QuadraticPathComponent & | quadratic | ||
| ) | const |
| bool impeller::Path::IsConvex | ( | ) | const |
Definition at line 59 of file path.cc.
References impeller::kConvex.
|
friend |