blob: 905690e9e8e3ab03620e8901eef8cf2c20e51265 [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// 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"
4REG_FIDDLE(drawarcs, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 paint.setAntiAlias(true);
8 paint.setStyle(SkPaint::kStroke_Style);
9 paint.setStrokeWidth(8);
10
11 SkPath path;
12 SkRandom rand;
13
14 for (int i = 0; i < 100; ++i) {
15 SkScalar x = rand.nextUScalar1() * 200;
16 SkScalar y = rand.nextUScalar1() * 200;
17
18 path.rewind();
19 path.addArc(SkRect::MakeXYWH(x, y, 70, 70), rand.nextUScalar1() * 360,
20 rand.nextUScalar1() * 360);
21 paint.setColor(rand.nextU() | 0xFF000000);
22 canvas->drawPath(path, paint);
23 }
24}
25} // END FIDDLE