23typedef CanvasPath
Path;
27CanvasPath::CanvasPath() {
28 sk_path_.setIsVolatile(
35void CanvasPath::resetVolatility() {
40 return static_cast<int>(sk_path_.fillType());
44 sk_path_.setFillType(
static_cast<SkPathFillType
>(fill_type));
132 SafeNarrow(startAngle) * 180.0f /
static_cast<float>(M_PI),
133 SafeNarrow(sweepAngle) * 180.0f /
static_cast<float>(M_PI),
142 double xAxisRotation,
144 bool isClockwiseDirection) {
145 const auto arcSize = isLargeArc ? SkPathBuilder::ArcSize::kLarge_ArcSize
146 : SkPathBuilder::ArcSize::kSmall_ArcSize;
147 const auto direction =
148 isClockwiseDirection ? SkPathDirection::kCW : SkPathDirection::kCCW;
151 SafeNarrow(xAxisRotation), arcSize, direction,
160 double xAxisRotation,
162 bool isClockwiseDirection) {
163 const auto arcSize = isLargeArc ? SkPathBuilder::ArcSize::kLarge_ArcSize
164 : SkPathBuilder::ArcSize::kSmall_ArcSize;
165 const auto direction =
166 isClockwiseDirection ? SkPathDirection::kCW : SkPathDirection::kCCW;
168 SafeNarrow(xAxisRotation), arcSize, direction,
193 SafeNarrow(startAngle) * 180.0f /
static_cast<float>(M_PI),
194 SafeNarrow(sweepAngle) * 180.0f /
static_cast<float>(M_PI));
199 SkSpan<const SkPoint> ptsSpan = {
200 reinterpret_cast<const SkPoint*
>(
points.data()),
201 points.num_elements() / 2};
202 sk_path_.addPolygon(ptsSpan,
close);
222 Dart_ThrowException(ToDart(
"Path.addPath called with non-genuine Path."));
226 SkPath::kAppend_AddPathMode);
233 Dart_Handle matrix4_handle) {
234 tonic::Float64List matrix4(matrix4_handle);
239 ToDart(
"Path.addPathWithMatrix called with non-genuine Path."));
245 matrix.setTranslateX(matrix.getTranslateX() +
SafeNarrow(dx));
246 matrix.setTranslateY(matrix.getTranslateY() +
SafeNarrow(dy));
248 SkPath::kAppend_AddPathMode);
255 ToDart(
"Path.extendWithPath called with non-genuine Path."));
259 SkPath::kExtend_AddPathMode);
266 Dart_Handle matrix4_handle) {
267 tonic::Float64List matrix4(matrix4_handle);
272 ToDart(
"Path.addPathWithMatrix called with non-genuine Path."));
278 matrix.setTranslateX(matrix.getTranslateX() +
SafeNarrow(dx));
279 matrix.setTranslateY(matrix.getTranslateY() +
SafeNarrow(dy));
281 SkPath::kExtend_AddPathMode);
301 path->sk_path_ = sk_path_;
306 Dart_Handle matrix4_handle) {
307 tonic::Float64List matrix4(matrix4_handle);
311 path->sk_path_ = sk_path_;
316 tonic::Float32List rect(Dart_NewTypedData(Dart_TypedData_kFloat32, 4));
317 const SkRect& bounds = sk_path_.computeFiniteBounds().value_or(SkRect());
318 rect[0] = bounds.left();
319 rect[1] = bounds.top();
320 rect[2] = bounds.right();
321 rect[3] = bounds.bottom();
326 std::optional<SkPath> result =
328 static_cast<SkPathOp
>(operation));
330 sk_path_ = result.value();
341 path->sk_path_ = this->sk_path_;
345 if (!dl_path_.has_value()) {
346 dl_path_.emplace(sk_path_.snapshot());
348 return dl_path_.value();
void moveTo(double x, double y)
tonic::Float32List getBounds()
void shift(Dart_Handle path_handle, double dx, double dy)
static fml::RefPtr< CanvasPath > Create(Dart_Handle wrapper)
const DlPath & path() const
void relativeLineTo(double x, double y)
void clone(Dart_Handle path_handle)
void addRect(double left, double top, double right, double bottom)
void relativeQuadraticBezierTo(double x1, double y1, double x2, double y2)
void relativeArcToPoint(double arcEndDeltaX, double arcEndDeltaY, double radiusX, double radiusY, double xAxisRotation, bool isLargeArc, bool isClockwiseDirection)
void conicTo(double x1, double y1, double x2, double y2, double w)
void addPathWithMatrix(CanvasPath *path, double dx, double dy, Dart_Handle matrix4_handle)
bool contains(double x, double y)
void addRSuperellipse(const RSuperellipse *rse)
void addArc(double left, double top, double right, double bottom, double startAngle, double sweepAngle)
void relativeConicTo(double x1, double y1, double x2, double y2, double w)
void relativeMoveTo(double x, double y)
void lineTo(double x, double y)
void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3)
void quadraticBezierTo(double x1, double y1, double x2, double y2)
bool op(CanvasPath *path1, CanvasPath *path2, int operation)
void arcToPoint(double arcEndX, double arcEndY, double radiusX, double radiusY, double xAxisRotation, bool isLargeArc, bool isClockwiseDirection)
void extendWithPath(CanvasPath *path, double dx, double dy)
void relativeCubicTo(double x1, double y1, double x2, double y2, double x3, double y3)
void addPolygon(const tonic::Float32List &points, bool close)
void addPath(CanvasPath *path, double dx, double dy)
void extendWithPathAndMatrix(CanvasPath *path, double dx, double dy, Dart_Handle matrix4_handle)
void addRRect(const RRect &rrect)
void setFillType(int fill_type)
void transform(Dart_Handle path_handle, Dart_Handle matrix4_handle)
void addOval(double left, double top, double right, double bottom)
void arcTo(double left, double top, double right, double bottom, double startAngle, double sweepAngle, bool forceMoveTo)
DlPathBuilder & AddRoundSuperellipse(const DlRoundSuperellipse &rse)
Append a closed rounded super-ellipse contour to the path.
const DlPath TakePath()
Returns the path constructed by this path builder and resets its internal state to the default state ...
const SkPath & GetSkPath() const
flutter::DlRect bounds() const
impeller::RoundingRadii radii() const
static UIDartState * Current()
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
void Op(SkPathBuilder *one, SkPathBuilder *two, SkPathOp op)
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
SkMatrix ToSkMatrix(const DlMatrix &matrix)
static float SafeNarrow(double value)
const SkRRect ToSkRRect(const DlRoundRect &round_rect)
Dart_Handle ToDart(const T &object)
static RoundSuperellipse MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
std::vector< Point > points