Debian Codegraph @

nx-X11/lib/src/xcms/HVCWpAj.c

raw
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. TekColor is a
8 * trademark of Tektronix, Inc. The term "TekHVC" designates a particular
9 * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent
10 * foreign patents pending). Permission is hereby granted to use, copy,
11 * modify, sell, and otherwise distribute this software and its
12 * documentation for any purpose and without fee, provided that:
13 *
14 * 1. This copyright, permission, and disclaimer notice is reproduced in
15 * all copies of this software and any modification thereof and in
16 * supporting documentation;
17 * 2. Any color-handling application which displays TekHVC color
18 * cooordinates identifies these as TekHVC color coordinates in any
19 * interface that displays these coordinates and in any associated
20 * documentation;
21 * 3. The term "TekHVC" is always used, and is only used, in association
22 * with the mathematical derivations of the TekHVC Color Space,
23 * including those provided in this file and any equivalent pathways and
24 * mathematical derivations, regardless of digital (e.g., floating point
25 * or integer) representation.
26 *
27 * Tektronix makes no representation about the suitability of this software
28 * for any purpose. It is provided "as is" and with all faults.
29 *
30 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
31 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
32 * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
33 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
34 * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
35 * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
36 * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
37 *
38 * DESCRIPTION
39 * TekHVCWpAj.c
40 *
41 * DESCRIPTION
42 * This file contains routine(s) that support white point
43 * adjustment of color specifications in the TekHVC color
44 * space.
45 */
46
47 #ifdef HAVE_CONFIG_H
48 #include <config.h>
49 #endif
50 #include "Xlibint.h"
51 #include "Xcmsint.h"
52 #include "Cv.h"
53
54
55 /************************************************************************
56 * *
57 * PUBLIC ROUTINES *
58 * *
59 ************************************************************************/
60
61 /*
62 * NAME
63 * XcmsTekHVCWhiteShiftColors
64 *
65 * SYNOPSIS
66 */
67 Status
68 XcmsTekHVCWhiteShiftColors(
69 XcmsCCC ccc,
70 XcmsColor *pWhitePtFrom,
71 XcmsColor *pWhitePtTo,
72 XcmsColorFormat destSpecFmt,
73 XcmsColor *pColors_in_out,
74 unsigned int nColors,
75 Bool *pCompressed)
76 /*
77 * DESCRIPTION
78 * Convert color specifications in an array of XcmsColor structures
79 * for differences in white points.
80 *
81 * RETURNS
82 * XcmsFailure if failed,
83 * XcmsSuccess if succeeded without gamut compression,
84 * XcmsSuccessWithCompression if succeeded with
85 * gamut compression.
86 */
87 {
88 if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) {
89 return(XcmsFailure);
90 }
91
92 /*
93 * Insure TekHVC installed
94 */
95 if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) {
96 return(XcmsFailure);
97 }
98
99 /*
100 * Convert to TekHVC using pWhitePtFrom
101 * We can ignore return value for compression because we are converting
102 * to XcmsTekHVCFormat which is device-independent, not device-dependent.
103 */
104 if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom,
105 nColors, XcmsTekHVCFormat, pCompressed) == XcmsFailure) {
106 return(XcmsFailure);
107 }
108
109 /*
110 * Convert from TekHVC to destSpecFmt using pWhitePtTo
111 */
112 return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo,
113 nColors, destSpecFmt, pCompressed));
114 }