Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Bitmap_getAddr16.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Bitmap_getAddr16, 256, 256, true, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Bitmap_getAddr16  ,
256  ,
256  ,
true  ,
 
)

Definition at line 5 of file Bitmap_getAddr16.cpp.

5 {
6void draw(SkCanvas* canvas) {
7 SkBitmap bitmap16;
10 bitmap16.allocPixels(dstInfo);
11 if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) {
12 uint16_t* row0 = bitmap16.getAddr16(0, 0);
13 uint16_t* row1 = bitmap16.getAddr16(0, 1);
14 size_t interval = (row1 - row0) * bitmap16.bytesPerPixel();
15 SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!');
16 }
17}
18} // END FIDDLE
@ 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)