I have to read a 24bpp Bitmap
and convert each pixel from RGB24
to ARGB16
.
I used the following code,
#define ARGB16(a, r, g, b) ( ((a) << 15) | (r)|((g)<<5)|((b)<<10))
But I am not getting the required Output.
Any help would be highly appreciated.
Break it up. Let's continue to use macros:
#define TRUNCATE(x) ((x) >> 3)
#define ARGB16(a,r,g,b) ((a << 15) | (TRUNCATE(r) << 10) | (TRUNCATE(g) << 5) | TRUNCATE(b)))
This assumes the alpha is just a single bit.