Flutter Engine
The Flutter Engine
Functions
draw_a8_bitmap.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (draw_a8_bitmap, 256, 256, false, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( draw_a8_bitmap  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file draw_a8_bitmap.cpp.

4 {
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
Definition: color_source.cc:38
double y
double x
Definition: bitmap.py:1
SkSamplingOptions(SkFilterMode::kLinear))
static SkImageInfo MakeA8(int width, int height)