blob: f78e0335081a3311aa87d284dbde15a7d72162f7 [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(default3, 256, 256, false, 0) {
5SkPath star() {
6 const SkScalar R = 115.2f, C = 128.0f;
7 SkPath path;
8 path.moveTo(C + R, C);
9 for (int i = 1; i < 8; ++i) {
10 SkScalar a = 2.6927937f * i;
11 path.lineTo(C + R * cos(a), C + R * sin(a));
12 }
13 return path;
14}
15void draw(SkCanvas* canvas) {
16 SkPaint paint;
17 paint.setPathEffect(SkPathEffect::MakeSum(SkDiscretePathEffect::Make(10.0f, 4.0f),
18 SkDiscretePathEffect::Make(10.0f, 4.0f, 1245u)));
19 paint.setStyle(SkPaint::kStroke_Style);
20 paint.setStrokeWidth(2.0f);
21 paint.setAntiAlias(true);
22 paint.setColor(0xff4281A4);
23 canvas->clear(SK_ColorWHITE);
24 SkPath path(star());
25 canvas->drawPath(path, paint);
26}
27} // END FIDDLE