LabWpAj.c revision 1ab64890
1/* $Xorg: LabWpAj.c,v 1.3 2000/08/17 19:44:40 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 *		CIELabWpAj.c
29 *
30 *	DESCRIPTION
31 *		This file contains routine(s) that support white point
32 *		adjustment of color specifications in the CIE L*a*b* 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 *	EXTERNS
46 */
47
48
49/************************************************************************
50 *									*
51 *			 PUBLIC ROUTINES				*
52 *									*
53 ************************************************************************/
54
55/*
56 *	NAME
57 *		XcmsCIELabWhiteShiftColors
58 *
59 *	SYNOPSIS
60 */
61Status
62XcmsCIELabWhiteShiftColors(
63    XcmsCCC ccc,
64    XcmsColor *pWhitePtFrom,
65    XcmsColor *pWhitePtTo,
66    XcmsColorFormat destSpecFmt,
67    XcmsColor *pColors_in_out,
68    unsigned int nColors,
69    Bool *pCompressed)
70/*
71 *	DESCRIPTION
72 *		Adjust color specifications in XcmsColor structures for
73 *		differences in white points.
74 *
75 *	RETURNS
76 *		XcmsFailure if failed,
77 *		XcmsSuccess if succeeded without gamut compression,
78 *		XcmsSuccessWithCompression if succeeded with gamut
79 *			compression.
80 */
81{
82    if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) {
83	return(0);
84    }
85
86    /*
87     * Convert to CIELab using pWhitePtFrom
88     */
89    if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom,
90	    nColors, XcmsCIELabFormat, pCompressed) == XcmsFailure) {
91	return(XcmsFailure);
92    }
93
94    /*
95     * Convert from CIELab to destSpecFmt using pWhitePtTo
96     */
97    return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out,
98	pWhitePtTo, nColors, destSpecFmt, pCompressed));
99}
100