Flutter Engine
The Flutter Engine
Functions
Matrix_preTranslate.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Matrix_preTranslate, 256, 160, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Matrix_preTranslate  ,
256  ,
160  ,
false  ,
 
)

Definition at line 4 of file Matrix_preTranslate.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 paint.setAntiAlias(true);
8 SkRect rect = {20, 20, 100, 100};
9 for (int i = 0; i < 2; ++i ) {
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.preTranslate(40, 40);
22 canvas->concat(matrix);
23 canvas->drawCircle(0, 0, 3, paint);
24 }
25 }
26}
27} // END FIDDLE
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
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
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