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(skcanvas_star, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 const SkScalar scale = 256.0f;
7 const SkScalar R = 0.45f * scale;
8 const SkScalar TAU = 6.2831853f;
11 for (int i = 1; i < 7; ++i) {
12 SkScalar theta = 3 * i * TAU / 7;
13 path.lineTo(R * cos(theta), R * sin(theta));
18 canvas->clear(SK_ColorWHITE);
19 canvas->translate(0.5f * scale, 0.5f * scale);
20 canvas->drawPath(path, p);