DIRECTORY ImagerBasic USING [ConstantColor], ColorModels USING [undefined, Calibration], Rope USING [ROPE]; ConstantColors: CEDAR DEFINITIONS = BEGIN black: ConstantColor; white: ConstantColor; -- All REAL values below should be in the range [0..1] except for undefined hues. -- HSV is hue, saturation, value (hexacone model); -- HSL is hue, saturation, lightness (double ended hexacone) -- RGB is red, green, blue. undefined: REAL = ColorModels.undefined; -- (-1.0) Calibration: TYPE = ColorModels.Calibration; ConstantColor: TYPE = ImagerBasic.ConstantColor; UndefinedColor: SIGNAL; IntensityToColor: PROC [intensity: REAL, cal: Calibration _ NIL] RETURNS [ConstantColor]; HSVToColor: PROC [h, s, v: REAL, cal: Calibration _ NIL] RETURNS [ConstantColor]; HSLToColor: PROC [h, s, l: REAL, cal: Calibration _ NIL] RETURNS [ConstantColor]; RGBToColor: PROC [r, g, b: REAL, cal: Calibration _ NIL] RETURNS [ConstantColor]; -- The above 4 procedures will SIGNAL Runtime.BoundsFault for any argument -- not in [0..1]; resuming the signal will perform arg _ MAX[0,MIN[1,arg]]. CIEToColor: PROC [x,y,Y: REAL] RETURNS [ConstantColor]; NameToColor: PROC [name: Rope.ROPE, cal: Calibration _ NIL] RETURNS [ConstantColor]; ColorToIntensity: PROC[color: ConstantColor, cal: Calibration _ NIL] RETURNS[intensity: REAL]; ColorToHSV: PROC [color: ConstantColor, cal: Calibration _ NIL] RETURNS [h, s, v: REAL]; ColorToHSL: PROC [color: ConstantColor, cal: Calibration _ NIL] RETURNS [h, s, l: REAL]; ColorToRGB: PROC [color: ConstantColor, cal: Calibration _ NIL] RETURNS [r, g, b: REAL]; ColorToCIE: PROC [color: ConstantColor] RETURNS [x,y,Y: REAL]; ColorToName: PROC [color: ConstantColor, cal: Calibration _ NIL] RETURNS [name: Rope.ROPE]; END. tConstantColors.mesa Michael Plass, August 1, 1983 11:19 am Last Edited by: Stone, February 10, 1984 4:47:16 pm PST Last Edited by: Pier, January 19, 1984 2:21 pm Defaulting the calibration assumes an "ideal" monitor device --CIE color system --Color naming system. The hope is that this will be a set of "intuitive" descriptive names that people could type or select. A color name is composed of three properties, usually presented in order: lightness, saturation, hue. The current set of names for these properties is: Lightness is one of: very dark, dark, medium, light, very light (default is medium) Saturation is one of: weak, moderate, strong, vivid (default is vivid) Hue is one of: red, orange, yellow, green, blue, purple, brown You may also interpolate between the hue names as follows: red, orangish-red, red-orange, reddish-orange, orange... You may only interpolate between adjacent hues as defined in the list. Brown is actually a special case of orange, so you can interpolate from red to brown, and from brown to yellow. There are three more hue names for achromatic colors: black, white and gray (grey). Black and white are complete descriptions by themselves. Gray may have a valid lighness parameter (default is medium). The following routines are inversion routines for the procedures above. Note that for achromatic colors the hue parameters will be undefined. ÊY˜J™J™&J™7J™.J™šÏk ˜ Jšœ œ˜"Jšœ œ˜+Jšœœœ˜—Jšœœ œ˜)J˜Jšœ˜Jšœ˜JšÏcQ˜QJšž2˜2JšÏi<˜™>J™¬—™SJ™w—J™—J˜JšœG™GJšœE™EJš  œœ*œœ œ˜^Jš   œœ+œœ œ˜XJš   œœ+œœ œ˜XJš   œœ+œœ œ˜XJš   œœœœœ˜>Jš   œœ+œœ œ˜[Jšžœ˜—…—Ì™