Erin Rubio wrote:
> Does anyone have an algorithm that translates MapInfo colors to
> hexidecimal colors?

If you have a number representing a color, say 8438015 (teal
blue), then you can use the integer divide and Mod operators to
extract the red, green and blue components, like so:

Red   = 8438015 \ 256^2 mod 256
Green = 8438015 \ 256^1 mod 256
Blue  = 8438015 \ 256^0 mod 256

which turns out to be Red = 128, Green = 192 and Blue = 255, or
in hexadecimal: Red = &H80, Green = &HC0 and Blue = &HFF.

Note also that Windows colors (as in Visual Basic) are packed in
the opposite order as Blue, Green, and Red, but otherwise the
same formula holds. 

Going the other way, it's just Color = Red*256^2 + Green*256 +
Blue

-- 
- Bill Thoen
------------------------------------------------------------ 
GISnet, 1401 Walnut St., Suite C, Boulder, CO  80302
tel: 303-786-9961, fax: 303-443-4856
mailto:[EMAIL PROTECTED], http://www.ctmap.com/gisnet
------------------------------------------------------------



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to