Professional Documents
Culture Documents
rgb565 rgb888
rgb565 rgb888
return (R | G | B);
}
static int RGB888ToRGB565(int aPixel) {
//aPixel <<= 8;
//System.out.println(Integer.toHexString(aPixel));
int red = (aPixel >> 16) & 0xFF;
int green = (aPixel >> 8) & 0xFF;
int blue = (aPixel) & 0xFF;
return RGB888ToRGB565(red, green, blue);
}
static int RGB565ToRGB888(int aPixel) {
int b = (((aPixel) & 0x001F) << 3) & 0xFF;
int g = (((aPixel) & 0x07E0) >>> 2) & 0xFF;
int r = (((aPixel) & 0xF800) >>> 8) & 0xFF;
// return RGBA
return 0x000000ff | (r << 24) | (g << 16) | (b << 8);
}