Debian Codegraph @

docs/examples/Path_Iter_next.cpp

raw
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.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(Path_Iter_next, 256, 256, true, 0) {
5 void draw(SkCanvas* canvas) {
6 SkPath path = SkPathBuilder()
7 .moveTo(10, 10)
8 .moveTo(20, 20)
9 .quadTo(10, 20, 30, 40)
10 .moveTo(1, 1)
11 .close()
12 .moveTo(30, 30)
13 .lineTo(30.00001f, 30)
14 .detach();
15
16 SkPath::Iter iter(path, false);
17 const char* verbStr[] = { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" };
18 while (auto rec = iter.next()) {
19 SkDebugf("k%s_Verb ", verbStr[(int)rec->fVerb]);
20 for (SkPoint p : rec->fPoints) {
21 SkDebugf("{%1.8g, %1.8g}, ", p.fX, p.fY);
22 }
23 SkDebugf("\n");
24 }
25 SkDebugf("\n");
26 }
27 } // END FIDDLE