Flutter Engine
The Flutter Engine
|
Go to the source code of this file.
Functions | |
bool | SkInsetConvexPolygon (const SkPoint *inputPolygonVerts, int inputPolygonSize, SkScalar inset, SkTDArray< SkPoint > *insetPolygon) |
bool | SkOffsetSimplePolygon (const SkPoint *inputPolygonVerts, int inputPolygonSize, const SkRect &bounds, SkScalar offset, SkTDArray< SkPoint > *offsetPolygon, SkTDArray< int > *polygonIndices=nullptr) |
bool | SkComputeRadialSteps (const SkVector &offset0, const SkVector &offset1, SkScalar offset, SkScalar *rotSin, SkScalar *rotCos, int *n) |
int | SkGetPolygonWinding (const SkPoint *polygonVerts, int polygonSize) |
bool | SkIsConvexPolygon (const SkPoint *polygonVerts, int polygonSize) |
bool | SkIsSimplePolygon (const SkPoint *polygonVerts, int polygonSize) |
bool | SkTriangulateSimplePolygon (const SkPoint *polygonVerts, uint16_t *indexMap, int polygonSize, SkTDArray< uint16_t > *triangleIndices) |
bool SkComputeRadialSteps | ( | const SkVector & | offset0, |
const SkVector & | offset1, | ||
SkScalar | offset, | ||
SkScalar * | rotSin, | ||
SkScalar * | rotCos, | ||
int * | n | ||
) |
Compute the number of points needed for a circular join when offsetting a vertex. The lengths of offset0 and offset1 don't have to equal |offset| – only the direction matters. The segment lengths will be approximately four pixels.
offset0 | Starting offset vector direction. |
offset1 | Ending offset vector direction. |
offset | Offset value (can be negative). |
rotSin | Sine of rotation delta per step. |
rotCos | Cosine of rotation delta per step. |
n | Number of steps to fill out the arc. |
Definition at line 490 of file SkPolyUtils.cpp.
Determine winding direction for a polygon. The input polygon must be simple or the result will be meaningless.
polygonVerts | Array of points representing the vertices of the polygon. |
polygonSize | Number of vertices in the polygon. |
Definition at line 57 of file SkPolyUtils.cpp.
bool SkInsetConvexPolygon | ( | const SkPoint * | inputPolygonVerts, |
int | inputPolygonSize, | ||
SkScalar | inset, | ||
SkTDArray< SkPoint > * | insetPolygon | ||
) |
Generates a polygon that is inset a constant from the boundary of a given convex polygon. The input polygon is expected to have values clamped to the nearest 1/16th.
inputPolygonVerts | Array of points representing the vertices of the original polygon. It should be convex and have no coincident points. |
inputPolygonSize | Number of vertices in the original polygon. |
inset | How far we wish to inset the polygon. This should be a positive value. |
insetPolygon | The resulting inset polygon, if any. |
Definition at line 338 of file SkPolyUtils.cpp.
Determine whether a polygon is convex or not.
polygonVerts | Array of points representing the vertices of the polygon. |
polygonSize | Number of vertices in the polygon. |
Definition at line 196 of file SkPolyUtils.cpp.
Determine whether a polygon is simple (i.e., not self-intersecting) or not. The input polygon must have no coincident vertices or the test will fail. The polygon is also expected to have values clamped to the nearest 1/16th.
polygonVerts | Array of points representing the vertices of the polygon. |
polygonSize | Number of vertices in the polygon. |
Definition at line 1092 of file SkPolyUtils.cpp.
bool SkOffsetSimplePolygon | ( | const SkPoint * | inputPolygonVerts, |
int | inputPolygonSize, | ||
const SkRect & | bounds, | ||
SkScalar | offset, | ||
SkTDArray< SkPoint > * | offsetPolygon, | ||
SkTDArray< int > * | polygonIndices = nullptr |
||
) |
Generates a simple polygon (if possible) that is offset a constant distance from the boundary of a given simple polygon. The input polygon must be simple, have no coincident vertices or collinear edges, and have values clamped to the nearest 1/16th.
inputPolygonVerts | Array of points representing the vertices of the original polygon. |
inputPolygonSize | Number of vertices in the original polygon. |
bounds | Bounding rectangle for the original polygon. |
offset | How far we wish to offset the polygon. Positive values indicate insetting, negative values outsetting. |
offsetPolgon | The resulting offset polygon, if any. |
polygonIndices | The indices of the original polygon that map to the new one. |
Definition at line 1195 of file SkPolyUtils.cpp.
bool SkTriangulateSimplePolygon | ( | const SkPoint * | polygonVerts, |
uint16_t * | indexMap, | ||
int | polygonSize, | ||
SkTDArray< uint16_t > * | triangleIndices | ||
) |
Compute indices to triangulate the given polygon. The input polygon must be simple (i.e. it is not self-intersecting) and have no coincident vertices or collinear edges.
polygonVerts | Array of points representing the vertices of the polygon. |
indexMap | Mapping from index in the given array to the final index in the triangulation. |
polygonSize | Number of vertices in the polygon. |
triangleIndices | Indices of the resulting triangulation. |
Definition at line 1632 of file SkPolyUtils.cpp.