Flutter Engine
The Flutter Engine
path.cpp
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "export.h"
6#include "helpers.h"
9
10using namespace Skwasm;
11
13 return new SkPath();
14}
15
17 delete path;
18}
19
21 return new SkPath(*path);
22}
23
25 path->setFillType(fillType);
26}
27
29 return path->getFillType();
30}
31
33 path->moveTo(x, y);
34}
35
37 path->rMoveTo(x, y);
38}
39
41 path->lineTo(x, y);
42}
43
45 path->rLineTo(x, y);
46}
47
49 SkScalar x1,
50 SkScalar y1,
51 SkScalar x2,
52 SkScalar y2) {
53 path->quadTo(x1, y1, x2, y2);
54}
55
57 SkScalar x1,
58 SkScalar y1,
59 SkScalar x2,
60 SkScalar y2) {
61 path->rQuadTo(x1, y1, x2, y2);
62}
63
65 SkScalar x1,
66 SkScalar y1,
67 SkScalar x2,
68 SkScalar y2,
69 SkScalar x3,
70 SkScalar y3) {
71 path->cubicTo(x1, y1, x2, y2, x3, y3);
72}
73
75 SkScalar x1,
76 SkScalar y1,
77 SkScalar x2,
78 SkScalar y2,
79 SkScalar x3,
80 SkScalar y3) {
81 path->rCubicTo(x1, y1, x2, y2, x3, y3);
82}
83
85 SkScalar x1,
86 SkScalar y1,
87 SkScalar x2,
88 SkScalar y2,
89 SkScalar w) {
90 path->conicTo(x1, y1, x2, y2, w);
91}
92
94 SkScalar x1,
95 SkScalar y1,
96 SkScalar x2,
97 SkScalar y2,
98 SkScalar w) {
99 path->rConicTo(x1, y1, x2, y2, w);
100}
101
103 const SkRect* rect,
106 bool forceMoveTo) {
107 path->arcTo(*rect, startAngle, sweepAngle, forceMoveTo);
108}
109
111 SkScalar rx,
112 SkScalar ry,
113 SkScalar xAxisRotate,
114 SkPath::ArcSize arcSize,
115 SkPathDirection pathDirection,
116 SkScalar x,
117 SkScalar y) {
118 path->arcTo(rx, ry, xAxisRotate, arcSize, pathDirection, x, y);
119}
120
122 SkScalar rx,
123 SkScalar ry,
124 SkScalar xAxisRotate,
125 SkPath::ArcSize arcSize,
126 SkPathDirection pathDirection,
127 SkScalar x,
128 SkScalar y) {
129 path->rArcTo(rx, ry, xAxisRotate, arcSize, pathDirection, x, y);
130}
131
133 path->addRect(*rect);
134}
135
137 path->addOval(*oval, SkPathDirection::kCW, 1);
138}
139
141 const SkRect* oval,
144 path->addArc(*oval, startAngle, sweepAngle);
145}
146
148 const SkPoint* points,
149 int count,
150 bool close) {
151 path->addPoly(points, count, close);
152}
153
154SKWASM_EXPORT void path_addRRect(SkPath* path, const SkScalar* rrectValues) {
155 path->addRRect(createRRect(rrectValues), SkPathDirection::kCW);
156}
157
159 const SkPath* other,
160 const SkScalar* matrix33,
161 SkPath::AddPathMode extendPath) {
162 path->addPath(*other, createMatrix(matrix33), extendPath);
163}
164
166 path->close();
167}
168
170 path->reset();
171}
172
174 return path->contains(x, y);
175}
176
178 path->transform(createMatrix(matrix33));
179}
180
182 *rect = path->getBounds();
183}
184
186 const SkPath* path1,
187 const SkPath* path2) {
188 SkPath* output = new SkPath();
189 if (Op(*path1, *path2, operation, output)) {
190 output->setFillType(path1->getFillType());
191 return output;
192 } else {
193 delete output;
194 return nullptr;
195 }
196}
int count
Definition: FontMgrTest.cpp:50
static const int points[]
static SkPath path1()
static SkPath path2()
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
Definition: SkMD5.cpp:144
SkPathOp
Definition: SkPathOps.h:22
SkPathDirection
Definition: SkPathTypes.h:34
SkPathFillType
Definition: SkPathTypes.h:11
Definition: SkPath.h:59
SkPathFillType getFillType() const
Definition: SkPath.h:230
ArcSize
Definition: SkPath.h:923
AddPathMode
Definition: SkPath.h:1283
float SkScalar
Definition: extension.cpp:12
double y
double x
SkRect oval
Definition: SkRecords.h:249
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
SkScalar startAngle
Definition: SkRecords.h:250
SkScalar sweepAngle
Definition: SkRecords.h:251
Definition: helpers.h:12
SkRRect createRRect(const SkScalar *f)
Definition: helpers.h:19
SkMatrix createMatrix(const SkScalar *f)
Definition: helpers.h:14
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: switches.h:57
SKWASM_EXPORT SkPath * path_copy(SkPath *path)
Definition: path.cpp:20
SKWASM_EXPORT void path_relativeArcToRotated(SkPath *path, SkScalar rx, SkScalar ry, SkScalar xAxisRotate, SkPath::ArcSize arcSize, SkPathDirection pathDirection, SkScalar x, SkScalar y)
Definition: path.cpp:121
SKWASM_EXPORT void path_addRect(SkPath *path, const SkRect *rect)
Definition: path.cpp:132
SKWASM_EXPORT void path_addPolygon(SkPath *path, const SkPoint *points, int count, bool close)
Definition: path.cpp:147
SKWASM_EXPORT SkPath * path_combine(SkPathOp operation, const SkPath *path1, const SkPath *path2)
Definition: path.cpp:185
SKWASM_EXPORT void path_getBounds(SkPath *path, SkRect *rect)
Definition: path.cpp:181
SKWASM_EXPORT SkPath * path_create()
Definition: path.cpp:12
SKWASM_EXPORT void path_arcToOval(SkPath *path, const SkRect *rect, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)
Definition: path.cpp:102
SKWASM_EXPORT void path_relativeQuadraticBezierTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: path.cpp:56
SKWASM_EXPORT void path_close(SkPath *path)
Definition: path.cpp:165
SKWASM_EXPORT void path_reset(SkPath *path)
Definition: path.cpp:169
SKWASM_EXPORT void path_quadraticBezierTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: path.cpp:48
SKWASM_EXPORT void path_addArc(SkPath *path, const SkRect *oval, SkScalar startAngle, SkScalar sweepAngle)
Definition: path.cpp:140
SKWASM_EXPORT void path_relativeLineTo(SkPath *path, SkScalar x, SkScalar y)
Definition: path.cpp:44
SKWASM_EXPORT void path_setFillType(SkPath *path, SkPathFillType fillType)
Definition: path.cpp:24
SKWASM_EXPORT void path_addRRect(SkPath *path, const SkScalar *rrectValues)
Definition: path.cpp:154
SKWASM_EXPORT void path_dispose(SkPath *path)
Definition: path.cpp:16
SKWASM_EXPORT void path_addPath(SkPath *path, const SkPath *other, const SkScalar *matrix33, SkPath::AddPathMode extendPath)
Definition: path.cpp:158
SKWASM_EXPORT void path_relativeConicTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition: path.cpp:93
SKWASM_EXPORT void path_transform(SkPath *path, const SkScalar *matrix33)
Definition: path.cpp:177
SKWASM_EXPORT bool path_contains(SkPath *path, SkScalar x, SkScalar y)
Definition: path.cpp:173
SKWASM_EXPORT void path_cubicTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: path.cpp:64
SKWASM_EXPORT void path_conicTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition: path.cpp:84
SKWASM_EXPORT void path_lineTo(SkPath *path, SkScalar x, SkScalar y)
Definition: path.cpp:40
SKWASM_EXPORT SkPathFillType path_getFillType(SkPath *path)
Definition: path.cpp:28
SKWASM_EXPORT void path_relativeCubicTo(SkPath *path, SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: path.cpp:74
SKWASM_EXPORT void path_moveTo(SkPath *path, SkScalar x, SkScalar y)
Definition: path.cpp:32
SKWASM_EXPORT void path_addOval(SkPath *path, const SkRect *oval)
Definition: path.cpp:136
SKWASM_EXPORT void path_arcToRotated(SkPath *path, SkScalar rx, SkScalar ry, SkScalar xAxisRotate, SkPath::ArcSize arcSize, SkPathDirection pathDirection, SkScalar x, SkScalar y)
Definition: path.cpp:110
SKWASM_EXPORT void path_relativeMoveTo(SkPath *path, SkScalar x, SkScalar y)
Definition: path.cpp:36
SkScalar w
#define SKWASM_EXPORT
Definition: export.h:10