Important: The information in this document is obsolete and should not be used for new development.
Customizing Complement Functions
Some specialized color applications may need to modify the way in which the Color Manager calculates the inverse, or complement, of a color. The Color Manager's default method for inverting a color is to invert the bit values of theRGBColor
data structure. For colors in which at least one component has very low or very high values this method produces expected (or at least discernible) results. A pure green, for example, with RGB color values of 0x0000, 0xFFFF, and 0x0000, inverts to magenta, with RGB color values of 0xFFFF, 0x0000, and 0xFFFF. But midrange values do not change by much: a component value of 0x7FFF, for example, inverts to 0x8000, which is an indiscernible difference. A gray value always inverts to another gray, which may or may not be what your application needs.Your application can supply a custom complement function to find the inverse of a specified color. The Color Manager keeps complement functions in a linked list beginning in the
GDevice
data structure'sgdCompProc
field. Each link is aCProcRec
data structure, which has the format shown below.
struct CProcRec { Handle nxtComp; /* handle to next CProcRec */ ColorComplementProcPtrcompProc;/* pointer to complement function */ }; typedef struct CProcRec CProcRec;You install a complement function with theAddComp
function. When your application is done using it, be sure to remove it with theDelComp
function.