2006-03-13 10:06:17 -05:00
|
|
|
<!-- Creator : groff version 1.18.1 -->
|
|
|
|
<!-- CreationDate: Mon Mar 13 18:03:08 2006 -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta name="generator" content="groff -Thtml, see www.gnu.org">
|
|
|
|
<meta name="Content-Style" content="text/css">
|
|
|
|
<title>COLOR</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1 align=center>COLOR</h1>
|
|
|
|
<a href="#NAME">NAME</a><br>
|
|
|
|
<a href="#SYNOPSIS">SYNOPSIS</a><br>
|
|
|
|
<a href="#DESCRIPTION">DESCRIPTION</a><br>
|
|
|
|
<a href="#SEE ALSO">SEE ALSO</a><br>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<a name="NAME"></a>
|
|
|
|
<h2>NAME</h2>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
|
|
|
<td width="91%">
|
|
|
|
<p>TIFFYCbCrToRGBInit, TIFFYCbCrtoRGB, TIFFCIELabToRGBInit,
|
|
|
|
TIFFCIELabToXYZ, TIFFXYZToRGB − color conversion
|
|
|
|
routines.</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
2005-03-06 06:11:43 -05:00
|
|
|
<a name="SYNOPSIS"></a>
|
|
|
|
<h2>SYNOPSIS</h2>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
|
|
|
<td width="91%">
|
|
|
|
<p><b>#include <tiffio.h></b></p>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p><b>int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB
|
|
|
|
*</b><i>ycbcr</i><b>, float *</b><i>luma</i><b>, float
|
|
|
|
*</b><i>refBlackWhite"</i><b>);"<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *</b><i>ycbcr</i><b>,
|
|
|
|
uint32</b> <i>Y</i><b>, int32</b> <i>Cb</i><b>, int32</b>
|
|
|
|
<i>Cr</i><b>, uint32 *</b><i>R</i><b>, uint32
|
|
|
|
*</b><i>G</i><b>, uint32 *</b><i>B</i> <b>);</b></p>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p><b>int TIFFCIELabToRGBInit(TIFFCIELabToRGB
|
|
|
|
*</b><i>cielab</i><b>, TIFFDisplay *</b><i>display</i><b>,
|
|
|
|
float *</b><i>refWhite</i><b>);<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
void TIFFCIELabToXYZ(TIFFCIELabToRGB *</b><i>cielab</i><b>,
|
|
|
|
uint32</b> <i>L</i><b>, int32</b> <i>a</i><b>, int32</b>
|
|
|
|
<i>b</i><b>, float *</b><i>X</i><b>, float *</b><i>Y</i><b>,
|
2006-03-13 10:06:17 -05:00
|
|
|
float *</b><i>Z</i><b>);<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
void TIFFXYZToRGB(TIFFCIELabToRGB *</b><i>cielab</i><b>,
|
|
|
|
float</b> <i>X</i><b>, float</b> <i>Y</i><b>, float</b>
|
|
|
|
<i>Z"</i><b>,</b><i>uint32</i><b>*"</b><i>R</i><b>,
|
|
|
|
uint32 *</b><i>G</i><b>, uint32 *</b><i>B</i><b>);</b></p>
|
2006-03-13 10:06:17 -05:00
|
|
|
</td>
|
|
|
|
</table>
|
2005-03-06 06:11:43 -05:00
|
|
|
<a name="DESCRIPTION"></a>
|
|
|
|
<h2>DESCRIPTION</h2>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
|
|
|
<td width="91%">
|
|
|
|
<p>TIFF supports several color spaces for images stored in
|
|
|
|
that format. There is usually a problem of application to
|
|
|
|
handle the data properly and convert between different
|
|
|
|
colorspaces for displaying and printing purposes. To
|
|
|
|
simplify this task libtiff implements several color
|
|
|
|
conversion routines itself. In particular, these routines
|
|
|
|
used in <b>TIFFRGBAImage(3TIFF)</b> interface.</p>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p><b>TIFFYCbCrToRGBInit()</b> used to initialize
|
|
|
|
<i>YCbCr</i> to <i>RGB</i> conversion state. Allocating and
|
|
|
|
freeing of the <i>ycbcr</i> structure belongs to programmer.
|
|
|
|
<i>TIFFYCbCrToRGB</i> defined in <b>tiffio.h</b> as</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>typedef struct { /* YCbCr->RGB support */
|
|
|
|
TIFFRGBValue* clamptab; /* range clamping table */
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="5" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>int*</p>
|
|
|
|
<td width="28%"></td>
|
|
|
|
<td width="-3%"></td>
|
|
|
|
<td width="12%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Cr_r_tab;<br>
|
|
|
|
int*</p>
|
|
|
|
</td>
|
|
|
|
<td width="56%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="28%"></td>
|
|
|
|
<td width="-3%"></td>
|
|
|
|
<td width="12%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Cb_b_tab;<br>
|
|
|
|
int32*</p>
|
|
|
|
</td>
|
|
|
|
<td width="56%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="28%"></td>
|
|
|
|
<td width="-3%"></td>
|
|
|
|
<td width="12%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Cr_g_tab;<br>
|
|
|
|
int32*</p>
|
|
|
|
</td>
|
|
|
|
<td width="56%">
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="28%"></td>
|
|
|
|
<td width="-3%"></td>
|
|
|
|
<td width="12%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Cb_g_tab;</p>
|
|
|
|
</td>
|
|
|
|
<td width="56%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>int32* Y_tab;<br>
|
|
|
|
} TIFFYCbCrToRGB;</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
|
|
|
<td width="91%">
|
|
|
|
<p><i>luma</i> is a float array of three values representing
|
|
|
|
proportions of the red, green and blue in luminance, Y (see
|
|
|
|
section 21 of the TIFF 6.0 specification, where the YCbCr
|
|
|
|
images discussed). <i>TIFFTAG_YCBCRCOEFFICIENTS</i> holds
|
|
|
|
that values in TIFF file. <i>refBlackWhite</i> is a float
|
|
|
|
array of 6 values which specifies a pair of headroom and
|
|
|
|
footroom image data values (codes) for each image component
|
|
|
|
(see section 20 of the TIFF 6.0 specification where the
|
2005-03-06 06:11:43 -05:00
|
|
|
colorinmetry fields discussed).
|
|
|
|
<i>TIFFTAG_REFERENCEBLACKWHITE</i> is responsible for
|
|
|
|
storing these values in TIFF file. Following code snippet
|
|
|
|
should helps to understand the the technique:</p>
|
2006-03-13 10:06:17 -05:00
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>float *luma, *refBlackWhite;
|
|
|
|
uint16 hs, vs;
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
/* Initialize structures */
|
|
|
|
ycbcr = (TIFFYCbCrToRGB*)
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB),
|
|
|
|
sizeof(long))</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>+ 4*256*sizeof(TIFFRGBValue)</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>+ 2*256*sizeof(int)</p>
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>+ 3*256*sizeof(int32));</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>if (ycbcr == NULL) {<br>
|
|
|
|
TIFFError("YCbCr->RGB",</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="4" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>"No space for YCbCr->RGB conversion
|
|
|
|
state");</p>
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2006-01-02 18:50:44 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>exit(0);<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
}</p>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS,
|
|
|
|
&luma);<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE,
|
2006-03-13 10:06:17 -05:00
|
|
|
&refBlackWhite);<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
if (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) <
|
2006-03-13 10:06:17 -05:00
|
|
|
0)</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>exit(0);</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>/* Start conversion */<br>
|
|
|
|
uint32 r, g, b;<br>
|
|
|
|
uint32 Y;<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
int32 Cb, Cr;</p>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>for each pixel in image</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>TIFFYCbCrtoRGB(img->ycbcr, Y, Cb, Cr, &r, &g,
|
|
|
|
&b);</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>/* Free state structure */<br>
|
|
|
|
_TIFFfree(ycbcr);</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="91%">
|
|
|
|
<p><b>TIFFCIELabToRGBInit()</b> initializes the <i>CIE
|
|
|
|
L*a*b* 1976</i> to <i>RGB</i> conversion state.
|
|
|
|
<b>TIFFCIELabToRGB</b> defined as</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>#define CIELABTORGB_TABLE_RANGE 1500
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="9" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>typedef struct {</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>/* CIE Lab 1976->RGB support */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>int</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>range;</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>/* Size of conversion table */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>rstep, gstep, bstep;</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>X0, Y0, Z0;</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>/* Reference white point */</p>
|
|
|
|
</td>
|
|
|
|
<td width="37%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>TIFFDisplay display;</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr
|
|
|
|
to r */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg
|
|
|
|
to g */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb
|
|
|
|
to b */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="37%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>} TIFFCIELabToRGB;</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-01-02 18:50:44 -05:00
|
|
|
<td width="8%"></td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="91%">
|
|
|
|
<p><i>display</i> is a display device description, declared
|
|
|
|
as</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>typedef struct {
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_mat[3][3]; /* XYZ -> luminance matrix */</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_YCR; /* Light o/p for reference white */</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_YCG;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_YCB;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>uint32 d_Vrwr; /* Pixel values for ref. white */</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>uint32 d_Vrwg;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>uint32 d_Vrwb;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_Y0R; /* Residual light for black pixel */</p>
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_Y0G;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_Y0B;</p>
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_gammaR; /* Gamma values for the three guns
|
|
|
|
*/</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_gammaG;</p>
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>float d_gammaB;</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>} TIFFDisplay;</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="91%">
|
|
|
|
<p>For example, the one can use sRGB device, which has the
|
|
|
|
following parameters:</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>TIFFDisplay display_sRGB = {
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="5" cellspacing="0" cellpadding="0">
|
2006-01-02 18:50:44 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
|
|
|
|
<p>{ /* XYZ -> luminance matrix */</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>{ 3.2410F, -1.5374F, -0.4986F },</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="62%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>{ -0.9692F, 1.8760F, 0.0416F },</p>
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>{ 0.0556F, -0.2040F, 1.0570F }</p>
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>},</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>100.0F, 100.0F, 100.0F, /* Light o/p for reference white
|
|
|
|
*/</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>255, 255, 255, /* Pixel values for ref. white */</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel
|
|
|
|
*/</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>2.4F, 2.4F, 2.4F, /* Gamma values for the three guns
|
|
|
|
*/</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>};</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="91%">
|
|
|
|
<p><i>refWhite</i> is a color temperature of the reference
|
|
|
|
white. The <i>TIFFTAG_WHITEPOINT</i> contains the
|
|
|
|
chromaticity of the white point of the image from where the
|
|
|
|
reference white can be calculated using following
|
|
|
|
formulae:</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>refWhite_Y = 100.0<br>
|
|
|
|
refWhite_X = whitePoint_x / whitePoint_y * refWhite_Y<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
refWhite_Z = (1.0 - whitePoint_x - whitePoint_y) /
|
2006-03-13 10:06:17 -05:00
|
|
|
whitePoint_y * refWhite_X</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="91%">
|
|
|
|
<p>The conversion itself performed in two steps: at the
|
|
|
|
first one we will convert <i>CIE L*a*b* 1976</i> to <i>CIE
|
|
|
|
XYZ</i> using <b>TIFFCIELabToXYZ()</b> routine, and at the
|
|
|
|
second step we will convert <i>CIE XYZ</i> to <i>RGB</i>
|
|
|
|
using <b>TIFFXYZToRGB().</b> Look at the code sample
|
|
|
|
below:</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<pre>float *whitePoint;
|
|
|
|
float refWhite[3];
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
/* Initialize structures */
|
|
|
|
img->cielab = (TIFFCIELabToRGB *)
|
|
|
|
</pre>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>_TIFFmalloc(sizeof(TIFFCIELabToRGB));</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2006-01-02 18:50:44 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>if (!cielab) {</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="5" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
|
|
|
|
<p>TIFFError("CIE L*a*b*->RGB",</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>"No space for CIE L*a*b*->RGB conversion
|
|
|
|
state.");</p>
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>exit(0);</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>}</p>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>TIFFGetFieldDefaulted(tif, TIFFTAG_WHITEPOINT,
|
|
|
|
&whitePoint);<br>
|
|
|
|
refWhite[1] = 100.0F;<br>
|
|
|
|
refWhite[0] = whitePoint[0] / whitePoint[1] *
|
|
|
|
refWhite[1];<br>
|
|
|
|
refWhite[2] = (1.0F - whitePoint[0] -
|
|
|
|
whitePoint[1])</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>/ whitePoint[1] * refWhite[1];</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>if (TIFFCIELabToRGBInit(cielab, &display_sRGB,
|
|
|
|
refWhite) < 0) {</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="5" cellspacing="0" cellpadding="0">
|
2006-01-02 18:50:44 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
|
|
|
|
<p>TIFFError("CIE L*a*b*->RGB",</p>
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
2005-03-06 06:11:43 -05:00
|
|
|
</td>
|
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>"Failed to initialize CIE L*a*b*->RGB conversion
|
|
|
|
state.");</p>
|
|
|
|
</td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>_TIFFfree(cielab);</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="0%"></td>
|
|
|
|
<td width="6%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>exit(0);</p>
|
|
|
|
</td>
|
|
|
|
<td width="6%"></td>
|
|
|
|
<td width="62%">
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>}</p>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>/* Now we can start to convert */<br>
|
|
|
|
uint32 r, g, b;<br>
|
|
|
|
uint32 L;<br>
|
|
|
|
int32 a, b;<br>
|
2005-03-06 06:11:43 -05:00
|
|
|
float X, Y, Z;</p>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>for each pixel in image</p></td>
|
|
|
|
</table>
|
|
|
|
<!-- TABS -->
|
2005-03-06 06:11:43 -05:00
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
2006-03-13 10:06:17 -05:00
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2005-03-06 06:11:43 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>TIFFCIELabToXYZ(cielab, L, a, b, &X, &Y,
|
|
|
|
&Z);</p>
|
|
|
|
</td>
|
2005-03-06 06:11:43 -05:00
|
|
|
<tr valign="top" align="left">
|
2006-03-13 10:06:17 -05:00
|
|
|
<td width="24%"></td>
|
|
|
|
<td width="75%">
|
2006-01-02 18:50:44 -05:00
|
|
|
|
2006-03-13 10:06:17 -05:00
|
|
|
<p>TIFFXYZToRGB(cielab, X, Y, Z, &r, &g,
|
|
|
|
&b);</p>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="17%"></td>
|
|
|
|
<td width="82%">
|
|
|
|
<p>/* Don’t forget to free the state structure */<br>
|
|
|
|
_TIFFfree(cielab);</p></td>
|
2005-03-06 06:11:43 -05:00
|
|
|
</table>
|
|
|
|
<a name="SEE ALSO"></a>
|
|
|
|
<h2>SEE ALSO</h2>
|
2006-03-13 10:06:17 -05:00
|
|
|
<!-- INDENTATION -->
|
|
|
|
<table width="100%" border=0 rules="none" frame="void"
|
|
|
|
cols="2" cellspacing="0" cellpadding="0">
|
|
|
|
<tr valign="top" align="left">
|
|
|
|
<td width="8%"></td>
|
|
|
|
<td width="91%">
|
|
|
|
<p><b>TIFFRGBAImage</b>(3TIFF) <b>libtiff</b>(3TIFF),</p>
|
|
|
|
<!-- INDENTATION -->
|
|
|
|
<p>Libtiff library home page:
|
|
|
|
<b>http://www.remotesensing.org/libtiff/</b></p>
|
|
|
|
</td>
|
|
|
|
</table>
|
2005-03-06 06:11:43 -05:00
|
|
|
<hr>
|
|
|
|
</body>
|
|
|
|
</html>
|