Flutter Engine
The Flutter Engine
Pixmap_writable_addrF16.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(Pixmap_writable_addrF16, 256, 64, false, 0) {
5void draw(SkCanvas* canvas) {
7 uint16_t storage[2][4];
8 SkPixmap pixmap(info, storage[0], sizeof(uint64_t));
9 SkIRect topPixelBounds = {0, 0, 1, 1};
10 pixmap.erase({ 0.65f, 0.45f, 0.25f, 1 }, &topPixelBounds);
11 SkIRect bottomPixelBounds = {0, 1, 1, 2};
12 pixmap.erase({ 0.25f, 0.65f, 0.45f, 1 }, &bottomPixelBounds);
14 canvas->scale(20, 20);
15 bitmap.installPixels(pixmap);
16 canvas->drawImage(bitmap.asImage(), 0, 0);
17 uint16_t* pixel2 = pixmap.writable_addrF16(0, 1);
18 for (int i = 0; i < 4; ++i) {
19 pixel2[i] = storage[0][i];
20 }
21 bitmap.installPixels(pixmap);
22 canvas->drawImage(bitmap.asImage(), 4, 0);
23}
24} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
REG_FIDDLE(Pixmap_writable_addrF16, 256, 64, false, 0)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
uint16_t * writable_addrF16(int x, int y) const
Definition: SkPixmap.h:566
bool erase(SkColor color, const SkIRect &subset) const
Definition: SkPixmap.cpp:742
Definition: bitmap.py:1
Definition: SkRect.h:32
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)