Hal Canary | 6c8422c | 2020-01-10 15:22:09 -0500 | [diff] [blame] | 1 | // Copyright 2020 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(SkPath_arcTo_example, 512, 512, false, 0) { |
| 5 | void draw(SkCanvas* canvas) { |
| 6 | canvas->clear(SkColorSetARGB(255, 255, 255, 255)); |
| 7 | |
| 8 | SkPaint paint; |
| 9 | paint.setAntiAlias(true); |
| 10 | paint.setStyle(SkPaint::kStroke_Style); |
| 11 | paint.setStrokeWidth(2.5); |
| 12 | |
| 13 | SkRect oval = {64, 64, 448, 448}; |
| 14 | canvas->drawOval(oval, paint); |
| 15 | float startAngle = 0; |
| 16 | float sweepAngle = 60; |
| 17 | |
| 18 | SkPath arc; |
| 19 | arc.arcTo(oval, startAngle, sweepAngle, false); |
| 20 | |
| 21 | paint.setStrokeWidth(5); |
| 22 | paint.setColor(SkColorSetARGB(255, 0, 0, 255)); |
| 23 | canvas->drawPath(arc, paint); |
| 24 | } |
| 25 | } // END FIDDLE |