0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// This file is available under and governed by the GNU General Public 0N/A// License version 2 only, as published by the Free Software Foundation. 0N/A// However, the following notice accompanied the original version of this 2693N/A//--------------------------------------------------------------------------------- 2693N/A// Little Color Management System 2693N/A// Copyright (c) 1998-2010 Marti Maria Saguer 0N/A// Permission is hereby granted, free of charge, to any person obtaining 0N/A// a copy of this software and associated documentation files (the "Software"), 0N/A// to deal in the Software without restriction, including without limitation 0N/A// the rights to use, copy, modify, merge, publish, distribute, sublicense, 0N/A// and/or sell copies of the Software, and to permit persons to whom the Software 0N/A// is furnished to do so, subject to the following conditions: 0N/A// The above copyright notice and this permission notice shall be included in 0N/A// all copies or substantial portions of the Software. 0N/A// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 0N/A// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 0N/A// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 0N/A// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 0N/A// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 0N/A// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 0N/A// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2693N/A//--------------------------------------------------------------------------------- 0N/A// Obtains WhitePoint from Temperature 2693N/A // cmsFloat64Number M1, M2; 0N/A // For correlated color temperature (T) between 4000K and 7000K: 0N/A if (T >=
4000. && T <=
7000.)
0N/A x = -
4.6070*(
1E9/
T3) +
2.9678*(
1E6/
T2) +
0.09911*(
1E3/T) +
0.244063;
0N/A // or for correlated color temperature (T) between 7000K and 25000K: 0N/A if (T >
7000.0 && T <=
25000.0)
0N/A x = -
2.0064*(
1E9/
T3) +
1.9018*(
1E6/
T2) +
0.24748*(
1E3/T) +
0.237040;
0N/A y = -
3.000*(x*x) +
2.870*x -
0.275;
0N/A // wave factors (not used, but here for futures extensions) 0N/A // M1 = (-1.3515 - 1.7703*x + 5.9114 *y)/(0.0241 + 0.2562*x - 0.7341*y); 0N/A // M2 = (0.0300 - 31.4424*x + 30.0717*y)/(0.0241 + 0.2562*x - 0.7341*y); 0N/A// {Mirek, Ut, Vt, Tt } 0N/A {0,
0.18006,
0.26352, -
0.24341},
0N/A {
10,
0.18066,
0.26589, -
0.25479},
0N/A {
20,
0.18133,
0.26846, -
0.26876},
0N/A {
30,
0.18208,
0.27119, -
0.28539},
0N/A {
40,
0.18293,
0.27407, -
0.30470},
0N/A {
50,
0.18388,
0.27709, -
0.32675},
0N/A {
60,
0.18494,
0.28021, -
0.35156},
0N/A {
70,
0.18611,
0.28342, -
0.37915},
0N/A {
80,
0.18740,
0.28668, -
0.40955},
0N/A {
90,
0.18880,
0.28997, -
0.44278},
0N/A {
100,
0.19032,
0.29326, -
0.47888},
0N/A {
125,
0.19462,
0.30141, -
0.58204},
0N/A {
150,
0.19962,
0.30921, -
0.70471},
0N/A {
175,
0.20525,
0.31647, -
0.84901},
0N/A {
200,
0.21142,
0.32312, -
1.0182 },
0N/A {
225,
0.21807,
0.32909, -
1.2168 },
0N/A {
250,
0.22511,
0.33439, -
1.4512 },
0N/A {
275,
0.23247,
0.33904, -
1.7298 },
0N/A {
300,
0.24010,
0.34308, -
2.0637 },
0N/A {
325,
0.24702,
0.34655, -
2.4681 },
0N/A {
350,
0.25591,
0.34951, -
2.9641 },
0N/A {
375,
0.26400,
0.35200, -
3.5814 },
0N/A {
400,
0.27218,
0.35407, -
4.3633 },
0N/A {
425,
0.28039,
0.35577, -
5.3762 },
0N/A {
450,
0.28863,
0.35714, -
6.7262 },
0N/A {
475,
0.29685,
0.35823, -
8.5955 },
0N/A {
500,
0.30505,
0.35907, -
11.324 },
0N/A {
525,
0.31320,
0.35968, -
15.628 },
0N/A {
550,
0.32129,
0.36011, -
23.325 },
0N/A {
575,
0.32931,
0.36038, -
40.770 },
2693N/A {
600,
0.33724,
0.36051, -
116.45 }
0N/A// Robertson's method 2693N/A // convert (x,y) to CIE 1960 (u,WhitePoint) 2693N/A// Compute chromatic adaptation matrix using Chad as cone matrix 2693N/A// Returns the final chrmatic adaptation from illuminant FromIll to Illuminant ToIll 2693N/A// The cone matrix can be specified in ConeMatrix. If NULL, Bradford is assumed 6271N/A {{
0.8951,
0.2664, -
0.1614 }},
6271N/A {{ -
0.7502,
1.7135,
0.0367 }},
6271N/A {{
0.0389, -
0.0685,
1.0296 }}
2693N/A// Same as anterior, but assuming D50 destination. White point is given in xyY 2693N/A// Build a White point, primary chromas transfer matrix from RGB to CIE XYZ 2693N/A// This is just an approximation, I am not handling all the non-linear 2693N/A// aspects of the RGB to XYZ process, and assumming that the gamma correction 2693N/A// has transitive property in the tranformation chain. 2693N/A// - First I build the absolute conversion matrix using 2693N/A// primaries in XYZ. This matrix is next inverted 2693N/A// - Then I eval the source white point across this matrix 2693N/A// obtaining the coeficients of the transformation 2693N/A// - Then, I apply these coeficients to the original matrix 2693N/A // Result = Primaries ^ (-1) inverse matrix 2693N/A // Across inverse primaries ... 2693N/A // Give us the Coefs, then I build transformation matrix 2693N/A// Adapts a color to a given illuminant. Original color is expected to have 2693N/A// a SourceWhitePt white point.