• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(drawarcs, 256, 256, false, 0) {
draw(SkCanvas * canvas)5 void 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
26