Flutter Engine
The Flutter Engine
skcanvas_star.cpp
Go to the documentation of this file.
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.
4REG_FIDDLE(skcanvas_star, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 const SkScalar scale = 256.0f;
7 const SkScalar R = 0.45f * scale;
8 const SkScalar TAU = 6.2831853f;
10 path.moveTo(R, 0.0f);
11 for (int i = 1; i < 7; ++i) {
12 SkScalar theta = 3 * i * TAU / 7;
13 path.lineTo(R * cos(theta), R * sin(theta));
14 }
15 path.close();
16 SkPaint p;
17 p.setAntiAlias(true);
18 canvas->clear(SK_ColorWHITE);
19 canvas->translate(0.5f * scale, 0.5f * scale);
20 canvas->drawPath(path, p);
21}
22} // END FIDDLE
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
#define R(r)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
REG_FIDDLE(skcanvas_star, 256, 256, false, 0)
const Scalar scale