Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
checker_board.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (checker_board, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( checker_board  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file checker_board.cpp.

4 {
5void checkerboard(SkCanvas* canvas) {
6 SkColor color1 = SK_ColorLTGRAY;
7 SkColor color2 = SK_ColorCYAN;
8 SkScalar scale = 10.0f;
10 path.addRect(0, 0, scale, scale);
12 matrix.preSkew(0.5f, 0);
14 paint.setPathEffect(SkPath2DPathEffect::Make(matrix, path));
15 paint.setAntiAlias(true);
16 paint.setColor(color2);
17 canvas->clear(color1);
18 SkRect bounds = SkRect::MakeWH(256, 256);
19 bounds.outset(scale, scale);
20 canvas->drawRect(bounds, paint);
21}
22
23void draw(SkCanvas* canvas) {
24 canvas->drawColor(SK_ColorWHITE);
25 checkerboard(canvas);
26}
27} // END FIDDLE
constexpr SkColor SK_ColorLTGRAY
Definition SkColor.h:118
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorCYAN
Definition SkColor.h:143
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition SkCanvas.h:1182
void clear(SkColor color)
Definition SkCanvas.h:1199
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition SkMatrix.h:75
static sk_sp< SkPathEffect > Make(const SkMatrix &matrix, const SkPath &path)
const Paint & paint
float SkScalar
Definition extension.cpp:12
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
Optional< SkRect > bounds
Definition SkRecords.h:189
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
const Scalar scale
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609
static void checkerboard(SkCanvas *canvas, SkColor c1, SkColor c2, int size)