5 {
10 bitmap.allocPixels(imageInfo);
14 auto pack8888 = [](
unsigned a,
unsigned r,
unsigned g,
unsigned b) -> uint32_t {
15 return (r << 0) | (g << 8) | (
b << 16) | (
a << 24);
16 };
17 uint32_t red8888[] = { pack8888(0xFF, 0xFF, 0x0, 0x0), pack8888(0xFF, 0xbb, 0x0, 0x0),
18 pack8888(0xFF, 0x77, 0x0, 0x0), pack8888(0xFF, 0x33, 0x0, 0x0) };
19 uint32_t blue8888[] = { pack8888(0xFF, 0x0, 0x0, 0x0FF), pack8888(0xFF, 0x0, 0x0, 0x0bb),
20 pack8888(0xFF, 0x0, 0x0, 0x077), pack8888(0xFF, 0x0, 0x0, 0x033) };
22 if (
bitmap.writePixels(redPixmap, 0, 0)) {
24 }
26 if (
bitmap.writePixels(bluePixmap, 0, 0)) {
28 }
29}
30}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorGREEN
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
size_t minRowBytes() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)