Flutter Engine
The Flutter Engine
|
An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library. More...
#include <tessellator_libtess.h>
Public Types | |
using | BuilderCallback = std::function< bool(const float *vertices, size_t vertices_count, const uint16_t *indices, size_t indices_count)> |
A callback that returns the results of the tessellation. | |
Public Types inherited from impeller::Tessellator | |
enum class | Result { kSuccess , kInputError , kTessellationError } |
using | TessellatedVertexProc = std::function< void(const Point &p)> |
A callback function for a |VertexGenerator| to deliver the vertices it computes as |Point| objects. | |
Public Member Functions | |
TessellatorLibtess () | |
~TessellatorLibtess () | |
Tessellator::Result | Tessellate (const Path &path, Scalar tolerance, const BuilderCallback &callback) |
Generates filled triangles from the path. A callback is invoked once for the entire tessellation. | |
Public Member Functions inherited from impeller::Tessellator | |
Tessellator () | |
virtual | ~Tessellator () |
std::vector< Point > | TessellateConvex (const Path &path, Scalar tolerance) |
Given a convex path, create a triangle fan structure. | |
Path::Polyline | CreateTempPolyline (const Path &path, Scalar tolerance) |
Create a temporary polyline. Only one per-process can exist at a time. | |
EllipticalVertexGenerator | FilledCircle (const Matrix &view_transform, const Point ¢er, Scalar radius) |
Create a |VertexGenerator| that can produce vertices for a filled circle of the given radius around the given center with enough polygon sub-divisions to provide reasonable fidelity when viewed under the given view transform. | |
EllipticalVertexGenerator | StrokedCircle (const Matrix &view_transform, const Point ¢er, Scalar radius, Scalar half_width) |
Create a |VertexGenerator| that can produce vertices for a stroked circle of the given radius and half_width around the given shared center with enough polygon sub-divisions to provide reasonable fidelity when viewed under the given view transform. The outer edge of the stroked circle is generated at (radius + half_width) and the inner edge is generated at (radius - half_width). | |
EllipticalVertexGenerator | RoundCapLine (const Matrix &view_transform, const Point &p0, const Point &p1, Scalar radius) |
Create a |VertexGenerator| that can produce vertices for a line with round end caps of the given radius with enough polygon sub-divisions to provide reasonable fidelity when viewed under the given view transform. | |
EllipticalVertexGenerator | FilledEllipse (const Matrix &view_transform, const Rect &bounds) |
Create a |VertexGenerator| that can produce vertices for a filled ellipse inscribed within the given bounds with enough polygon sub-divisions to provide reasonable fidelity when viewed under the given view transform. | |
EllipticalVertexGenerator | FilledRoundRect (const Matrix &view_transform, const Rect &bounds, const Size &radii) |
Create a |VertexGenerator| that can produce vertices for a filled round rect within the given bounds and corner radii with enough polygon sub-divisions to provide reasonable fidelity when viewed under the given view transform. | |
Additional Inherited Members | |
Static Public Attributes inherited from impeller::Tessellator | |
static constexpr Scalar | kCircleTolerance = 0.1f |
The pixel tolerance used by the algorighm to determine how many divisions to create for a circle. | |
Protected Attributes inherited from impeller::Tessellator | |
std::unique_ptr< std::vector< Point > > | point_buffer_ |
Used for polyline generation. | |
An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library.
This object is not thread safe, and its methods must not be called from multiple threads.
Definition at line 30 of file tessellator_libtess.h.
using impeller::TessellatorLibtess::BuilderCallback = std::function<bool(const float* vertices, size_t vertices_count, const uint16_t* indices, size_t indices_count)> |
A callback that returns the results of the tessellation.
The index buffer may not be populated, in which case [indices] will be nullptr and indices_count will be 0.
Definition at line 40 of file tessellator_libtess.h.
impeller::TessellatorLibtess::TessellatorLibtess | ( | ) |
Definition at line 34 of file tessellator_libtess.cc.
|
default |
TessellatorLibtess::Result impeller::TessellatorLibtess::Tessellate | ( | const Path & | path, |
Scalar | tolerance, | ||
const BuilderCallback & | callback | ||
) |
Generates filled triangles from the path. A callback is invoked once for the entire tessellation.
[in] | path | The path to tessellate. |
[in] | tolerance | The tolerance value for conversion of the path to a polyline. This value is often derived from the Matrix::GetMaxBasisLength of the CTM applied to the path for rendering. |
[in] | callback | The callback, return false to indicate failure. |
Feed contour information to the tessellator.
Let's tessellate.
Definition at line 56 of file tessellator_libtess.cc.