| 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_arcTo_2_c, 256, 256, true, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPath path = SkPathBuilder() |
| 7 |
.moveTo({156, 20}) |
| 8 |
.arcTo({200, 20}, {170, 50}, 50) |
| 9 |
.detach(); |
| 10 |
SkPath::Iter iter(path, false); |
| 11 |
while (auto rec = iter.next()) { |
| 12 |
SkSpan<const SkPoint> p = rec->fPoints; |
| 13 |
switch (rec->fVerb) { |
| 14 |
case SkPathVerb::kMove: |
| 15 |
SkDebugf("move to (%g,%g)\n", p[0].fX, p[0].fY); |
| 16 |
break; |
| 17 |
case SkPathVerb::kLine: |
| 18 |
SkDebugf("line (%g,%g),(%g,%g)\n", p[0].fX, p[0].fY, p[1].fX, p[1].fY); |
| 19 |
break; |
| 20 |
case SkPathVerb::kConic: |
| 21 |
SkDebugf("conic (%g,%g),(%g,%g),(%g,%g) weight %g\n", |
| 22 |
p[0].fX, p[0].fY, p[1].fX, p[1].fY, p[2].fX, p[2].fY, rec->conicWeight()); |
| 23 |
break; |
| 24 |
default: |
| 25 |
SkDebugf("unexpected verb\n"); |
| 26 |
} |
| 27 |
} |
| 28 |
} |
| 29 |
} // END FIDDLE |