ThatBrianDude
ThatBrianDude

Reputation: 3190

Cant figure out color codes in dll

Okay this might be a stupid question but I am editing a dll written in delphi and would like to change some color definitions but I cant figure out what format the colors are written in. For an example:

99999999 -> is a bright pink

55555555 -> is an orange

15663114 -> blue

3496 -> a dark red

0 -> black

Some colors are defined with 7 digits:

enter image description here

Upvotes: 3

Views: 311

Answers (1)

David Heffernan
David Heffernan

Reputation: 612824

It's BGR format. The least significant byte is the intensity of the red channel, the next significant byte is the green channel, and then blue.

It's much easier to understand when you look at the hexadecimal representations of the values, because the value can be easily broken down into the three channels. Consider the decimal 15663114, which you say is a dark blue. Converted to hexadecimal this is EF000A. The colour channels have the following intensity:

Blue:  EF
Green: 00
Red:   0A

The other colour values can be understood in a similar fashion.

Now, there may also be an alpha channel to represent the transparency level. That would be the most significant of the 4 bytes. The value 99999999 that you quote is 05F5E0FF in hexadecimal. That would have an alpha value of 05. Whether or not that channel is respected depends on the code that interprets the colour value.

Upvotes: 8

Related Questions