Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Path_addRoundRect.cpp
Go to the documentation of this file.
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.
4// HASH=24736f685f265cf533f1700c042db353
5REG_FIDDLE(Path_addRoundRect, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
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
constexpr SkColor SK_ColorGRAY
Definition SkColor.h:113
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60