Debian Codegraph @

docs/examples/Shader_Methods_a.cpp

raw
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.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(Shader_Methods_a, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 SkPoint center = { 50, 50 };
8 SkScalar radius = 50;
9 const SkColor4f colors[] = { {1,1,1,1}, {0,0,0,0} };
10 paint.setShader(SkShaders::RadialGradient(center, radius,
11 {{colors, {}, SkTileMode::kClamp}, {}}));
12 for (SkScalar a : { 0.3f, 0.6f, 1.0f } ) {
13 paint.setAlpha((int) (a * 255));
14 canvas->drawCircle(center.fX, center.fY, radius, paint);
15 canvas->translate(70, 70);
16 }
17 }
18 } // END FIDDLE