blob: 0fd62e89c747ef658e01eaec51bc0e23d93b19f9 [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=24736f685f265cf533f1700c042db353
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_addRoundRect, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
7 SkPaint paint;
8 paint.setAntiAlias(true);
9 for (auto xradius : { 0, 7, 13, 20 } ) {
10 for (auto yradius : { 0, 9, 18, 40 } ) {
11 SkPath path;
12 path.addRoundRect({10, 10, 36, 46}, xradius, yradius);
13 paint.setColor(path.isRect(nullptr) ? SK_ColorRED : path.isOval(nullptr) ?
14 SK_ColorBLUE : path.isConvex() ? SK_ColorGRAY : SK_ColorGREEN);
15 canvas->drawPath(path, paint);
16 canvas->translate(64, 0);
17 }
18 canvas->translate(-256, 64);
19 }
20}
21} // END FIDDLE