16- and 24-bit color

Started by
4 comments, last by Gf11speed 24 years, 8 months ago
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.
Advertisement
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.
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)
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

Well then how exactly do I store the RGB values into a pixel?
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)
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.
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)
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.

This topic is closed to new replies.

Advertisement