Debian Codegraph @

docs/examples/SkPath_arcTo_example.cpp

raw
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 = SkPathBuilder().arcTo(oval, startAngle, sweepAngle, false).detach();
19
20 paint.setStrokeWidth(5);
21 paint.setColor(SkColorSetARGB(255, 0, 0, 255));
22 canvas->drawPath(arc, paint);
23 }
24 } // END FIDDLE