| 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 |
* CIELabWpAj.c |
| 28 |
* |
| 29 |
* DESCRIPTION |
| 30 |
* This file contains routine(s) that support white point |
| 31 |
* adjustment of color specifications in the CIE L*a*b* 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 |
/* |
| 43 |
* EXTERNS |
| 44 |
*/ |
| 45 |
|
| 46 |
|
| 47 |
/************************************************************************ |
| 48 |
* * |
| 49 |
* PUBLIC ROUTINES * |
| 50 |
* * |
| 51 |
************************************************************************/ |
| 52 |
|
| 53 |
/* |
| 54 |
* NAME |
| 55 |
* XcmsCIELabWhiteShiftColors |
| 56 |
* |
| 57 |
* SYNOPSIS |
| 58 |
*/ |
| 59 |
Status |
| 60 |
XcmsCIELabWhiteShiftColors( |
| 61 |
XcmsCCC ccc, |
| 62 |
XcmsColor *pWhitePtFrom, |
| 63 |
XcmsColor *pWhitePtTo, |
| 64 |
XcmsColorFormat destSpecFmt, |
| 65 |
XcmsColor *pColors_in_out, |
| 66 |
unsigned int nColors, |
| 67 |
Bool *pCompressed) |
| 68 |
/* |
| 69 |
* DESCRIPTION |
| 70 |
* Adjust color specifications in XcmsColor structures for |
| 71 |
* differences in white points. |
| 72 |
* |
| 73 |
* RETURNS |
| 74 |
* XcmsFailure if failed, |
| 75 |
* XcmsSuccess if succeeded without gamut compression, |
| 76 |
* XcmsSuccessWithCompression if succeeded with gamut |
| 77 |
* compression. |
| 78 |
*/ |
| 79 |
{ |
| 80 |
if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { |
| 81 |
return(0); |
| 82 |
} |
| 83 |
|
| 84 |
/* |
| 85 |
* Convert to CIELab using pWhitePtFrom |
| 86 |
*/ |
| 87 |
if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, |
| 88 |
nColors, XcmsCIELabFormat, pCompressed) == XcmsFailure) { |
| 89 |
return(XcmsFailure); |
| 90 |
} |
| 91 |
|
| 92 |
/* |
| 93 |
* Convert from CIELab to destSpecFmt using pWhitePtTo |
| 94 |
*/ |
| 95 |
return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, |
| 96 |
pWhitePtTo, nColors, destSpecFmt, pCompressed)); |
| 97 |
} |