Flutter Engine
The Flutter Engine
Pixmap_erase.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.
4REG_FIDDLE(Pixmap_erase, 256, 50, false, 0) {
5void draw(SkCanvas* canvas) {
6 uint32_t storage[2];
8 SkPixmap pixmap(info, storage, info.minRowBytes());
9 pixmap.erase(SK_ColorBLUE, {0, 0, 1, 1});
10 pixmap.erase(SK_ColorRED, {0, 1, 1, 2});
12 canvas->scale(20, 20);
13 bitmap.installPixels(pixmap);
14 canvas->drawImage(bitmap.asImage(), 0, 0);
15}
16} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
REG_FIDDLE(Pixmap_erase, 256, 50, false, 0)
Definition: Pixmap_erase.cpp:4
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
bool erase(SkColor color, const SkIRect &subset) const
Definition: SkPixmap.cpp:742
Definition: bitmap.py:1
static SkImageInfo MakeN32Premul(int width, int height)