Flutter Engine
The Flutter Engine
Bitmap_getAddr16.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(Bitmap_getAddr16, 256, 256, true, 3) {
5void draw(SkCanvas* canvas) {
6 SkBitmap bitmap16;
9 bitmap16.allocPixels(dstInfo);
10 if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) {
11 uint16_t* row0 = bitmap16.getAddr16(0, 0);
12 uint16_t* row1 = bitmap16.getAddr16(0, 1);
13 size_t interval = (row1 - row0) * bitmap16.bytesPerPixel();
14 SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!');
15 }
16}
17} // END FIDDLE
REG_FIDDLE(Bitmap_getAddr16, 256, 256, true, 3)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition: SkColorType.h:23
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
int width() const
Definition: SkBitmap.h:149
size_t rowBytes() const
Definition: SkBitmap.h:238
void * getPixels() const
Definition: SkBitmap.h:283
int bytesPerPixel() const
Definition: SkBitmap.h:187
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
Definition: SkBitmap.cpp:488
int height() const
Definition: SkBitmap.h:158
uint16_t * getAddr16(int x, int y) const
Definition: SkBitmap.h:1265
SkBitmap source
Definition: examples.cpp:28
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)