Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_setMatrix.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=24b9cf7e6f9a08394e1e07413bd8733a
5REG_FIDDLE(Canvas_setMatrix, 256, 128, false, 0) {
6void draw(SkCanvas* canvas) {
8 SkFont font = SkFont(fontMgr->matchFamilyStyle(nullptr, {}));
9 canvas->scale(4, 6);
10 canvas->drawString("truth", 2, 10, font, paint);
11 SkMatrix matrix;
12 matrix.setScale(2.8f, 6);
13 canvas->setMatrix(matrix);
14 canvas->drawString("consequences", 2, 20, font, paint);
15}
16} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void setMatrix(const SkM44 &matrix)
void scale(SkScalar sx, SkScalar sy)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition SkCanvas.h:1803
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
const Paint & paint
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60