Flutter Engine
The Flutter Engine
Functions
not_path_gradient.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (not_path_gradient, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( not_path_gradient  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file not_path_gradient.cpp.

4 {
5SkPath star() {
6 const SkScalar R = 60.0f, C = 128.0f;
8 path.moveTo(C + R, C);
9 for (int i = 1; i < 15; ++i) {
10 SkScalar a = 0.44879895f * i;
11 SkScalar r = R + R * (i % 2);
12 path.lineTo(C + r * cos(a), C + r * sin(a));
13 }
14 return path;
15}
16void draw(SkCanvas* canvas) {
18 paint.setPathEffect(SkDiscretePathEffect::Make(10.0f, 4.0f));
19 SkPoint points[2] = {SkPoint::Make(0.0f, 0.0f), SkPoint::Make(256.0f, 256.0f)};
21 paint.setStrokeWidth(10);
22 SkColor colors[2] = {SkColorSetRGB(0xEA, 0xD2, 0xAC), SkColorSetRGB(0x42, 0x81, 0xA4)};
24 points, colors, nullptr, 2, SkTileMode::kClamp, 0, nullptr));
25 paint.setAntiAlias(true);
26 canvas->clear(SK_ColorWHITE);
27 SkPath path(star());
28 canvas->drawPath(path, paint);
29}
30} // END FIDDLE
static const int points[]
uint32_t SkColor
Definition: SkColor.h:37
#define SkColorSetRGB(r, g, b)
Definition: SkColor.h:57
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
static sk_sp< SkPathEffect > Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist=0)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
struct MyStruct a[10]
#define R(r)
PODArray< SkColor > colors
Definition: SkRecords.h:276
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
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173