[Gamedevlists-brew] Getting pixel type from display.
Brought to you by:
vexxed72
From: Steven H. <st...@ha...> - 2004-12-08 22:57:14
|
Hi, I'm trying to write a set of routines to access the display buffer. = In order to do this I need to know the display type (Eg RGB565, 555, 444 = etc) or the device. This will allow me to select the appropriate blit routine = and so on. Below is the routine I'm using to do this. I know it will fail on = any devices that have palletised displays, I'll cross that bridge later...=20 Passing in the IBitmap obtained from the display should return the = correct type. I only have 1 handset to test on, so does this look like the way = to go? I've only tested it on a VX7000 and it reported 565 correctly. Any = show stoppers that will cause this to screw up? Am I missing some cunning GETDISPLAYTYPE() call tucked away in the API somewhere instead? Regards, Steven Haggerty. U8 GetColourFormatFromIBitmap(IBitmap *pBMP) { RGBVAL rgb; NativeColor n; rgb =3D MAKE_RGB(255,0,255); n =3D IBITMAP_RGBToNative(pBMP,rgb); switch (n) {=09 case 0xf81f : return mcPixelFormat_RGB565; case 0x7c1f : return mcPixelFormat_RGB555; case 0x0f0f : return mcPixelFormat_RGB444; case 0xff00ff : return mcPixelFormat_RGB888; default : return mcPixelFormat_None; } } |