• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // HASH=05383441e510d54008402e128fc8ad2b
5 REG_FIDDLE(Plus, 256, 256, false, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7     canvas->drawColor(SK_ColorBLACK);
8     SkPaint paint;
9     paint.setBlendMode(SkBlendMode::kPlus);
10     for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
11         SkColor colors[] = { color, SkColorSetA(color, 192), SkColorSetA(color, 128),
12                              SkColorSetA(color, 0) };
13         paint.setShader(SkGradientShader::MakeRadial({ 64, 64}, 100,
14                 colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp));
15         canvas->drawCircle(64, 64, 100, paint);
16         canvas->translate(64, 64);
17     }
18 }
19 }  // END FIDDLE
20