9 bitmap.allocPixels(imageInfo);
15 auto pack4444 = [](
unsigned a,
unsigned r,
unsigned g,
unsigned b) -> uint16_t {
16 return (
a << 0) | (
b << 4) | (g << 8) | (r << 12);
18 uint16_t red4444[] = { pack4444(0xF, 0xF, 0x0, 0x0), pack4444(0xF, 0xb, 0x0, 0x0),
19 pack4444(0xF, 0x9, 0x0, 0x0), pack4444(0xF, 0x5, 0x0, 0x0) };
20 uint16_t blue4444[] = { pack4444(0xF, 0x0, 0x0, 0x0F), pack4444(0xF, 0x0, 0x0, 0x0b),
21 pack4444(0xF, 0x0, 0x0, 0x09), pack4444(0xF, 0x0, 0x0, 0x05) };
23 SkPixmap redPixmap(imageInfo, &red4444, 4);
24 if (
bitmap.writePixels(redPixmap, 0, 0)) {
27 SkPixmap bluePixmap(imageInfo, &blue4444, 4);
28 if (
bitmap.writePixels(bluePixmap, 0, 0)) {
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorGREEN
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void clear(SkColor color)
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
REG_FIDDLE_SRGB(gpu4444diff, 260, 260, false, 3, 0, false)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)