LuvWpAj.c revision 1ab64890
1/* $Xorg: LuvWpAj.c,v 1.3 2000/08/17 19:44:45 cpqbld Exp $ */
2
3/*
4 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
5 * 	All Rights Reserved
6 *
7 * This file is a component of an X Window System-specific implementation
8 * of XCMS based on the TekColor Color Management System.  Permission is
9 * hereby granted to use, copy, modify, sell, and otherwise distribute this
10 * software and its documentation for any purpose and without fee, provided
11 * that this copyright, permission, and disclaimer notice is reproduced in
12 * all copies of this software and in supporting documentation.  TekColor
13 * is a trademark of Tektronix, Inc.
14 *
15 * Tektronix makes no representation about the suitability of this software
16 * for any purpose.  It is provided "as is" and with all faults.
17 *
18 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
19 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
21 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
22 * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
23 * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
24 * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
25 *
26 *
27 *	NAME
28 *		CIELuvWpAj.c
29 *
30 *	DESCRIPTION
31 *		This file contains routine(s) that support white point
32 *		adjustment of color specifications in the CIE CIELuv.color
33 *		space.
34 */
35/* $XFree86$ */
36
37#ifdef HAVE_CONFIG_H
38#include <config.h>
39#endif
40#include "Xlibint.h"
41#include "Xcmsint.h"
42#include "Cv.h"
43
44
45
46/************************************************************************
47 *									*
48 *			 PUBLIC ROUTINES				*
49 *									*
50 ************************************************************************/
51
52/*
53 *	NAME
54 *		XcmsCIELuvWhiteShiftColors
55 *
56 *	SYNOPSIS
57 */
58Status
59XcmsCIELuvWhiteShiftColors(
60    XcmsCCC ccc,
61    XcmsColor *pWhitePtFrom,
62    XcmsColor *pWhitePtTo,
63    XcmsColorFormat destSpecFmt,
64    XcmsColor *pColors_in_out,
65    unsigned int nColors,
66    Bool *pCompressed)
67/*
68 *	DESCRIPTION
69 *		Adjusts color specifications in an array of XcmsColor
70 *		structures for white point differences.
71 *
72 *	RETURNS
73 *		XcmsFailure if failed,
74 *		XcmsSuccess if succeeded without gamut compression,
75 *		XcmsSuccessWithCompression if succeeded with
76 *			gamut compression.
77 */
78{
79    if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) {
80	return(XcmsFailure);
81    }
82
83    /*
84     * Convert to CIELuv using pWhitePtFrom
85     *    We can ignore return value for compression because we are converting
86     *    to XcmsCIELuvFormat which is device-independent, not device-dependent.
87     */
88    if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom,
89	    nColors, XcmsCIELuvFormat, pCompressed) == XcmsFailure) {
90	return(XcmsFailure);
91    }
92
93    /*
94     * Convert from CIELuv to destSpecFmt using pWhitePtTo
95     */
96    return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo,
97	    nColors, destSpecFmt, pCompressed));
98}
99