MirPixelFormat does not encode details of the pixel format. This is annoying because we frequently need to switch/case for each supported pixel format. What would be nicer is encoding the instructions for formatting a pixel into the pixelformat itself. Something like...
MirPixelFormat does not encode details of the pixel format. This is annoying because we frequently need to switch/case for each supported pixel format. What would be nicer is encoding the instructions for formatting a pixel into the pixelformat itself. Something like...
#define PIXEL_FORMAT( redsize, redshift, greensize, greenshift, bluesize, blueshift, alphasize, alphashift) \
( \
(redsize << 28) | \
(redshift << 24) | \
(greensize << 20) | \
(greenshift << 16) | \
(bluesize << 12) | \
(blueshift << 8) | \
(alphasize << 4) | \
(alphashift << 0) | \
)
#define ABGR8888 PIXEL_FORMAT(8, 0, 8, 8, 8, 16, 8, 24) CHANNEL( pf) ((pf) & 0xf0)
#define XBGR8888 PIXEL_FORMAT(8, 0, 8, 8, 8, 16, 0, 24)
#define HAS_ALPHA_