| 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(Conic_Weight_a, 256, 256, true, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
const char* verbNames[] = { "move", "line", "quad", "conic", "cubic", "close", "done" }; |
| 7 |
SkPath path = SkPathBuilder().conicTo(20, 30, 50, 60, 1).detach(); |
| 8 |
SkPath::Iter iter(path, false); |
| 9 |
while (auto rec = iter.next()) { |
| 10 |
SkDebugf("%s ", verbNames[(int)rec->fVerb]); |
| 11 |
for (SkPoint p : rec->fPoints) { |
| 12 |
SkDebugf("{%g, %g}, ", p.fX, p.fY); |
| 13 |
} |
| 14 |
if (SkPathVerb::kConic == rec->fVerb) { |
| 15 |
SkDebugf("weight = %g", rec->conicWeight()); |
| 16 |
} |
| 17 |
SkDebugf("\n"); |
| 18 |
} |
| 19 |
} |
| 20 |
} // END FIDDLE |