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