| 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_ArcSize, 256, 160, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPaint paint; |
| 7 |
paint.setAntiAlias(true); |
| 8 |
paint.setStyle(SkPaint::kStroke_Style); |
| 9 |
for (auto sweep: { SkPathDirection::kCW, SkPathDirection::kCCW } ) { |
| 10 |
for (auto arcSize : { SkPathBuilder::kSmall_ArcSize, SkPathBuilder::kLarge_ArcSize } ) { |
| 11 |
SkPath path = SkPathBuilder() |
| 12 |
.moveTo({120, 50}) |
| 13 |
.arcTo({70, 40}, 30, arcSize, sweep, {156, 100}) |
| 14 |
.detach(); |
| 15 |
if (SkPathDirection::kCCW == sweep && SkPathBuilder::kLarge_ArcSize == arcSize) { |
| 16 |
paint.setColor(SK_ColorBLUE); |
| 17 |
paint.setStrokeWidth(3); |
| 18 |
} |
| 19 |
canvas->drawPath(path, paint); |
| 20 |
} |
| 21 |
} |
| 22 |
} |
| 23 |
} // END FIDDLE |