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

Go to the source code of this file.

Functions

 REG_FIDDLE (Shader_Methods_a, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Shader_Methods_a  ,
256  ,
256  ,
false  ,
 
)

Definition at line 5 of file Shader_Methods_a.cpp.

5 {
6void draw(SkCanvas* canvas) {
8 SkPoint center = { 50, 50 };
9 SkScalar radius = 50;
10 const SkColor colors[] = { 0xFFFFFFFF, 0xFF000000 };
11 paint.setShader(SkGradientShader::MakeRadial(center, radius, colors,
12 nullptr, std::size(colors), SkTileMode::kClamp));
13 for (SkScalar a : { 0.3f, 0.6f, 1.0f } ) {
14 paint.setAlpha((int) (a * 255));
15 canvas->drawCircle(center.fX, center.fY, radius, paint);
16 canvas->translate(70, 70);
17 }
18}
19} // END FIDDLE
uint32_t SkColor
Definition SkColor.h:37
static SkScalar center(float pos0, float pos1)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, 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)
const Paint & paint
float SkScalar
Definition extension.cpp:12
struct MyStruct a[10]
PODArray< SkColor > colors
Definition SkRecords.h:276