Example #1
0
void
cvtcolor(	/* convert a CIE XYZ color to RGB */
	COLOR	radrgb,
	register C_COLOR	*ciec,
	double	intensity
)
{
	static COLOR	ciexyz;

	c_ccvt(ciec, C_CSXY);		/* get xy representation */
	ciexyz[1] = intensity;
	ciexyz[0] = ciec->cx/ciec->cy*ciexyz[1];
	ciexyz[2] = ciexyz[1]*(1./ciec->cy - 1.) - ciexyz[0];
	cie_rgb(radrgb, ciexyz);
}
Example #2
0
void
ccy2rgb(			/* convert MGF color to RGB */
	C_COLOR	*cin,	/* input MGF chrominance */
	double	cieY,	/* input luminance or reflectance */
	COLOR	cout	/* output RGB color */
)
{
	double	d;
	COLOR	xyz;
					/* get CIE XYZ representation */
	c_ccvt(cin, C_CSXY);
	d = cin->cx/cin->cy;
	xyz[CIEX] = d * cieY;
	xyz[CIEY] = cieY;
	xyz[CIEZ] = (1./cin->cy - d - 1.) * cieY;
	cie_rgb(cout, xyz);
}