11ab64890Smrg 21ab64890Smrg/* 31ab64890Smrg * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. 41ab64890Smrg * All Rights Reserved 561b2299dSmrg * 61ab64890Smrg * This file is a component of an X Window System-specific implementation 71ab64890Smrg * of Xcms based on the TekColor Color Management System. TekColor is a 81ab64890Smrg * trademark of Tektronix, Inc. The term "TekHVC" designates a particular 91ab64890Smrg * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent 101ab64890Smrg * foreign patents pending). Permission is hereby granted to use, copy, 111ab64890Smrg * modify, sell, and otherwise distribute this software and its 121ab64890Smrg * documentation for any purpose and without fee, provided that: 1361b2299dSmrg * 141ab64890Smrg * 1. This copyright, permission, and disclaimer notice is reproduced in 151ab64890Smrg * all copies of this software and any modification thereof and in 1661b2299dSmrg * supporting documentation; 171ab64890Smrg * 2. Any color-handling application which displays TekHVC color 181ab64890Smrg * cooordinates identifies these as TekHVC color coordinates in any 191ab64890Smrg * interface that displays these coordinates and in any associated 201ab64890Smrg * documentation; 211ab64890Smrg * 3. The term "TekHVC" is always used, and is only used, in association 221ab64890Smrg * with the mathematical derivations of the TekHVC Color Space, 231ab64890Smrg * including those provided in this file and any equivalent pathways and 241ab64890Smrg * mathematical derivations, regardless of digital (e.g., floating point 251ab64890Smrg * or integer) representation. 2661b2299dSmrg * 271ab64890Smrg * Tektronix makes no representation about the suitability of this software 281ab64890Smrg * for any purpose. It is provided "as is" and with all faults. 2961b2299dSmrg * 301ab64890Smrg * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, 311ab64890Smrg * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 321ab64890Smrg * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY 331ab64890Smrg * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 341ab64890Smrg * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF 351ab64890Smrg * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 361ab64890Smrg * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. 371ab64890Smrg * 381ab64890Smrg * DESCRIPTION 391ab64890Smrg * TekHVCWpAj.c 401ab64890Smrg * 411ab64890Smrg * DESCRIPTION 421ab64890Smrg * This file contains routine(s) that support white point 431ab64890Smrg * adjustment of color specifications in the TekHVC color 441ab64890Smrg * space. 451ab64890Smrg */ 461ab64890Smrg 471ab64890Smrg#ifdef HAVE_CONFIG_H 481ab64890Smrg#include <config.h> 491ab64890Smrg#endif 501ab64890Smrg#include "Xlibint.h" 511ab64890Smrg#include "Xcmsint.h" 521ab64890Smrg#include "Cv.h" 531ab64890Smrg 541ab64890Smrg 551ab64890Smrg/************************************************************************ 561ab64890Smrg * * 571ab64890Smrg * PUBLIC ROUTINES * 581ab64890Smrg * * 591ab64890Smrg ************************************************************************/ 601ab64890Smrg 611ab64890Smrg/* 621ab64890Smrg * NAME 631ab64890Smrg * XcmsTekHVCWhiteShiftColors 641ab64890Smrg * 651ab64890Smrg * SYNOPSIS 661ab64890Smrg */ 671ab64890SmrgStatus 681ab64890SmrgXcmsTekHVCWhiteShiftColors( 691ab64890Smrg XcmsCCC ccc, 701ab64890Smrg XcmsColor *pWhitePtFrom, 711ab64890Smrg XcmsColor *pWhitePtTo, 721ab64890Smrg XcmsColorFormat destSpecFmt, 731ab64890Smrg XcmsColor *pColors_in_out, 741ab64890Smrg unsigned int nColors, 751ab64890Smrg Bool *pCompressed) 761ab64890Smrg/* 771ab64890Smrg * DESCRIPTION 781ab64890Smrg * Convert color specifications in an array of XcmsColor structures 791ab64890Smrg * for differences in white points. 801ab64890Smrg * 811ab64890Smrg * RETURNS 821ab64890Smrg * XcmsFailure if failed, 831ab64890Smrg * XcmsSuccess if succeeded without gamut compression, 841ab64890Smrg * XcmsSuccessWithCompression if succeeded with 851ab64890Smrg * gamut compression. 861ab64890Smrg */ 871ab64890Smrg{ 881ab64890Smrg if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { 891ab64890Smrg return(XcmsFailure); 901ab64890Smrg } 911ab64890Smrg 921ab64890Smrg /* 931ab64890Smrg * Insure TekHVC installed 941ab64890Smrg */ 951ab64890Smrg if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { 961ab64890Smrg return(XcmsFailure); 971ab64890Smrg } 981ab64890Smrg 991ab64890Smrg /* 1001ab64890Smrg * Convert to TekHVC using pWhitePtFrom 1011ab64890Smrg * We can ignore return value for compression because we are converting 1021ab64890Smrg * to XcmsTekHVCFormat which is device-independent, not device-dependent. 1031ab64890Smrg */ 1041ab64890Smrg if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, 1051ab64890Smrg nColors, XcmsTekHVCFormat, pCompressed) == XcmsFailure) { 1061ab64890Smrg return(XcmsFailure); 1071ab64890Smrg } 1081ab64890Smrg 1091ab64890Smrg /* 1101ab64890Smrg * Convert from TekHVC to destSpecFmt using pWhitePtTo 1111ab64890Smrg */ 1121ab64890Smrg return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, 1131ab64890Smrg nColors, destSpecFmt, pCompressed)); 1141ab64890Smrg} 115