Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Canvas_writePixels_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_writePixels_2, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_writePixels_2  ,
256  ,
256  ,
false  ,
 
)

Definition at line 5 of file Canvas_writePixels_2.cpp.

5 {
6void draw(SkCanvas* canvas) {
9 bitmap.setInfo(imageInfo);
10 uint32_t pixels[4];
11 bitmap.setPixels(pixels);
12 for (int y = 0; y < 256; y += 2) {
13 for (int x = 0; x < 256; x += 2) {
14 pixels[0] = SkColorSetRGB(x, y, x | y);
15 pixels[1] = SkColorSetRGB(x ^ y, y, x);
16 pixels[2] = SkColorSetRGB(x, x & y, y);
17 pixels[3] = SkColorSetRGB((~x) & 0xFF, (~y) & 0xFF, x);
18 canvas->writePixels(bitmap, x, y);
19 }
20 }
21}
22} // END FIDDLE
#define SkColorSetRGB(r, g, b)
Definition SkColor.h:57
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
bool writePixels(const SkImageInfo &info, const void *pixels, size_t rowBytes, int x, int y)
Definition SkCanvas.cpp:403
double y
double x
static SkImageInfo MakeN32Premul(int width, int height)