16- and 24-bit color
Please elaborate more, do you mean 16 bit or 24 bit in ddraw,d3d? What if you mean in directx i cant think of any reason it might not be working unless you are trying to do pixels and any custom drawing functions. That dont take 16/24 bit into concern.
This would be in DirectDraw. I make a bitmap in 16 or 24 bit color and it won't work. But then I use a palette with 256 colors and it works fine. Thats what I mean.
16 or 24 bit color modes does not have palettes. They use a _packed_ pixel format. That means r,g and b values stored right inside a pixel value. For example 24 bit mode uses 8 bits to represent red, green and blue color values.
FlyFire/CodeX
http://codexorg.webjump.com
I am confused on how to get 16 or 24 bit color working. I can do everything I need to do fine in 256 color mode, with palettes and all, but why can't I get it to work in 16 bit color? Could someone please give an example or something like that? It would be greatly appreciated. Thanks.
To convert your color to 16 or 24 bit format you gonna do the following:
newPix = ((r & RedMask) << RedFieldPos) +
((g & GreenMask) << GreenFieldPos) +
((b & BlueMask) << BlueFieldPos);
RedMask, RedFieldPos, ... you can get from DirectX (i dunno how, but there was some discussions about it some time ago. For 24 bit color they are:
RedMask =GreenMask = BlueMask = 0xff
redfieldpos = 0;
greenfieldpos = 8;
bluefieldpos = 16;
)
To obtain r,g and b values you gotta lookup them in picture's palette.
newPix = ((r & RedMask) << RedFieldPos) +
((g & GreenMask) << GreenFieldPos) +
((b & BlueMask) << BlueFieldPos);
RedMask, RedFieldPos, ... you can get from DirectX (i dunno how, but there was some discussions about it some time ago. For 24 bit color they are:
RedMask =GreenMask = BlueMask = 0xff
redfieldpos = 0;
greenfieldpos = 8;
bluefieldpos = 16;
)
To obtain r,g and b values you gotta lookup them in picture's palette.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement