Flutter Engine
The Flutter Engine
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
REG_FIDDLE
(Matrix_TypeMask, 256, 256,
true
, 0) {
5
void
draw
(
SkCanvas
* canvas) {
6
auto
debugster = [](
const
char
*
prefix
,
const
SkMatrix
&
matrix
) ->
void
{
7
SkString
typeMask;
8
typeMask +=
SkMatrix::kIdentity_Mask
==
matrix
.getType() ?
"kIdentity_Mask "
:
""
;
9
typeMask +=
SkMatrix::kTranslate_Mask
&
matrix
.getType() ?
"kTranslate_Mask "
:
""
;
10
typeMask +=
SkMatrix::kScale_Mask
&
matrix
.getType() ?
"kScale_Mask "
:
""
;
11
typeMask +=
SkMatrix::kAffine_Mask
&
matrix
.getType() ?
"kAffine_Mask "
:
""
;
12
typeMask +=
SkMatrix::kPerspective_Mask
&
matrix
.getType() ?
"kPerspective_Mask"
:
""
;
13
SkDebugf
(
"after %s: %s\n"
,
prefix
, typeMask.
c_str
());
14
};
15
SkMatrix
matrix
;
16
matrix
.reset();
17
debugster(
"reset"
,
matrix
);
18
matrix
.postTranslate(1, 0);
19
debugster(
"postTranslate"
,
matrix
);
20
matrix
.postScale(2, 1);
21
debugster(
"postScale"
,
matrix
);
22
matrix
.postRotate(45);
23
debugster(
"postScale"
,
matrix
);
24
SkPoint
polys[][4] = {{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, {{0, 0}, {0, 1}, {2, 1}, {1, 0}}};
25
matrix
.setPolyToPoly(polys[0], polys[1], 4);
26
debugster(
"setPolyToPoly"
,
matrix
);
27
}
28
}
// END FIDDLE
REG_FIDDLE
REG_FIDDLE(Matrix_TypeMask, 256, 256, true, 0)
Definition:
Matrix_TypeMask.cpp:4
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
SkRecords::matrix
unsigned useCenter Optional< SkMatrix > matrix
Definition:
SkRecords.h:258
pkg-config.prefix
def prefix
Definition:
pkg-config.py:130
SkPoint
Definition:
SkPoint_impl.h:163
Generated on Sun Jun 23 2024 21:55:55 for Flutter Engine by
1.9.4