Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
path.cc File Reference
#include "flutter/skwasm/export.h"
#include "flutter/skwasm/helpers.h"
#include "flutter/skwasm/live_objects.h"
#include "third_party/skia/include/core/SkPathBuilder.h"
#include "third_party/skia/include/core/SkString.h"
#include "third_party/skia/include/pathops/SkPathOps.h"
#include "third_party/skia/include/utils/SkParsePath.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT SkPathBuilder * path_create ()
 
SKWASM_EXPORT void path_dispose (SkPathBuilder *path)
 
SKWASM_EXPORT SkPathBuilder * path_copy (SkPathBuilder *path)
 
SKWASM_EXPORT void path_setFillType (SkPathBuilder *path, SkPathFillType fill_type)
 
SKWASM_EXPORT SkPathFillType path_getFillType (SkPathBuilder *path)
 
SKWASM_EXPORT void path_moveTo (SkPathBuilder *path, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_relativeMoveTo (SkPathBuilder *path, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_lineTo (SkPathBuilder *path, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_relativeLineTo (SkPathBuilder *path, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_quadraticBezierTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
 
SKWASM_EXPORT void path_relativeQuadraticBezierTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
 
SKWASM_EXPORT void path_cubicTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
 
SKWASM_EXPORT void path_relativeCubicTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
 
SKWASM_EXPORT void path_conicTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
 
SKWASM_EXPORT void path_relativeConicTo (SkPathBuilder *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
 
SKWASM_EXPORT void path_arcToOval (SkPathBuilder *path, const SkRect *rect, SkScalar start_angle, SkScalar sweep_angle, bool force_move_to)
 
SKWASM_EXPORT void path_arcToRotated (SkPathBuilder *path, SkScalar rx, SkScalar ry, SkScalar x_axis_rotate, SkPathBuilder::ArcSize arc_size, SkPathDirection path_direction, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_relativeArcToRotated (SkPathBuilder *path, SkScalar rx, SkScalar ry, SkScalar x_axis_rotate, SkPathBuilder::ArcSize arc_size, SkPathDirection path_direction, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_addRect (SkPathBuilder *path, const SkRect *rect)
 
SKWASM_EXPORT void path_addOval (SkPathBuilder *path, const SkRect *oval)
 
SKWASM_EXPORT void path_addArc (SkPathBuilder *path, const SkRect *oval, SkScalar start_angle, SkScalar sweep_angle)
 
SKWASM_EXPORT void path_addPolygon (SkPathBuilder *path, const SkPoint *points, int count, bool close)
 
SKWASM_EXPORT void path_addRRect (SkPathBuilder *path, const SkScalar *rrect_values)
 
SKWASM_EXPORT void path_addPath (SkPathBuilder *path, const SkPathBuilder *other, const SkScalar *matrix_33, SkPath::AddPathMode extend_path)
 
SKWASM_EXPORT void path_close (SkPathBuilder *path)
 
SKWASM_EXPORT void path_reset (SkPathBuilder *path)
 
SKWASM_EXPORT bool path_contains (SkPathBuilder *path, SkScalar x, SkScalar y)
 
SKWASM_EXPORT void path_transform (SkPathBuilder *path, const SkScalar *matrix_33)
 
SKWASM_EXPORT void path_getBounds (SkPathBuilder *path, SkRect *rect)
 
SKWASM_EXPORT SkPathBuilder * path_combine (SkPathOp operation, const SkPathBuilder *path1, const SkPathBuilder *path2)
 
SKWASM_EXPORT SkString * path_getSvgString (SkPathBuilder *path)
 

Function Documentation

◆ path_addArc()

SKWASM_EXPORT void path_addArc ( SkPathBuilder *  path,
const SkRect *  oval,
SkScalar  start_angle,
SkScalar  sweep_angle 
)

Definition at line 149 of file path.cc.

152 {
153 path->addArc(*oval, start_angle, sweep_angle);
154}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switch_defs.h:52

◆ path_addOval()

SKWASM_EXPORT void path_addOval ( SkPathBuilder *  path,
const SkRect *  oval 
)

Definition at line 145 of file path.cc.

145 {
146 path->addOval(*oval, SkPathDirection::kCW, 1);
147}

◆ path_addPath()

SKWASM_EXPORT void path_addPath ( SkPathBuilder *  path,
const SkPathBuilder *  other,
const SkScalar *  matrix_33,
SkPath::AddPathMode  extend_path 
)

Definition at line 168 of file path.cc.

171 {
172 path->addPath(other->snapshot(), Skwasm::CreateSkMatrix(matrix_33),
173 extend_path);
174}
SkMatrix CreateSkMatrix(const SkScalar *f)
Definition helpers.h:40

References Skwasm::CreateSkMatrix().

◆ path_addPolygon()

SKWASM_EXPORT void path_addPolygon ( SkPathBuilder *  path,
const SkPoint *  points,
int  count,
bool  close 
)

Definition at line 156 of file path.cc.

159 {
160 path->addPolygon({points, count}, close);
161}
std::vector< Point > points

References points.

◆ path_addRect()

SKWASM_EXPORT void path_addRect ( SkPathBuilder *  path,
const SkRect *  rect 
)

Definition at line 141 of file path.cc.

141 {
142 path->addRect(*rect);
143}

◆ path_addRRect()

SKWASM_EXPORT void path_addRRect ( SkPathBuilder *  path,
const SkScalar *  rrect_values 
)

Definition at line 163 of file path.cc.

164 {
165 path->addRRect(Skwasm::CreateSkRRect(rrect_values), SkPathDirection::kCW);
166}
SkRRect CreateSkRRect(const SkScalar *f)
Definition helpers.h:66

References Skwasm::CreateSkRRect().

◆ path_arcToOval()

SKWASM_EXPORT void path_arcToOval ( SkPathBuilder *  path,
const SkRect *  rect,
SkScalar  start_angle,
SkScalar  sweep_angle,
bool  force_move_to 
)

Definition at line 111 of file path.cc.

115 {
116 path->arcTo(*rect, start_angle, sweep_angle, force_move_to);
117}

◆ path_arcToRotated()

SKWASM_EXPORT void path_arcToRotated ( SkPathBuilder *  path,
SkScalar  rx,
SkScalar  ry,
SkScalar  x_axis_rotate,
SkPathBuilder::ArcSize  arc_size,
SkPathDirection  path_direction,
SkScalar  x,
SkScalar  y 
)

Definition at line 119 of file path.cc.

126 {
127 path->arcTo({rx, ry}, x_axis_rotate, arc_size, path_direction, {x, y});
128}
int32_t x
double y

References x, and y.

◆ path_close()

SKWASM_EXPORT void path_close ( SkPathBuilder *  path)

Definition at line 176 of file path.cc.

176 {
177 path->close();
178}

◆ path_combine()

SKWASM_EXPORT SkPathBuilder * path_combine ( SkPathOp  operation,
const SkPathBuilder *  path1,
const SkPathBuilder *  path2 
)

Definition at line 197 of file path.cc.

199 {
200 if (auto result = Op(path1->snapshot(), path2->snapshot(), operation)) {
202 SkPathBuilder* output = new SkPathBuilder(result.value());
203 output->setFillType(path1->fillType());
204 return output;
205 } else {
206 return nullptr;
207 }
208}
uint32_t live_path_count
void Op(SkPathBuilder *one, SkPathBuilder *two, SkPathOp op)
Definition path_ops.cc:44

References Skwasm::live_path_count.

◆ path_conicTo()

SKWASM_EXPORT void path_conicTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  w 
)

Definition at line 93 of file path.cc.

98 {
99 path->conicTo({x1, y1}, {x2, y2}, w);
100}

◆ path_contains()

SKWASM_EXPORT bool path_contains ( SkPathBuilder *  path,
SkScalar  x,
SkScalar  y 
)

Definition at line 184 of file path.cc.

184 {
185 return path->contains({x, y});
186}

References x, and y.

◆ path_copy()

SKWASM_EXPORT SkPathBuilder * path_copy ( SkPathBuilder *  path)

Definition at line 23 of file path.cc.

23 {
25 return new SkPathBuilder(path->snapshot());
26}

References Skwasm::live_path_count.

◆ path_create()

SKWASM_EXPORT SkPathBuilder * path_create ( )

Definition at line 13 of file path.cc.

13 {
15 return new SkPathBuilder();
16}

References Skwasm::live_path_count.

◆ path_cubicTo()

SKWASM_EXPORT void path_cubicTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  x3,
SkScalar  y3 
)

Definition at line 73 of file path.cc.

79 {
80 path->cubicTo({x1, y1}, {x2, y2}, {x3, y3});
81}

◆ path_dispose()

SKWASM_EXPORT void path_dispose ( SkPathBuilder *  path)

Definition at line 18 of file path.cc.

18 {
20 delete path;
21}

References Skwasm::live_path_count.

◆ path_getBounds()

SKWASM_EXPORT void path_getBounds ( SkPathBuilder *  path,
SkRect *  rect 
)

Definition at line 193 of file path.cc.

193 {
194 *rect = path->computeFiniteBounds().value_or(SkRect());
195}

◆ path_getFillType()

SKWASM_EXPORT SkPathFillType path_getFillType ( SkPathBuilder *  path)

Definition at line 33 of file path.cc.

33 {
34 return path->fillType();
35}

◆ path_getSvgString()

SKWASM_EXPORT SkString * path_getSvgString ( SkPathBuilder *  path)

Definition at line 210 of file path.cc.

210 {
212 SkString* string = new SkString(SkParsePath::ToSVGString(path->snapshot()));
213 return string;
214}
uint32_t live_string_count

References Skwasm::live_string_count.

◆ path_lineTo()

SKWASM_EXPORT void path_lineTo ( SkPathBuilder *  path,
SkScalar  x,
SkScalar  y 
)

Definition at line 47 of file path.cc.

47 {
48 path->lineTo({x, y});
49}

References x, and y.

◆ path_moveTo()

SKWASM_EXPORT void path_moveTo ( SkPathBuilder *  path,
SkScalar  x,
SkScalar  y 
)

Definition at line 37 of file path.cc.

37 {
38 path->moveTo({x, y});
39}

References x, and y.

◆ path_quadraticBezierTo()

SKWASM_EXPORT void path_quadraticBezierTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2 
)

Definition at line 57 of file path.cc.

61 {
62 path->quadTo({x1, y1}, {x2, y2});
63}

◆ path_relativeArcToRotated()

SKWASM_EXPORT void path_relativeArcToRotated ( SkPathBuilder *  path,
SkScalar  rx,
SkScalar  ry,
SkScalar  x_axis_rotate,
SkPathBuilder::ArcSize  arc_size,
SkPathDirection  path_direction,
SkScalar  x,
SkScalar  y 
)

Definition at line 130 of file path.cc.

137 {
138 path->rArcTo({rx, ry}, x_axis_rotate, arc_size, path_direction, {x, y});
139}

References x, and y.

◆ path_relativeConicTo()

SKWASM_EXPORT void path_relativeConicTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  w 
)

Definition at line 102 of file path.cc.

107 {
108 path->rConicTo({x1, y1}, {x2, y2}, w);
109}

◆ path_relativeCubicTo()

SKWASM_EXPORT void path_relativeCubicTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  x3,
SkScalar  y3 
)

Definition at line 83 of file path.cc.

89 {
90 path->rCubicTo({x1, y1}, {x2, y2}, {x3, y3});
91}

◆ path_relativeLineTo()

SKWASM_EXPORT void path_relativeLineTo ( SkPathBuilder *  path,
SkScalar  x,
SkScalar  y 
)

Definition at line 51 of file path.cc.

53 {
54 path->rLineTo({x, y});
55}

References x, and y.

◆ path_relativeMoveTo()

SKWASM_EXPORT void path_relativeMoveTo ( SkPathBuilder *  path,
SkScalar  x,
SkScalar  y 
)

Definition at line 41 of file path.cc.

43 {
44 path->rMoveTo({x, y});
45}

References x, and y.

◆ path_relativeQuadraticBezierTo()

SKWASM_EXPORT void path_relativeQuadraticBezierTo ( SkPathBuilder *  path,
SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2 
)

Definition at line 65 of file path.cc.

69 {
70 path->rQuadTo({x1, y1}, {x2, y2});
71}

◆ path_reset()

SKWASM_EXPORT void path_reset ( SkPathBuilder *  path)

Definition at line 180 of file path.cc.

180 {
181 path->reset();
182}

◆ path_setFillType()

SKWASM_EXPORT void path_setFillType ( SkPathBuilder *  path,
SkPathFillType  fill_type 
)

Definition at line 28 of file path.cc.

29 {
30 path->setFillType(fill_type);
31}

◆ path_transform()

SKWASM_EXPORT void path_transform ( SkPathBuilder *  path,
const SkScalar *  matrix_33 
)

Definition at line 188 of file path.cc.

189 {
190 path->transform(Skwasm::CreateSkMatrix(matrix_33));
191}

References Skwasm::CreateSkMatrix().