Archived

This topic is now archived and is closed to further replies.

Taco2003

Detecting RGB 555 or RGB565

Recommended Posts

Taco2003    122
How would I go about detecting whether a video card uses RGB 555 or RGB565. The computer I use to develop on is 555 but my mothers computer which I use as a test computer uses 565 so my transparency code doesn''t work for hers. Is there any way to detect this? Thanks in advance for help and insight

Share this post


Link to post
Share on other sites
porthios    130
If you''re working with DirectX, you could work with the IDirectDraw7 interface and use IDirectDraw7::EnumDisplayModes to see what the possible display modes are.

Share this post


Link to post
Share on other sites
AndyTX    806
Use "HRESULT IDirectDrawSurface7::GetPixelFormat(...)".

With the returned structure, you can check how many bits are for red, green, and blue, or check the shifts and masks etc... there are about 100 ways from here to find whether or not it is 565 or 555

Share this post


Link to post
Share on other sites
Burning_Ice    122
i use the following code to find the currently running videomode:
(for this to work you need a correctly set up ddraw surface, but it should be easy to adapt the code if you only have an hdc to work with the pixelformatdescriptor from the gdi get/describe pixelformat methods )


// get the pixelformat
DDPIXELFORMAT f;
memset ( &f, 0, sizeof(f) );
f.dwSize = sizeof(f);
lpddsprimary->GetPixelFormat ( &f );

int bits = f.dwRGBBitCount;
int r = f.dwRBitMask;
int g = f.dwGBitMask;
int b = f.dwBBitMask;

if (bits==32 && r==0x00FF0000 && g==0x0000FF00 && b==0x000000FF) res = Pixelformat_32_RGB_888;
if (bits==32 && r==0x000000FF && g==0x0000FF00 && b==0x00FF0000) res = Pixelformat_32_BGR_888;
if (bits==16 && r==0xF800 && g==0x07E0 && b==0x001F) res = Pixelformat_16_RGB_565;
if (bits==16 && r==0x001F && g==0x07E0 && b==0xF800) res = Pixelformat_16_BGR_565;
if (bits==16 && r==0x7C00 && g==0x03E0 && b==0x001F) res = Pixelformat_16_RGB_555;
if (bits==16 && r==0x001F && g==0x03E0 && b==0x7C00) res = Pixelformat_16_BGR_555;



Share this post


Link to post
Share on other sites