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=24736f685f265cf533f1700c042db353
5 REG_FIDDLE(Path_addRoundRect, 256, 256, false, 0) {
draw(SkCanvas * canvas)6 void 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
22