Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 3 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 4 | // HASH=8b6b86f8a022811cd29a9c6ab771df12 |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(Canvas_drawOval, 256, 256, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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, SK_ARRAY_COUNT(g1Colors), |
Mike Reed | fae8fce | 2019-04-03 10:27:45 -0400 | [diff] [blame] | 16 | SkTileMode::kClamp)); |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 17 | canvas->drawOval(bounds , paint); |
| 18 | } |
| 19 | } // END FIDDLE |