blob: 570114cd0c759ac6db42827b05d604b351c4cbbf [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// 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 Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=8b6b86f8a022811cd29a9c6ab771df12
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Canvas_drawOval, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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 Reedfae8fce2019-04-03 10:27:45 -040016 SkTileMode::kClamp));
Hal Canary87515122019-03-15 14:22:51 -040017 canvas->drawOval(bounds , paint);
18}
19} // END FIDDLE