blob: 9bde76c4ead4badadc315db19aaae39ad2fc93c0 [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=199fe818c09026c114e165bff166a39f
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Canvas_drawRoundRect, 256, 256, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
7 SkVector radii[] = { {0, 20}, {10, 10}, {10, 20}, {10, 40} };
8 SkPaint paint;
9 paint.setStrokeWidth(15);
10 paint.setStrokeJoin(SkPaint::kRound_Join);
11 paint.setAntiAlias(true);
12 for (auto style : { SkPaint::kStroke_Style, SkPaint::kFill_Style } ) {
13 paint.setStyle(style );
14 for (size_t i = 0; i < SK_ARRAY_COUNT(radii); ++i) {
15 canvas->drawRoundRect({10, 10, 60, 40}, radii[i].fX, radii[i].fY, paint);
16 canvas->translate(0, 60);
17 }
18 canvas->translate(80, -240);
19 }
20}
21} // END FIDDLE