AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
getCMYKColor (Number cyan, Number magenta, Number yellow [, Number black]) yoix.awt
getCMYKColor (Number cyan, Number magenta, Number yellow, Number black, int ps)  
 
Returns a Color that represents the cyan, magenta, and yellow color component arguments. A color component that is a double should be a number between 0.0 and 1.0, while a color component that is an int should be a number between 0 and 255. Colors specified this way represent a subtractive color model where a double value of 1.0 or an int value of CR 255 means no contribution from the corresponding additive component, and a value of zero means a full contribution from that component. The optional black argument should also be a double between 0.0 and 1.0 or an int between 0 and 255, and when supplied is added to the other three components before they are actually forced into the required range. When non-zero, the ps argument indicates that the Adobe CMYK-to-RGB conversion formula found in the PostScript Language Reference Manual should be used (the default). That formula expressed in the Java language is:
rgb_color = new Color(
    (float)(1.0 - Math.min(1.0, cyan + black)),
    (float)(1.0 - Math.min(1.0, magenta + black)),
    (float)(1.0 - Math.min(1.0, yellow + black))
);
A zero for the ps argument triggers use of the CMYK-to-RGB conversion formula found either at wikipedia.org or in the comp.graphics newsgroup FAQ. That formula expressed in the Java language is:
rgb_color = new Color(
    (float)(1.0 - Math.min(1.0, cyan*(1.0 - black) + black)),
    (float)(1.0 - Math.min(1.0, magenta*(1.0 - black) + black)),
    (float)(1.0 - Math.min(1.0, yellow*(1.0 - black) + black))
);
 
 Return:   Color
 
 See Also:   addColor, Color, getBrighterColor, getColorName, getDarkerColor, getHSBColor, getRGBColor

 

Yoix is a registered trademark of AT&T Intellectual Property.