blob: b5fa8275e9c1fa8bfe24020b68cdb0ac80ee74b0 [file] [log] [blame]
Hal Canary87515122019-03-15 18:22:511// 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.
Mike Kleinc0bd9f92019-04-23 17:05:213#include "tools/fiddle/examples.h"
Hal Canarya7181e7c2019-03-18 20:06:344REG_FIDDLE(Conic_Weight_a, 256, 256, true, 0) {
Hal Canary87515122019-03-15 18:22:515void draw(SkCanvas* canvas) {
6 const char* verbNames[] = { "move", "line", "quad", "conic", "cubic", "close", "done" };
7 const int pointCount[] = { 1 , 2 , 3 , 3 , 4 , 1 , 0 };
8 SkPath path;
9 path.conicTo(20, 30, 50, 60, 1);
10 SkPath::Iter iter(path, false);
11 SkPath::Verb verb;
12 do {
13 SkPoint points[4];
14 verb = iter.next(points);
15 SkDebugf("%s ", verbNames[(int) verb]);
16 for (int i = 0; i < pointCount[(int) verb]; ++i) {
17 SkDebugf("{%g, %g}, ", points[i].fX, points[i].fY);
18 }
19 if (SkPath::kConic_Verb == verb) {
20 SkDebugf("weight = %g", iter.conicWeight());
21 }
22 SkDebugf("\n");
23 } while (SkPath::kDone_Verb != verb);
24}
25} // END FIDDLE