Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 4 - Color QuickDraw / Color QuickDraw Reference
Color QuickDraw Routines / Determining Current Colors and Best Intermediate Colors


To determine the best intermediate color between two colors on a given graphics device, use the GetGray function.

FUNCTION GetGray (device: GDHandle; backGround: RGBColor; 
                  VAR foreGround: RGBColor): Boolean; 
A handle to the graphics device for which an intermediate color or gray is needed.

The RGBColor record for one of the two colors for which you want an intermediate color.

On input, the RGBColor record for the other of the two colors; upon completion, the best intermediate color between these two.
The GetGray function determines the midpoint values for the red, green, and blue values of the two colors you specify in the backGround and foreGround parameters. In the device parameter, supply a handle to the graphics device; in the backGround and foreGround parameters, supply RGBColor records for the two colors for which you want the best intermediate RGB color. When GetGray completes, it returns the best intermediate color in the foreGround parameter.

One use for GetGray is to return the best gray. For example, when dimming an object, supply black and white as the two colors, and GetGray returns the best available gray that lies between them. (The Menu Manager does this when dimming unavailable menu items.)

If no gray is available (or if no distinguishable third color is available), the foreGround parameter is unchanged, and the function returns FALSE. If at least one gray or intermediate color is available, it is returned in the foreGround parameter, and the function returns TRUE.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996