Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
docs
examples
Matrix_TypeMask.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.
3
#include "
tools/fiddle/examples.h
"
4
// HASH=ba19b36df8cd78586f3dff54e2d4c093
5
REG_FIDDLE
(Matrix_TypeMask, 256, 256,
true
, 0) {
6
void
draw
(
SkCanvas
* canvas) {
7
auto
debugster = [](
const
char
* prefix,
const
SkMatrix
& matrix) ->
void
{
8
SkString
typeMask;
9
typeMask +=
SkMatrix::kIdentity_Mask
== matrix.getType() ?
"kIdentity_Mask "
:
""
;
10
typeMask +=
SkMatrix::kTranslate_Mask
& matrix.getType() ?
"kTranslate_Mask "
:
""
;
11
typeMask +=
SkMatrix::kScale_Mask
& matrix.getType() ?
"kScale_Mask "
:
""
;
12
typeMask +=
SkMatrix::kAffine_Mask
& matrix.getType() ?
"kAffine_Mask "
:
""
;
13
typeMask +=
SkMatrix::kPerspective_Mask
& matrix.getType() ?
"kPerspective_Mask"
:
""
;
14
SkDebugf
(
"after %s: %s\n"
, prefix, typeMask.
c_str
());
15
};
16
SkMatrix
matrix;
17
matrix.reset();
18
debugster(
"reset"
, matrix);
19
matrix.postTranslate(1, 0);
20
debugster(
"postTranslate"
, matrix);
21
matrix.postScale(2, 1);
22
debugster(
"postScale"
, matrix);
23
matrix.postRotate(45);
24
debugster(
"postScale"
, matrix);
25
SkPoint
polys[][4] = {{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, {{0, 0}, {0, 1}, {2, 1}, {1, 0}}};
26
matrix.setPolyToPoly(polys[0], polys[1], 4);
27
debugster(
"setPolyToPoly"
, matrix);
28
}
29
}
// END FIDDLE
SkDebugf
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition
aaclip.cpp:27
SkCanvas
Definition
SkCanvas.h:106
SkMatrix
Definition
SkMatrix.h:54
SkMatrix::kPerspective_Mask
@ kPerspective_Mask
perspective SkMatrix
Definition
SkMatrix.h:196
SkMatrix::kTranslate_Mask
@ kTranslate_Mask
translation SkMatrix
Definition
SkMatrix.h:193
SkMatrix::kScale_Mask
@ kScale_Mask
scale SkMatrix
Definition
SkMatrix.h:194
SkMatrix::kIdentity_Mask
@ kIdentity_Mask
identity SkMatrix; all bits clear
Definition
SkMatrix.h:192
SkMatrix::kAffine_Mask
@ kAffine_Mask
skew or rotate SkMatrix
Definition
SkMatrix.h:195
SkString
Definition
SkString.h:118
SkString::c_str
const char * c_str() const
Definition
SkString.h:133
examples.h
REG_FIDDLE
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition
examples.h:60
SkPoint
Definition
SkPoint_impl.h:163
Generated on Fri Apr 26 2024 06:15:44 for Flutter Engine by
1.9.8