| 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 |
REG_FIDDLE(RRect_setRectRadii, 256, 128, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPaint paint; |
| 7 |
paint.setStrokeWidth(15); |
| 8 |
paint.setStrokeCap(SkPaint::kSquare_Cap); |
| 9 |
paint.setAntiAlias(true); |
| 10 |
float intervals[] = { 5, 21.75f }; |
| 11 |
paint.setStyle(SkPaint::kStroke_Style); |
| 12 |
paint.setPathEffect(SkDashPathEffect::Make(intervals, 0)); |
| 13 |
SkPath path; |
| 14 |
SkRRect rrect; |
| 15 |
SkVector corners[] = {{15, 17}, {17, 19}, {19, 15}, {15, 15}}; |
| 16 |
rrect.setRectRadii({20, 20, 100, 100}, corners); |
| 17 |
path = SkPath::RRect(rrect, SkPathDirection::kCW); |
| 18 |
canvas->drawPath(path, paint); |
| 19 |
path = SkPath::RRect(rrect, SkPathDirection::kCCW, 1); |
| 20 |
canvas->translate(120, 0); |
| 21 |
canvas->drawPath(path, paint); |
| 22 |
} |
| 23 |
} // END FIDDLE |