Flutter Engine
The Flutter Engine
Matrix_mapRectToQuad.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.
4REG_FIDDLE(Matrix_mapRectToQuad, 256, 192, false, 0) {
5void draw(SkCanvas* canvas) {
7 paint.setAntiAlias(true);
9 matrix.setRotate(60, 128, 128);
10 SkRect rect = {50, 50, 150, 150};
11 SkPoint pts[4];
12 matrix.mapRectToQuad(pts, rect);
13 for (int i = 0; i < 4; ++i) {
14 canvas->drawCircle(pts[i].fX, pts[i].fY, 3, paint);
15 }
16 canvas->concat(matrix);
18 canvas->drawRect(rect, paint);
19}
20} // END FIDDLE
REG_FIDDLE(Matrix_mapRectToQuad, 256, 192, false, 0)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350