• 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=8b6b86f8a022811cd29a9c6ab771df12
5 REG_FIDDLE(Canvas_drawOval, 256, 256, false, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7     canvas->clear(0xFF3f5f9f);
8     SkColor  kColor1 = SkColorSetARGB(0xff, 0xff, 0x7f, 0);
9     SkColor  g1Colors[] = { kColor1, SkColorSetA(kColor1, 0x20) };
10     SkPoint  g1Points[] = { { 0, 0 }, { 0, 100 } };
11     SkScalar pos[] = { 0.2f, 1.0f };
12     SkRect bounds = SkRect::MakeWH(80, 70);
13     SkPaint paint;
14     paint.setAntiAlias(true);
15     paint.setShader(SkGradientShader::MakeLinear(g1Points, g1Colors, pos, std::size(g1Colors),
16             SkTileMode::kClamp));
17     canvas->drawOval(bounds , paint);
18 }
19 }  // END FIDDLE
20