CGColorWithCIE.mesa
Last edited by Maureen Stone, June 21, 1985 1:51:34 pm PDT
Last edited by Doug Wyatt, August 31, 1982 2:50 pm
Last Edited by: Beach, February 13, 1984 2:20:49 pm PST
Last Edited by: Naiman, June 14, 1985 5:25:29 pm PDT
DIRECTORY
ImagerColor USING [RGB];
CGColorWithCIE: CEDAR DEFINITIONS = {
ColorTag: TYPE = {rgb, stipple};
Color: TYPE = RECORD[tag: ColorTag, r,g,b: [0..256)];
GetStipple: PROC[color: Color] RETURNS[CARDINAL] = INLINE { RETURN[color.g*256+color.b] };
-- get a color's stipple pattern, assuming color.tag = stipple
The following convert between (hue, saturation, value) or (hue, saturation, lightness) and (red, green, blue).
All REALs except h should be in the range [0..1].
--h=undefined means it's a gray.
InvalidColor, Uninitialized: SIGNAL;
undefined: REAL = -1;
HSVToRGB: PROC[h, s, v: REAL] RETURNS[r, g, b: REAL];
RGBToHSV:
PROC[r, g, b:
REAL]
RETURNS[h, s, v:
REAL];
--HSV hexacone model.
HSLToRGB: PROC[h, s, l: REAL] RETURNS[r, g, b: REAL];
RGBToHSL:
PROC[r, g, b:
REAL]
RETURNS[h, s, l:
REAL];
--HSL double hexacone model.
The following convert between (intensity, in-phase, quadrature) and (red, green, blue).
YIQToRGB: PROC[y, i, q: REAL] RETURNS[r, g, b: REAL];
RGBToYIQ:
PROC[r, g, b:
REAL]
RETURNS[y, i, q:
REAL];
-- NTSC model.
The following convert between (achromatic, red-green, yellow-blue) and (red, green, blue).
ARgYbToRGB: PROC[a, rg, yb: REAL] RETURNS[r, g, b: REAL];
RGBToARgYb:
PROC[r, g, b:
REAL]
RETURNS[a, rg, yb:
REAL];
-- opponent colors model.
The following convert between (red, green, blue) and (x,y) chromaticity coordinates.
Initialize the transform with x,y for red, green blue plus Y. Y can default to 1 if you're not matching the monitor to anything else.
CIEToRGB and RGBToCIE will signal Uninitialized if InitCIE has not been called
InitCIE: PROC[xr,yr,xg,yg,xb,yb: REAL, whiteY: REAL ← 1];
add more info hear for real cie. Need two more values?
PhosphorType: TYPE = {long,normal};
InitDefaultCIE: PROC[type: PhosphorType ← long];
default values for long and short persistance phosphors
GetDefaultValues: PROC[type: PhosphorType] RETURNS[xr,yr,xg,yg,xb,yb: REAL];
SetDefaultValues: PROC[xr,yr,xg,yg,xb,yb: REAL, type: PhosphorType];
add more info hear for real cie
CIEToRGB: PROC[x,y, Y: REAL] RETURNS[r, g, b: REAL];
GetMaxY: PUBLIC PROC[x,y: REAL] RETURNS[Y: REAL];
used to clip values of Y for CIEToRGB
RGBToCIE: PROC[r, g, b: REAL] RETURNS [x,y, Y: REAL];
The following compute the contrasting color in each color space.
ContrastInRGB: PROC[rgb: ImagerColor.RGB] RETURNS[rgbContrast: ImagerColor.RGB];
ContrastInHSV: PROC[rgb: ImagerColor.RGB] RETURNS[hsvContrast: ImagerColor.RGB];
ContrastInHSL: PROC[rgb: ImagerColor.RGB] RETURNS[hslContrast: ImagerColor.RGB];
ContrastInYIQ: PROC[rgb: ImagerColor.RGB] RETURNS[yiqContrast: ImagerColor.RGB];
ContrastInARgYb: PROC[rgb: ImagerColor.RGB] RETURNS[argybContrast: ImagerColor.RGB];
}.