Working with colorsApplies to: MapObjects, Working with ColorsWhenever you reference a color in MapObjects, you are really working with a Win32 COLORREF data type. A COLORREF is simply a 32-bit unsigned integer that has the following hexadecimal form: 0x00bbggrr
The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte is usually zero. The maximum value for a single byte is 0xFF. Common Colors Defined by MapObjectsMapObjects defines the following set of common colors:
You may also define entirely new colors by specifying different numeric values. The following C macro shows how to create a new color from the red, green, and blue components: #define RGB(r,g,b)(((unsigned char)
For an example in Visual Basic of working with colors and the different methods you can use, see the Color property example in MapObjects.hlp. Most development environments have a similar utility routine to construct a COLORREF for you. Working with Palette ColorsWindows provides built-in support for color dithering when a requested color doesn't match any of the colors supported by the display hardware. MapObjects makes use of palettes on systems that require such support. You may still get dithered colors on such systems if you don't specify that you want to match specified colors to the closest color available in the current palette. To specify that you want to use one of the palette colors, set a value of 0x02 in the high order byte of every color that you specify to MapObjects. You can do this by adding 0x02000000 to any colors you use. Doing so should eliminate any unwanted color dithering. |