Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
draw_a8_bitmap.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(draw_a8_bitmap, 256, 256, false, 3) {
5void draw(SkCanvas* canvas) {
7 bitmap.allocPixels(SkImageInfo::MakeA8(256, 256));
8 for (int y = 0; y < bitmap.height(); ++y) {
9 for (int x = 0; x < bitmap.width(); ++x) {
10 *bitmap.getAddr8(x, y) = (2 * x + 2 * y) & 0xFF;
11 }
12 }
14 paint.setColor(0xFF00FF00);
15 canvas->clear(0xFF000000);
16 canvas->drawImage(bitmap.asImage(), 0, 0, SkSamplingOptions(), &paint);
17}
18} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void clear(SkColor color)
Definition SkCanvas.h:1199
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
double y
double x
static SkImageInfo MakeA8(int width, int height)