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

Go to the source code of this file.

Macros

#define SIZE   121
 

Functions

 REG_FIDDLE (radial_gradient_test, 256, 256, false, 0)
 

Macro Definition Documentation

◆ SIZE

#define SIZE   121

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( radial_gradient_test  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file radial_gradient_test.cpp.

4 {
5void draw(SkCanvas* canvas) {
6#define SIZE 121
7 SkScalar half = SIZE * 0.5f;
8 const SkColor preColor = 0xFFFF0000; // clamp color before start
9 const SkColor postColor = 0xFF0000FF; // clamp color after end
10 const SkColor color0 = 0xFF000000;
11 const SkColor color1 = 0xFF00FF00;
12
13 SkColor cs[] = {preColor, color0, color1, postColor};
14 SkScalar pos[] = {0, 0, 1, 1};
15
16 auto s = SkGradientShader::MakeRadial({half, half}, half - 10, cs, pos, 4,
18
19 SkPaint p;
21 p.setShader(s);
22 canvas->drawRect(rect, p);
23}
24} // END FIDDLE
SkPoint pos
uint32_t SkColor
Definition SkColor.h:37
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
float SkScalar
Definition extension.cpp:12
struct MyStruct s
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
#define SIZE
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609