Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
skcanvas_star.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (skcanvas_star, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( skcanvas_star  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file skcanvas_star.cpp.

4 {
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)
void clear(SkColor color)
Definition SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
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
const Scalar scale