Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Matrix_mapVectors.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=918a9778c3d7d5cb306692784399f6dc
5REG_FIDDLE(Matrix_mapVectors, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
8 paint.setAntiAlias(true);
10 SkMatrix matrix;
11 matrix.reset();
12 const SkVector radii[] = {{8, 4}, {9, 1}, {6, 2}, {7, 3}};
13 for (int i = 0; i < 4; ++i) {
14 SkVector rScaled[4];
15 matrix.preScale(1.5f, 2.f);
16 matrix.mapVectors(rScaled, radii, std::size(radii));
17 SkRRect rrect;
18 rrect.setRectRadii({20, 20, 180, 70}, rScaled);
19 canvas->drawRRect(rrect, paint);
20 canvas->translate(0, 60);
21 }
22}
23} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition SkRRect.cpp:189
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60