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