Debian Codegraph @

docs/examples/Path_addRoundRect_2.cpp

raw
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(Path_addRoundRect_2, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 SkPaint paint;
7 paint.setAntiAlias(true);
8 SkVector radii[] = { {80, 100}, {0, 0}, {40, 60}, {0, 0} };
9 SkRRect rr;
10 rr.setRectRadii({10, 10, 110, 110}, radii);
11
12 SkPathBuilder path;
13 SkMatrix rotate90;
14 rotate90.setRotate(90, 128, 128);
15 for (int i = 0; i < 4; ++i) {
16 path.addRRect(rr);
17 path.transform(rotate90);
18 }
19 canvas->drawPath(path.detach(), paint);
20 }
21 } // END FIDDLE