Flutter Engine
The Flutter Engine
checker_board.cpp
Go to the documentation of this file.
1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(checker_board, 256, 256, false, 0) {
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);
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
REG_FIDDLE(checker_board, 256, 256, false, 0)
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
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)
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
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)