Jump to content
  • Advertisement


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

Goober King

"?" about hex values among others.

This topic is 6249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve never realy had to use them exept when someone already had the value I needed ready. Now though I think I may need to understand them a bit better. The examples in the SDK Doc used them to set a color key value but I currently don''t know how to translate the value into RGB numbers to that I can use the color or select one myself in Photoshop. For that matter how exactly are color values represented in the system. 16bits doesn''t evenly split between 3 color values. Also while not exactly related I understand the idea behind using the indivitual bits as flags when needed using "&" and "|" but how do I test the values if I don''t know what 00110010 translates into? All the books I have always asumed the user would know or something. So. Anyone know a good sight where I can get more info on this stuff.

Share this post

Link to post
Share on other sites
I''ll try to help you out with this...

The reason most programming books don''t say much, is because this atleast used to be taught in math classes (not mine though , and I assume not yours either) and it is always taught in Computer Science 101 classes.
This is a page that does a fairly good, if rushed, job of explaining binary, decimal, and hexidecimal (hex). It''s meant to be part of an explination into midi, but we can forgive it for that

After that, you should now understand numbers in hex.

Hmm... I don''t have photoshop in stalled, but I believe the numbers your are refering too are a set of 6 hex digits? F64A3B or something like that.

This is the system used for web page colors, and I think what you are talking about in photoshop (i could be wrong, if so, ignore me).
You get the RGB values by splitting up the numbers.

F6 4A 3B

The first two are the value for Red, the second two Green, and the last, Blue.

So the RGB values for my example in decimal are:
Red - 246
Green - 74
Blue - 59

Now for the 16-bit question...

The main ways for storing color values for the computer''s video card are 256 color, 16bit, 24bit, and 32bit. (We''ll ignore cga/ega color)

256 color is indexed mode, and you probably already understand it. If not, ask me and I''ll explain it.

24bit color is the simplest to think about, but is the rarest. It uses the following patter to store color:
Each letter represents on bit, R is for Red, G is for Green, B is for Blue. This would be a good way to do things, but writing three bytes/pixel doesn''t work as well as other methods.

32bit is similar to 24bit.
The A is for Alpha. 32bit contains information for the alpha channel. Eh... Basically it deals with a type of transparency, I don''t know exactly what it does, so I won''t explain it here...

16bit is the most complicated. There are two different ways to store 16bit numbers. 555, and 565.
555 uses this pattern: ARRRRRGGGGGBBBBB
I believe A is just an ignored bit, but I don''t remember for sure.

565 uses this pattern : RRRRRGGGGGGBBBBB
If you notice, there is one more bit for green than red or blue. Since the human eye can detect more shades of green, this actually makes sense to give green the extra bit.

16-bit 565 mode is the most common I believe.

I hope I answered a couple questions for you. If nothing else, go to that link and learn the three number systems, they are must-know material. If you don''t understand anything, i''ll try to clarify.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!