Packed Colors

Since Director 5 and 6 did not had any color type variables and because they are sorely needed (indexed palette colors are inaccurate in Windows and generally limiting), DrawXtra uses its own "packed" color format which are integers that describe an RGB value with each color channel having a value of 0-255. Packed colors are generally unintelligible but you can use some DrawXtra functions to determine their meaning when necessary.

RGB colors are additive colors, meaning that the more of each color channel that is displayed, the closer to white you will get. A color with red = 255, blue = 255 (255,255,255) and green = 255 will be pure white. An RGB value of (0,0,0) will be black. An RGB value of (255,0,0) will be a pure red color. You get the idea. The GetPixel() function always returns a packed color. A packed color's individual color channels may then be extracted using the GetRedColor(), GetBlueColor() and GetGreenColor() functions.

Example:
set packedColor = GetPixel( member "canvas", 30, 30 )
set r = GetRedColor(member "canvas", packedColor)
set b = GetBlueColor(member "canvas", packedColor)
set g = GetGreenColor(member "canvas", packedColor)
put "RGB = (" & string & "," & string(g) & "," & string(b) & ")"

The converse operation can be performed by calling PackColor(). This will create a packed color from red, green and blue color values.

Example:
-- To create a pure blue packed color:
set packedColor = PackColor( member "canvas", 0, 0, 255 )
Getting Started Properties Functions Creating Projectors Using the Xtra in Shockwave Known Issues How to Order and Register Licensing and Availability Technical Support