Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Pixmap_erase_3.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.
4// HASH=f884f3f46a565f052a5e252ae2f36e9b
5REG_FIDDLE(Pixmap_erase_3, 256, 50, false, 0) {
6void draw(SkCanvas* canvas) {
7 uint32_t storage[2];
9 SkPixmap pixmap(info, storage, info.minRowBytes());
10 SkIRect topPixelBounds = {0, 0, 1, 1};
11 pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
12 SkIRect bottomPixelBounds = {0, 1, 1, 2};
13 pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
15 canvas->scale(20, 20);
16 bitmap.installPixels(pixmap);
17 canvas->drawImage(image, 0, 0);
18}
19} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void scale(SkScalar sx, SkScalar sy)
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
sk_sp< SkImage > image
Definition examples.cpp:29
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
static SkImageInfo MakeN32Premul(int width, int height)