Flutter Engine
The Flutter Engine
Path_Iter_setPath.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(Path_Iter_setPath, 256, 256, true, 0) {
5void draw(SkCanvas* canvas) {
6 auto debugster = [](const char* prefix, SkPath::Iter& iter) -> void {
7 SkDebugf("%s:\n", prefix);
8 const char* verbStr[] = { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" };
9 const int pointCount[] = { 1 , 2 , 3 , 3 , 4 , 1 , 0 };
10 SkPath::Verb verb;
11 do {
12 SkPoint points[4];
13 verb = iter.next(points);
14 SkDebugf("k%s_Verb ", verbStr[(int) verb]);
15 for (int i = 0; i < pointCount[(int) verb]; ++i) {
16 SkDebugf("{%g, %g}, ", points[i].fX, points[i].fY);
17 }
18 if (SkPath::kConic_Verb == verb) {
19 SkDebugf("weight = %g", iter.conicWeight());
20 }
21 SkDebugf("\n");
22 } while (SkPath::kDone_Verb != verb);
23 SkDebugf("\n");
24 };
26 path.quadTo(10, 20, 30, 40);
27 SkPath::Iter iter(path, false);
28 debugster("quad open", iter);
30 path2.conicTo(1, 2, 3, 4, .5f);
31 iter.setPath(path2, true);
32 debugster("conic closed", iter);
33}
34} // END FIDDLE
static const int points[]
static SkPath path2()
REG_FIDDLE(Path_Iter_setPath, 256, 256, true, 0)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void setPath(const SkPath &path, bool forceClose)
Definition: SkPath.cpp:1837
Definition: SkPath.h:59
@ kConic_Verb
Definition: SkPath.h:1469
@ kDone_Verb
Definition: SkPath.h:1472
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition: SkPath.cpp:766
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