5 {
10 bitmap.allocPixels(imageInfo);
14 auto pack565 = [](
unsigned r,
unsigned g,
unsigned b) -> uint16_t {
15 return (
b << 0) | (g << 5) | (r << 11);
16 };
17 uint16_t red565[] = { pack565(0x1F, 0x00, 0x00), pack565(0x17, 0x00, 0x00),
18 pack565(0x0F, 0x00, 0x00), pack565(0x07, 0x00, 0x00) };
19 uint16_t blue565[] = { pack565(0x00, 0x00, 0x1F), pack565(0x00, 0x00, 0x17),
20 pack565(0x00, 0x00, 0x0F), pack565(0x00, 0x00, 0x07) };
22 if (
bitmap.writePixels(redPixmap, 0, 0)) {
24 }
26 if (
bitmap.writePixels(bluePixmap, 0, 0)) {
28 }
29}
30}
@ kOpaque_SkAlphaType
pixel is opaque
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-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)