Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Shader_Methods_a.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=c015dc2010c15e1c00b4f7330232b0f7
5REG_FIDDLE(Shader_Methods_a, 256, 256, false, 0) {
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
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
float SkScalar
Definition extension.cpp:12
struct MyStruct a[10]