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 | |
| class | ComponentIterator |
| struct | Polyline |
| struct | PolylineContour |
Public Types | |
| enum class | ComponentType { kLinear , kQuadratic , kConic , kCubic , kContour } |
Public Member Functions | |
| Path () | |
| ~Path () | |
| size_t | GetComponentCount (std::optional< ComponentType > type={}) const |
| size_t | GetPointCount () const |
| FillType | GetFillType () const |
| bool | IsConvex () const |
| bool | IsEmpty () const |
| bool | IsSingleContour () const |
| Whether the line contains a single contour. More... | |
| ComponentIterator | begin () const |
| ComponentIterator | end () const |
| Polyline | CreatePolyline (Scalar scale, Polyline::PointBufferPtr point_buffer=std::make_unique< std::vector< Point >>(), Polyline::ReclaimPointBufferCallback reclaim=nullptr) const |
| void | EndContour (size_t storage_offset, Polyline &polyline, size_t component_index, std::vector< PolylineContour::Component > &poly_components) const |
| std::optional< Rect > | GetBoundingBox () const |
| std::optional< Rect > | GetTransformedBoundingBox (const Matrix &transform) const |
| void | WritePolyline (Scalar scale, VertexWriter &writer) const |
| std::pair< size_t, size_t > | CountStorage (Scalar scale) const |
| Determine required storage for points and number of contours. More... | |
Static Public Member Functions | |
| static constexpr size_t | VerbToOffset (Path::ComponentType verb) |
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.
|
strong |
|
default |
| Path::ComponentIterator impeller::Path::begin | ( | ) | const |
Definition at line 253 of file path.cc.
Referenced by impeller::testing::TEST().
| std::pair< size_t, size_t > impeller::Path::CountStorage | ( | Scalar | scale | ) | const |
Determine required storage for points and number of contours.
Determine required storage for points and indices.
Definition at line 129 of file path.cc.
References impeller::QuadraticPathComponent::CountLinearPathComponents(), impeller::ConicPathComponent::CountLinearPathComponents(), impeller::CubicPathComponent::CountLinearPathComponents(), kConic, kContour, kCubic, kLinear, kQuadratic, scale, and VerbToOffset().
Referenced by impeller::Tessellator::TessellateConvex(), and impeller::testing::TEST().
| 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 355 of file path.cc.
References impeller::CubicPathComponent::AppendPolylinePoints(), impeller::QuadraticPathComponent::AppendPolylinePoints(), impeller::ConicPathComponent::AppendPolylinePoints(), impeller::LinearPathComponent::AppendPolylinePoints(), EndContour(), kConic, kContour, kCubic, kLinear, kQuadratic, polyline, scale, impeller::Path::PolylineContour::start_index, and VerbToOffset().
Referenced by impeller::Tessellator::CreateTempPolyline(), impeller::TessellatorLibtess::Tessellate(), and impeller::testing::TEST().
| Path::ComponentIterator impeller::Path::end | ( | ) | const |
| void impeller::Path::EndContour | ( | size_t | storage_offset, |
| Polyline & | polyline, | ||
| size_t | component_index, | ||
| std::vector< PolylineContour::Component > & | poly_components | ||
| ) | const |
Definition at line 281 of file path.cc.
References impeller::LinearPathComponent::GetEndDirection(), impeller::QuadraticPathComponent::GetEndDirection(), impeller::ConicPathComponent::GetEndDirection(), impeller::CubicPathComponent::GetEndDirection(), kConic, kContour, kCubic, kLinear, kQuadratic, polyline, and VerbToOffset().
Referenced by CreatePolyline().
| std::optional< Rect > impeller::Path::GetBoundingBox | ( | ) | const |
Definition at line 466 of file path.cc.
Referenced by GetTransformedBoundingBox(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| size_t impeller::Path::GetComponentCount | ( | std::optional< ComponentType > | type = {} | ) | const |
| FillType impeller::Path::GetFillType | ( | ) | const |
Definition at line 110 of file path.cc.
Referenced by impeller::TessellatorLibtess::Tessellate().
| size_t impeller::Path::GetPointCount | ( | ) | const |
| bool impeller::Path::IsConvex | ( | ) | const |
| bool impeller::Path::IsSingleContour | ( | ) | const |
Whether the line contains a single contour.
Definition at line 124 of file path.cc.
Referenced by impeller::testing::TEST().
|
inlinestaticconstexpr |
Definition at line 95 of file path.h.
References kConic, kContour, kCubic, kLinear, and kQuadratic.
Referenced by impeller::PathBuilder::AddPath(), CountStorage(), CreatePolyline(), EndContour(), impeller::Path::ComponentIterator::operator++(), impeller::PathBuilder::Shift(), and WritePolyline().
| void impeller::Path::WritePolyline | ( | Scalar | scale, |
| VertexWriter & | writer | ||
| ) | const |
Generate a polyline into the temporary storage held by the [writer].
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 174 of file path.cc.
References impeller::VertexWriter::EndContour(), kConic, kContour, kCubic, kLinear, kQuadratic, impeller::LinearPathComponent::p1, impeller::QuadraticPathComponent::p1, impeller::ConicPathComponent::p1, impeller::CubicPathComponent::p1, impeller::LinearPathComponent::p2, scale, impeller::CubicPathComponent::ToLinearPathComponents(), impeller::QuadraticPathComponent::ToLinearPathComponents(), impeller::ConicPathComponent::ToLinearPathComponents(), VerbToOffset(), and impeller::VertexWriter::Write().
Referenced by impeller::Tessellator::GenerateLineStrip(), impeller::Tessellator::TessellateConvex(), impeller::Tessellator::TessellateConvexInternal(), and impeller::testing::TEST().
|
friend |