Jump to content

  • Log In with Google      Sign In   
  • Create Account

16- and 24-bit color


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Gf11speed   Members   -  Reputation: 137

Like
Likes
Like

Posted 15 August 1999 - 09:40 AM

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.

Sponsor:

#2 Zenroth   Members   -  Reputation: 127

Like
Likes
Like

Posted 14 August 1999 - 06:54 AM

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.

#3 Gf11speed   Members   -  Reputation: 137

Like
Likes
Like

Posted 14 August 1999 - 08:57 AM

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.

#4 FlyFire   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 August 1999 - 08:59 AM

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


#5 Gf11speed   Members   -  Reputation: 137

Like
Likes
Like

Posted 14 August 1999 - 01:02 PM

Well then how exactly do I store the RGB values into a pixel?

#6 FlyFire   Members   -  Reputation: 122

Like
Likes
Like

Posted 15 August 1999 - 09:40 AM

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS