Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_writePixels.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=29b98ebf58aa9fd1edfaabf9f4490b3a
5REG_FIDDLE(Canvas_writePixels, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
8 for (int y = 0; y < 256; ++y) {
9 uint32_t pixels[256];
10 for (int x = 0; x < 256; ++x) {
11 pixels[x] = SkColorSetARGB(x, (x + y) % 256, x, (x - y) & 0xFF);
12 }
13 canvas->writePixels(imageInfo, &pixels, sizeof(pixels), 0, y);
14 }
15}
16} // END FIDDLE
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition SkColor.h:49
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 MakeN32(int width, int height, SkAlphaType at)