Flutter Engine
The Flutter Engine
third_party
skia
docs
examples
Matrix_postTranslate.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_postTranslate, 256, 160,
false
, 0) {
5
void
draw
(
SkCanvas
* canvas) {
6
SkPaint
paint
;
7
paint
.setAntiAlias(
true
);
8
SkRect
rect
= {20, 20, 100, 100};
9
for
(
int
i
= 0;
i
< 2; ++
i
) {
10
SkMatrix
matrix
;
11
i
== 0 ?
matrix
.reset():
matrix
.setRotate(25,
rect
.centerX(), 320);
12
{
13
SkAutoCanvasRestore
acr(canvas,
true
);
14
canvas->
concat
(
matrix
);
15
paint
.setColor(
SK_ColorGRAY
);
16
canvas->
drawRect
(
rect
,
paint
);
17
}
18
paint
.setColor(
SK_ColorRED
);
19
for
(
int
j = 0; j < 2; ++j ) {
20
SkAutoCanvasRestore
acr(canvas,
true
);
21
matrix
.postTranslate(40, 40);
22
canvas->
concat
(
matrix
);
23
canvas->
drawCircle
(0, 0, 3,
paint
);
24
}
25
}
26
}
27
}
// END FIDDLE
REG_FIDDLE
REG_FIDDLE(Matrix_postTranslate, 256, 160, false, 0)
Definition:
Matrix_postTranslate.cpp:4
SK_ColorGRAY
constexpr SkColor SK_ColorGRAY
Definition:
SkColor.h:113
SK_ColorRED
constexpr SkColor SK_ColorRED
Definition:
SkColor.h:126
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition:
aaclip.cpp:27
SkAutoCanvasRestore
Definition:
SkCanvas.h:2639
SkCanvas
Definition:
SkCanvas.h:106
SkCanvas::drawRect
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition:
SkCanvas.cpp:1673
SkCanvas::concat
void concat(const SkMatrix &matrix)
Definition:
SkCanvas.cpp:1318
SkCanvas::drawCircle
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition:
SkCanvas.cpp:2707
SkMatrix
Definition:
SkMatrix.h:54
SkPaint
Definition:
SkPaint.h:44
paint
const Paint & paint
Definition:
color_source.cc:38
examples.h
i
int i
Definition:
fl_socket_accessible.cc:18
SkRecords::matrix
unsigned useCenter Optional< SkMatrix > matrix
Definition:
SkRecords.h:258
SkRecords::rect
sk_sp< SkBlender > blender SkRect rect
Definition:
SkRecords.h:350
SkRect
Definition:
extension.cpp:13
Generated on Sun Jun 23 2024 21:55:55 for Flutter Engine by
1.9.4