home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / X / TekHVCWpAj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-13  |  4.0 KB  |  119 lines

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