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(fivearcs, 256, 128, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6 canvas->clear(SkColorSetARGB(255, 255, 255, 255));
7 SkPaint ovalPaint;
8 ovalPaint.setAntiAlias(true);
9 ovalPaint.setStyle(SkPaint::kStroke_Style);
10 SkPaint arcPaint(ovalPaint);
11 arcPaint.setStrokeWidth(5);
12 arcPaint.setColor(SK_ColorBLUE);
13 SkRect oval = {8, 8, 56, 56};
14
15 canvas->drawOval(oval, ovalPaint);
16 SkPath arcPath;
17 arcPath.arcTo(oval, 0, 90, false);
18 canvas->drawPath(arcPath, arcPaint);
19
20 canvas->translate(64, 0);
21 canvas->drawOval(oval, ovalPaint);
22 canvas->drawArc(oval, 0, 90, false, arcPaint);
23
24 canvas->translate(64, 0);
25 canvas->drawOval(oval, ovalPaint);
26 arcPath.reset();
27 arcPath.addArc(oval, 0, 90);
28 canvas->drawPath(arcPath, arcPaint);
29
30 canvas->translate(-96, 64);
31 canvas->drawOval(oval, ovalPaint);
32 arcPath.reset();
33 arcPath.moveTo({56, 32});
34 arcPath.arcTo({56, 56}, {32, 56}, 24);
35 canvas->drawPath(arcPath, arcPaint);
36
37 canvas->translate(64, 0);
38 canvas->drawOval(oval, ovalPaint);
39 arcPath.reset();
40 arcPath.moveTo({56, 32});
41 arcPath.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPathDirection::kCW, {32, 56});
42 canvas->drawPath(arcPath, arcPaint);
43 }
44 } // END FIDDLE
45