Flutter Engine
The Flutter Engine
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.
4REG_FIDDLE(Canvas_writePixels_2, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
8 bitmap.setInfo(imageInfo);
9 uint32_t pixels[4];
10 bitmap.setPixels(pixels);
11 for (int y = 0; y < 256; y += 2) {
12 for (int x = 0; x < 256; x += 2) {
13 pixels[0] = SkColorSetRGB(x, y, x | y);
14 pixels[1] = SkColorSetRGB(x ^ y, y, x);
15 pixels[2] = SkColorSetRGB(x, x & y, y);
16 pixels[3] = SkColorSetRGB((~x) & 0xFF, (~y) & 0xFF, x);
17 canvas->writePixels(bitmap, x, y);
18 }
19 }
20}
21} // END FIDDLE
REG_FIDDLE(Canvas_writePixels_2, 256, 256, false, 0)
#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:399
double y
double x
Definition: bitmap.py:1
static SkImageInfo MakeN32Premul(int width, int height)