Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_writePixels_2.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=8b128e067881f9251357653692fa28da
5REG_FIDDLE(Canvas_writePixels_2, 256, 256, false, 0) {
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
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
double y
double x
static SkImageInfo MakeN32Premul(int width, int height)