Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* libcdr
3 : * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
17 : *
18 : *
19 : * All Rights Reserved.
20 : *
21 : * For minor contributions see the git repository.
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25 : * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26 : * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #include <math.h>
31 : #include <string.h>
32 : #include "CDRCollector.h"
33 : #include "libcdr_utils.h"
34 :
35 0 : libcdr::CDRParserState::CDRParserState()
36 : : m_fillStyles(), m_lineStyles(), m_bmps(), m_patterns(), m_vects(), m_pages(),
37 : m_documentPalette(), m_fonts(), m_texts(),
38 0 : m_colorTransformCMYK2RGB(0), m_colorTransformLab2RGB(0), m_colorTransformRGB2RGB(0)
39 : {
40 0 : cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
41 0 : m_colorTransformRGB2RGB = cmsCreateTransform(tmpRGBProfile, TYPE_RGB_8, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
42 0 : cmsHPROFILE tmpCMYKProfile = cmsOpenProfileFromMem(CMYK_icc, sizeof(CMYK_icc)/sizeof(CMYK_icc[0]));
43 0 : m_colorTransformCMYK2RGB = cmsCreateTransform(tmpCMYKProfile, TYPE_CMYK_DBL, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
44 0 : cmsHPROFILE tmpLabProfile = cmsCreateLab4Profile(0);
45 0 : m_colorTransformLab2RGB = cmsCreateTransform(tmpLabProfile, TYPE_Lab_DBL, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
46 0 : cmsCloseProfile(tmpLabProfile);
47 0 : cmsCloseProfile(tmpCMYKProfile);
48 0 : cmsCloseProfile(tmpRGBProfile);
49 0 : }
50 :
51 0 : libcdr::CDRParserState::~CDRParserState()
52 : {
53 0 : if (m_colorTransformCMYK2RGB)
54 0 : cmsDeleteTransform(m_colorTransformCMYK2RGB);
55 0 : if (m_colorTransformLab2RGB)
56 0 : cmsDeleteTransform(m_colorTransformLab2RGB);
57 0 : if (m_colorTransformRGB2RGB)
58 0 : cmsDeleteTransform(m_colorTransformRGB2RGB);
59 0 : }
60 :
61 0 : void libcdr::CDRParserState::setColorTransform(const std::vector<unsigned char> &profile)
62 : {
63 0 : if (profile.empty())
64 0 : return;
65 0 : cmsHPROFILE tmpProfile = cmsOpenProfileFromMem(&profile[0], profile.size());
66 0 : cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
67 0 : cmsColorSpaceSignature signature = cmsGetColorSpace(tmpProfile);
68 0 : switch (signature)
69 : {
70 : case cmsSigCmykData:
71 : {
72 0 : if (m_colorTransformCMYK2RGB)
73 0 : cmsDeleteTransform(m_colorTransformCMYK2RGB);
74 0 : m_colorTransformCMYK2RGB = cmsCreateTransform(tmpProfile, TYPE_CMYK_DBL, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
75 : }
76 0 : break;
77 : case cmsSigRgbData:
78 : {
79 0 : if (m_colorTransformRGB2RGB)
80 0 : cmsDeleteTransform(m_colorTransformRGB2RGB);
81 0 : m_colorTransformRGB2RGB = cmsCreateTransform(tmpProfile, TYPE_RGB_8, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
82 : }
83 0 : break;
84 : default:
85 0 : break;
86 : }
87 0 : cmsCloseProfile(tmpProfile);
88 0 : cmsCloseProfile(tmpRGBProfile);
89 : }
90 :
91 0 : void libcdr::CDRParserState::setColorTransform(WPXInputStream *input)
92 : {
93 0 : if (!input)
94 : return;
95 0 : unsigned long numBytesRead = 0;
96 0 : const unsigned char *tmpProfile = input->read((unsigned long)-1, numBytesRead);
97 0 : if (!numBytesRead)
98 : return;
99 0 : std::vector<unsigned char> profile(numBytesRead);
100 0 : memcpy(&profile[0], tmpProfile, numBytesRead);
101 0 : setColorTransform(profile);
102 : }
103 :
104 0 : unsigned libcdr::CDRParserState::getBMPColor(const CDRColor &color)
105 : {
106 0 : switch (color.m_colorModel)
107 : {
108 : case 0:
109 0 : return _getRGBColor(libcdr::CDRColor(0, color.m_colorValue));
110 : case 1:
111 0 : return _getRGBColor(libcdr::CDRColor(5, color.m_colorValue));
112 : case 2:
113 0 : return _getRGBColor(libcdr::CDRColor(4, color.m_colorValue));
114 : case 3:
115 0 : return _getRGBColor(libcdr::CDRColor(3, color.m_colorValue));
116 : case 4:
117 0 : return _getRGBColor(libcdr::CDRColor(6, color.m_colorValue));
118 : case 5:
119 0 : return _getRGBColor(libcdr::CDRColor(9, color.m_colorValue));
120 : case 6:
121 0 : return _getRGBColor(libcdr::CDRColor(8, color.m_colorValue));
122 : case 7:
123 0 : return _getRGBColor(libcdr::CDRColor(7, color.m_colorValue));
124 : case 8:
125 0 : return color.m_colorValue;
126 : case 9:
127 0 : return color.m_colorValue;
128 : case 10:
129 0 : return _getRGBColor(libcdr::CDRColor(5, color.m_colorValue));
130 : case 11:
131 0 : return _getRGBColor(libcdr::CDRColor(18, color.m_colorValue));
132 : default:
133 0 : return color.m_colorValue;
134 : }
135 : }
136 :
137 0 : unsigned libcdr::CDRParserState::_getRGBColor(const CDRColor &color)
138 : {
139 0 : unsigned char red = 0;
140 0 : unsigned char green = 0;
141 0 : unsigned char blue = 0;
142 0 : unsigned short colorModel(color.m_colorModel);
143 0 : unsigned colorValue(color.m_colorValue);
144 0 : if (colorModel == 0x19) // Spot colour not handled in the parser
145 : {
146 0 : unsigned short colourIndex = colorValue & 0xffff;
147 0 : std::map<unsigned, CDRColor>::const_iterator iter = m_documentPalette.find(colourIndex);
148 0 : if (iter != m_documentPalette.end())
149 : {
150 0 : colorModel = iter->second.m_colorModel;
151 0 : colorValue = iter->second.m_colorValue;
152 : }
153 : // todo handle tint
154 : }
155 0 : unsigned char col0 = colorValue & 0xff;
156 0 : unsigned char col1 = (colorValue & 0xff00) >> 8;
157 0 : unsigned char col2 = (colorValue & 0xff0000) >> 16;
158 0 : unsigned char col3 = (colorValue & 0xff000000) >> 24;
159 0 : switch (colorModel)
160 : {
161 : case 0x00: // Pantone palette in CDR1
162 : {
163 : static const unsigned char WaldoColorType0_R[] =
164 : {
165 : 0x00, 0xff, 0xde, 0xa1, 0xc5, 0x7d, 0x0c, 0x00, 0x00, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
166 : 0x00, 0x00, 0x00, 0x00, 0xe5, 0xdc, 0xba, 0xa6, 0x82, 0xaf, 0xa9, 0x85, 0x78, 0x60, 0x44, 0xcf,
167 : 0xca, 0xbe, 0xb0, 0x91, 0xaa, 0x91, 0x75, 0x5b, 0x4d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 : 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xc5, 0xa4, 0x6a, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xa2,
172 : 0x8e, 0xff, 0xff, 0xff, 0xff, 0xc2, 0xa1, 0x73, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x9a, 0x84, 0xff,
173 : 0xff, 0xff, 0xff, 0xc8, 0x84, 0x52, 0xff, 0xff, 0xff, 0xff, 0xce, 0x93, 0x5a, 0xff, 0xff, 0xf2,
174 : 0xcb, 0xc5, 0x90, 0x5b, 0xff, 0xff, 0xff, 0xff, 0xcb, 0x95, 0x7f, 0xff, 0xff, 0xf5, 0xed, 0xb2,
175 : 0x7a, 0x4d, 0xff, 0xff, 0xff, 0xe6, 0xc2, 0x9b, 0x43, 0xff, 0xff, 0xff, 0xff, 0xb8, 0x72, 0x48,
176 : 0xff, 0xff, 0xff, 0xc6, 0x8e, 0x58, 0xff, 0xff, 0xec, 0xcc, 0xa3, 0x74, 0x49, 0xff, 0xff, 0xdf,
177 : 0xd6, 0x9a, 0x61, 0x44, 0xff, 0xeb, 0xca, 0xaa, 0x8d, 0x71, 0x59, 0xff, 0xe9, 0xd5, 0xaf, 0x7c,
178 : 0x53, 0x43, 0xff, 0xe7, 0xdb, 0xb8, 0xa1, 0x67, 0x44, 0xff, 0xda, 0xbc, 0x7c, 0x65, 0x40, 0xff,
179 : 0xe8, 0xd3, 0xb8, 0x7d, 0x57, 0x3c, 0xff, 0xe4, 0xd0, 0xa6, 0x6c, 0x4a, 0xff, 0xef, 0xc6, 0xab,
180 : 0x80, 0x68, 0x3f, 0xff, 0xde, 0xd0, 0x8d, 0x7c, 0x66, 0x44, 0xf9, 0xe4, 0xab, 0x63, 0x4e, 0x37,
181 : 0xe6, 0xd2, 0x91, 0x64, 0x45, 0x3b, 0x35, 0xda, 0xb1, 0x6f, 0x48, 0x36, 0x2f, 0x21, 0xc2, 0xab,
182 : 0x8c, 0x3e, 0x25, 0x22, 0x1c, 0xc2, 0xa8, 0x7c, 0x06, 0x00, 0x0a, 0xc9, 0xa7, 0x5f, 0x25, 0x00,
183 : 0x00, 0x00, 0xc4, 0x94, 0x75, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x6c, 0x40, 0x0f, 0x00, 0x00, 0x00,
184 : 0xcc, 0x7f, 0x56, 0x00, 0x00, 0x00, 0x9e, 0x72, 0x2e, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xc7, 0x72,
185 : 0x00, 0x00, 0x00, 0x00, 0xb7, 0x89, 0x6b, 0x17, 0x10, 0x00, 0x16, 0xcc, 0xc0, 0x74, 0x17, 0x15,
186 : 0x12, 0xa1, 0x82, 0x59, 0x2a, 0x1b, 0x24, 0x11, 0xc8, 0xbc, 0x8d, 0x3b, 0x30, 0x2a, 0x2d, 0xc8,
187 : 0xbc, 0x92, 0x2b, 0x31, 0x2a, 0x27, 0xd6, 0xb7, 0x8f, 0x5e, 0x4a, 0x46, 0x3f, 0xe5, 0xda, 0xc0,
188 : 0x89, 0x76, 0x62, 0x45, 0xf6, 0xe8, 0xcc, 0xb0, 0x98, 0x7f, 0x51, 0xf7, 0xe6, 0xd1, 0xc4, 0xac,
189 : 0x98, 0x6e, 0xf9, 0xf4, 0xed, 0xec, 0xbb, 0x9f, 0x74, 0xfd, 0xf6, 0xf1, 0xe9, 0xbf, 0xa1, 0x8e,
190 : 0xd3, 0xb2, 0x96, 0x82, 0x5e, 0x33, 0xd6, 0xb5, 0xaa, 0x7c, 0x54, 0x43, 0x11, 0xc8, 0xac, 0x89,
191 : 0x65, 0x4b, 0x39, 0x13, 0xc8, 0xbc, 0x8d, 0x7f, 0x5d, 0x3a, 0x07, 0xcc, 0xb2, 0x8f, 0x78, 0x51,
192 : 0x28, 0x0f, 0xcc, 0xc3, 0x9a, 0x78, 0x3f, 0x26, 0x21, 0xd4, 0xbd, 0x8b, 0x69, 0x47, 0x2e, 0x22,
193 : 0x3a, 0x4f, 0x59, 0xa0, 0xad, 0xc8, 0xdd, 0x54, 0x7f, 0xa8, 0xe2, 0xea, 0xf7, 0xf7, 0x59, 0x6d,
194 : 0x83, 0xc2, 0xd6, 0xdb, 0xea, 0x4d, 0x9f, 0xc2, 0xe9, 0xe6, 0xf0, 0xf3, 0x3b, 0x5a, 0x68, 0xa5,
195 : 0xb1, 0xcc, 0xd6, 0x4f, 0x91, 0xc8, 0xdb, 0xef, 0xeb, 0xf5, 0x4e, 0x60, 0x70, 0xc5, 0xe8, 0xef,
196 : 0xf4, 0x3f, 0x59, 0x72, 0xc7, 0xd5, 0xe4, 0xf0, 0x42, 0x53, 0x60, 0xbc, 0xd2, 0xe9, 0xec, 0x48,
197 : 0x68, 0x80, 0xc2, 0xd3, 0xeb, 0xf7, 0x3b, 0x55, 0x62, 0xa6, 0xbc, 0xd5, 0xe7, 0x3c, 0x4e, 0x5b,
198 : 0x94, 0xba, 0xd2, 0xe2, 0x21, 0x2d, 0x3e, 0x8b, 0xad, 0xb9, 0xcc, 0x18, 0x0f, 0x0f, 0x65, 0x8c,
199 : 0xa9, 0xc3, 0x00, 0x09, 0x1f, 0x59, 0x81, 0x9f, 0xc3, 0x19, 0x18, 0x21, 0x69, 0x95, 0xa5, 0xb7,
200 : 0x1d, 0x27, 0x39, 0x74, 0x92, 0xc4, 0xe1, 0x1b, 0x16, 0x2b, 0x67, 0x93, 0xb6, 0xd1, 0x39, 0x4e,
201 : 0x56, 0xa6, 0xc8, 0xd5, 0xdd, 0x5a, 0x90, 0xa5, 0xd0, 0xdd, 0xe7, 0xe9, 0xff, 0xff, 0xff, 0xff,
202 : 0xce, 0x7c, 0x46, 0xff, 0xff, 0xf5, 0xf7, 0xc2, 0x86, 0x57, 0xff, 0xff, 0xff, 0xe6, 0xc2, 0x7d,
203 : 0x4d, 0xff, 0xff, 0xff, 0xde, 0xc6, 0x78, 0x4f, 0xca, 0xbc, 0x80, 0x59, 0x4c, 0x38, 0x2f, 0xbf,
204 : 0xae, 0x8a, 0x47, 0x3d, 0x35, 0x28, 0xcf, 0xa8, 0x6c, 0x51, 0x20, 0x1e, 0x9c, 0x8e, 0x6c, 0x33,
205 : 0x26, 0x1d, 0x17, 0xbc, 0x7c, 0x56, 0x21, 0x13, 0x00, 0x00, 0x9e, 0x72, 0x00, 0x0d, 0x00, 0x00,
206 : 0x00, 0xae, 0x7e, 0x50, 0x00, 0x00, 0x00, 0x00, 0xac, 0x7c, 0x5e, 0x00, 0x0a, 0x0c, 0x0d, 0x86,
207 : 0x70, 0x29, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x7c, 0x5c, 0x34, 0x30, 0x24, 0x11, 0xff, 0xfb, 0xf8,
208 : 0xe9, 0xab, 0x85, 0x59, 0x4f, 0x77, 0x8a, 0xbb, 0xbf, 0xca, 0xd6, 0x45, 0x7e, 0xa1, 0xbe, 0xc9,
209 : 0xc9, 0xd3, 0x4d, 0x6a, 0x92, 0xae, 0xbc, 0xc8, 0xd1, 0x43, 0x71, 0x92, 0xc6, 0xd5, 0xdb, 0xdd,
210 : 0x3f, 0x63, 0x8c, 0xba, 0xc0, 0xce, 0xd9, 0x2d, 0x44, 0x69, 0x90, 0xac, 0xc2, 0xd7, 0x1e, 0x3a,
211 : 0x42, 0x73, 0x9b, 0xb7, 0xcc, 0x06, 0x1b, 0x4d, 0x75, 0x9a, 0xb0, 0xc3, 0x00, 0x1a, 0x51, 0x89,
212 : 0xa2, 0xbc, 0xd1, 0x00, 0x18, 0x37, 0x77, 0x94, 0xad, 0xc8, 0x28, 0x4c, 0x6a, 0x7b, 0xa1, 0xaf,
213 : 0xc1, 0x17, 0x3a, 0x57, 0x90, 0xac, 0xc0, 0xd6, 0x34, 0x4a, 0x5d, 0x9e, 0xb1, 0xc9, 0xd8, 0x3f,
214 : 0x5d, 0x7e, 0xb1, 0xc8, 0xd5, 0xdd, 0x49, 0x71, 0xa5, 0xc4, 0xca, 0xd3, 0xda,
215 : };
216 :
217 : static const unsigned char WaldoColorType0_G[] =
218 : {
219 : 0x00, 0xee, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x75, 0xa3, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 : 0x00, 0x00, 0x00, 0x00, 0xde, 0xd9, 0xad, 0x96, 0x78, 0x9b, 0x98, 0x7a, 0x6e, 0x58, 0x3c, 0xc9,
221 : 0xc6, 0xb5, 0xa6, 0x8e, 0x9b, 0x8d, 0x74, 0x5a, 0x4d, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 : 0x00, 0x00, 0x00, 0xff, 0xf6, 0xfb, 0xf4, 0xb0, 0x93, 0x60, 0xf3, 0xf4, 0xef, 0xed, 0xbd, 0x8b,
226 : 0x7e, 0xee, 0xef, 0xea, 0xd9, 0xa1, 0x85, 0x69, 0xed, 0xee, 0xe2, 0xd2, 0x98, 0x7f, 0x72, 0xe9,
227 : 0xea, 0xe0, 0xc7, 0x99, 0x6d, 0x4d, 0xe0, 0xd6, 0xc5, 0xac, 0x8b, 0x6c, 0x4e, 0xd5, 0xce, 0xb5,
228 : 0x83, 0x7e, 0x6f, 0x51, 0xd7, 0xca, 0xa7, 0x98, 0x7d, 0x65, 0x58, 0xe4, 0xd4, 0x9a, 0x7f, 0x58,
229 : 0x47, 0x35, 0xcb, 0xb0, 0x93, 0x75, 0x62, 0x54, 0x29, 0xc1, 0x9e, 0x85, 0x6d, 0x58, 0x3d, 0x29,
230 : 0xbd, 0x8e, 0x70, 0x42, 0x38, 0x2a, 0xc5, 0x8e, 0x76, 0x30, 0x22, 0x10, 0x10, 0xb2, 0x98, 0x59,
231 : 0x26, 0x24, 0x13, 0x18, 0xc3, 0xaa, 0x35, 0x17, 0x00, 0x18, 0x1d, 0xc0, 0x7d, 0x56, 0x07, 0x15,
232 : 0x0b, 0x10, 0xa8, 0x6d, 0x33, 0x10, 0x18, 0x15, 0x09, 0xce, 0x74, 0x1a, 0x00, 0x00, 0x00, 0x7a,
233 : 0x5d, 0x31, 0x00, 0x00, 0x00, 0x10, 0xba, 0x6c, 0x34, 0x00, 0x00, 0x00, 0xa1, 0x60, 0x3c, 0x00,
234 : 0x00, 0x00, 0x00, 0xd0, 0x95, 0x67, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x93, 0x35, 0x00, 0x00, 0x00,
235 : 0xb9, 0x9b, 0x45, 0x0a, 0x0f, 0x17, 0x1d, 0xc4, 0x8a, 0x2b, 0x12, 0x05, 0x0a, 0x05, 0xa6, 0x89,
236 : 0x6f, 0x1d, 0x07, 0x0c, 0x0d, 0xc9, 0xab, 0x89, 0x10, 0x0e, 0x0c, 0xd5, 0xb8, 0x74, 0x3f, 0x17,
237 : 0x00, 0x0e, 0xd5, 0xb0, 0x92, 0x00, 0x2a, 0x28, 0x1c, 0xb0, 0x97, 0x7f, 0x59, 0x40, 0x2f, 0x29,
238 : 0xea, 0xcd, 0xa9, 0x67, 0x42, 0x2f, 0xd7, 0xb7, 0x8a, 0x72, 0x62, 0x44, 0x29, 0xff, 0xf5, 0xd6,
239 : 0x96, 0x78, 0x6b, 0x4b, 0xdf, 0xd0, 0xb9, 0x84, 0x5f, 0x4f, 0x37, 0xf5, 0xf0, 0xe2, 0x85, 0x6e,
240 : 0x58, 0xe8, 0xce, 0xaa, 0x91, 0x6d, 0x5c, 0x41, 0xee, 0xf4, 0xee, 0xb2, 0x95, 0x6f, 0x4a, 0xf6,
241 : 0xff, 0xf5, 0xcb, 0x8b, 0x67, 0x47, 0xf0, 0xe3, 0xd4, 0xa2, 0x7d, 0x6c, 0x5c, 0xf4, 0xf1, 0xe7,
242 : 0xca, 0xa6, 0x80, 0x52, 0xff, 0xff, 0xe7, 0xde, 0xbd, 0x93, 0x57, 0xf6, 0xf1, 0xe0, 0xd6, 0xae,
243 : 0x96, 0x6b, 0xfa, 0xfa, 0xfa, 0xff, 0xbf, 0x99, 0x73, 0xf3, 0xf9, 0xf2, 0xf2, 0xba, 0x9b, 0x86,
244 : 0xc9, 0xa3, 0x8d, 0x7a, 0x58, 0x31, 0xca, 0xa6, 0x9c, 0x73, 0x4a, 0x3e, 0x0f, 0xc0, 0xa3, 0x86,
245 : 0x67, 0x4d, 0x3b, 0x13, 0xc3, 0xb7, 0x8b, 0x7d, 0x5b, 0x3a, 0x0b, 0xc7, 0xac, 0x8f, 0x78, 0x55,
246 : 0x2e, 0x10, 0xb0, 0xa4, 0x7b, 0x60, 0x2d, 0x1a, 0x1b, 0xd2, 0xbb, 0x8e, 0x6a, 0x48, 0x2e, 0x24,
247 : 0x31, 0x46, 0x4e, 0x8f, 0x9d, 0xba, 0xd8, 0x4b, 0x70, 0x8f, 0xd3, 0xe1, 0xef, 0xee, 0x45, 0x4f,
248 : 0x5a, 0xa0, 0xba, 0xc5, 0xd9, 0x35, 0x61, 0x6d, 0xa8, 0xb4, 0xcf, 0xd5, 0x29, 0x3d, 0x3e, 0x7f,
249 : 0x92, 0xab, 0xc4, 0x30, 0x41, 0x3f, 0x92, 0xab, 0xb2, 0xcf, 0x2b, 0x27, 0x22, 0x70, 0x9b, 0xb5,
250 : 0xca, 0x29, 0x33, 0x3c, 0x80, 0x98, 0xb1, 0xcd, 0x1f, 0x21, 0x29, 0x6c, 0x83, 0xa6, 0xb8, 0x26,
251 : 0x2f, 0x2e, 0x6a, 0x8b, 0xa5, 0xc7, 0x1d, 0x29, 0x29, 0x72, 0x8d, 0xaa, 0xc7, 0x20, 0x20, 0x1c,
252 : 0x62, 0x86, 0xa2, 0xc5, 0x1e, 0x23, 0x37, 0x80, 0x9e, 0xaf, 0xc8, 0x23, 0x2d, 0x33, 0x7b, 0x9b,
253 : 0xb1, 0xcd, 0x1b, 0x31, 0x47, 0x7a, 0x9c, 0xab, 0xcf, 0x2b, 0x3e, 0x4e, 0x86, 0xa6, 0xb1, 0xc5,
254 : 0x30, 0x50, 0x6c, 0xa1, 0xb4, 0xdd, 0xf6, 0x38, 0x4f, 0x6c, 0xa6, 0xc7, 0xd9, 0xe8, 0x41, 0x62,
255 : 0x77, 0xbe, 0xd8, 0xde, 0xe4, 0x56, 0x91, 0xae, 0xda, 0xe3, 0xec, 0xef, 0xd1, 0xcd, 0xb6, 0x9c,
256 : 0x85, 0x5a, 0x34, 0xcc, 0xa9, 0x85, 0x78, 0x63, 0x4e, 0x31, 0xb6, 0xa5, 0x83, 0x60, 0x56, 0x3b,
257 : 0x27, 0xa7, 0x88, 0x63, 0x2c, 0x2d, 0x19, 0x18, 0x61, 0x39, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x6b,
258 : 0x3d, 0x20, 0x00, 0x00, 0x00, 0x00, 0x99, 0x4e, 0x0f, 0x00, 0x00, 0x12, 0x79, 0x74, 0x22, 0x00,
259 : 0x00, 0x00, 0x00, 0xd5, 0xac, 0x9a, 0x76, 0x52, 0x39, 0x25, 0xd7, 0xb4, 0x92, 0x76, 0x68, 0x47,
260 : 0x35, 0xe9, 0xe3, 0xc3, 0x94, 0x78, 0x51, 0x32, 0xdf, 0xd0, 0xb9, 0x91, 0x71, 0x5b, 0x37, 0xd6,
261 : 0xcd, 0xa8, 0x8a, 0x6e, 0x57, 0x2e, 0xe9, 0xe5, 0xd4, 0xa5, 0x80, 0x5c, 0x38, 0xff, 0xfe, 0xfa,
262 : 0xec, 0xa2, 0x81, 0x56, 0x42, 0x69, 0x7c, 0xab, 0xb0, 0xc4, 0xd1, 0x2a, 0x59, 0x7a, 0x96, 0xa9,
263 : 0xac, 0xba, 0x2b, 0x3e, 0x6e, 0x84, 0x95, 0xac, 0xb7, 0x2d, 0x43, 0x60, 0x94, 0xa4, 0xc2, 0xcc,
264 : 0x18, 0x2e, 0x56, 0x89, 0x9a, 0xb1, 0xc8, 0x1b, 0x29, 0x48, 0x72, 0x8d, 0xaa, 0xc7, 0x00, 0x20,
265 : 0x1c, 0x5c, 0x84, 0xa4, 0xc3, 0x1c, 0x33, 0x5f, 0x80, 0x9e, 0xaf, 0xc8, 0x25, 0x47, 0x74, 0x9f,
266 : 0xb4, 0xca, 0xdc, 0x1b, 0x39, 0x53, 0x87, 0xa0, 0xb4, 0xd0, 0x38, 0x64, 0x83, 0x8f, 0xad, 0xb9,
267 : 0xcc, 0x27, 0x50, 0x69, 0x9d, 0xb1, 0xcc, 0xde, 0x3d, 0x57, 0x6c, 0xa1, 0xb0, 0xcb, 0xd9, 0x45,
268 : 0x66, 0x87, 0xb2, 0xcc, 0xd9, 0xde, 0x4a, 0x74, 0xa0, 0xc0, 0xc7, 0xd0, 0xd7,
269 : };
270 :
271 : static const unsigned char WaldoColorType0_B[] =
272 : {
273 : 0x00, 0x00, 0x16, 0x6a, 0x8e, 0x89, 0x87, 0xad, 0x6e, 0x02, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00,
274 : 0x00, 0x00, 0x00, 0x00, 0xc5, 0xc7, 0xa4, 0x8d, 0x72, 0x8f, 0x8d, 0x74, 0x6b, 0x57, 0x3e, 0xb5,
275 : 0xba, 0xb2, 0xa6, 0x92, 0x98, 0x90, 0x7e, 0x68, 0x5c, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
279 : 0x00, 0x00, 0x00, 0xff, 0x81, 0x6b, 0x00, 0x0a, 0x00, 0x00, 0x7a, 0x6b, 0x5e, 0x2f, 0x11, 0x00,
280 : 0x00, 0x7a, 0x6a, 0x57, 0x00, 0x00, 0x0d, 0x0f, 0x7a, 0x76, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x7a,
281 : 0x78, 0x1a, 0x00, 0x00, 0x00, 0x05, 0x72, 0x5f, 0x1a, 0x00, 0x00, 0x00, 0x09, 0x61, 0x4c, 0x2b,
282 : 0x00, 0x00, 0x00, 0x01, 0x88, 0x74, 0x19, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x83, 0x4c, 0x2e, 0x2a,
283 : 0x02, 0x06, 0x8b, 0x73, 0x51, 0x00, 0x00, 0x05, 0x0d, 0x98, 0x7c, 0x5d, 0x0d, 0x02, 0x07, 0x04,
284 : 0xab, 0x83, 0x61, 0x30, 0x25, 0x23, 0xba, 0x9e, 0x8e, 0x4f, 0x3a, 0x19, 0x10, 0xb1, 0xa9, 0x78,
285 : 0x54, 0x47, 0x33, 0x2e, 0xbd, 0xb1, 0x6a, 0x43, 0x34, 0x39, 0x1f, 0xc3, 0xa2, 0x86, 0x55, 0x49,
286 : 0x34, 0x30, 0xb9, 0x9c, 0x81, 0x63, 0x5b, 0x44, 0x30, 0xdf, 0xb1, 0x88, 0x56, 0x49, 0x31, 0xc5,
287 : 0xac, 0x98, 0x81, 0x5e, 0x46, 0x36, 0xd4, 0xb2, 0x9e, 0x7b, 0x59, 0x40, 0xd8, 0xc6, 0xa5, 0x89,
288 : 0x71, 0x5d, 0x3c, 0xed, 0xc5, 0xc2, 0x8a, 0x7c, 0x6e, 0x4d, 0xee, 0xff, 0xbe, 0x74, 0x58, 0x47,
289 : 0xd3, 0xc6, 0xa5, 0x7f, 0x56, 0x4e, 0x4a, 0xde, 0xd0, 0xb1, 0x8a, 0x70, 0x5e, 0x4d, 0xcc, 0xc4,
290 : 0xba, 0x88, 0x65, 0x57, 0x45, 0xdc, 0xdd, 0xc4, 0x6a, 0x4f, 0x44, 0xf0, 0xdf, 0xe2, 0xb6, 0x69,
291 : 0x67, 0x44, 0xe5, 0xdc, 0xc7, 0xb4, 0x7f, 0x6c, 0x48, 0xc9, 0xb8, 0xb3, 0xa0, 0x85, 0x5d, 0x4d,
292 : 0xe4, 0xe1, 0xc7, 0x95, 0x61, 0x4e, 0xd2, 0xc1, 0xa1, 0x91, 0x81, 0x5f, 0x3c, 0xe4, 0xdf, 0xc1,
293 : 0x96, 0x7d, 0x71, 0x55, 0xc2, 0xb0, 0xa1, 0x79, 0x5e, 0x50, 0x3f, 0xc2, 0xbe, 0xa3, 0x5c, 0x54,
294 : 0x4b, 0xb1, 0x9d, 0x80, 0x67, 0x52, 0x4a, 0x3d, 0xa5, 0xa2, 0x88, 0x53, 0x40, 0x36, 0x1f, 0xa6,
295 : 0xa0, 0x8f, 0x4c, 0x40, 0x39, 0x30, 0x94, 0x6f, 0x4e, 0x23, 0x22, 0x18, 0x12, 0x91, 0x73, 0x52,
296 : 0x03, 0x00, 0x00, 0x0a, 0x74, 0x6c, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x66, 0x57, 0x22, 0x00, 0x00,
297 : 0x00, 0x00, 0x7e, 0x62, 0x37, 0x0d, 0x00, 0x00, 0x00, 0x78, 0x4f, 0x20, 0x00, 0x00, 0x00, 0x03,
298 : 0xaf, 0x90, 0x80, 0x6d, 0x54, 0x2e, 0xb5, 0x9a, 0x97, 0x71, 0x48, 0x44, 0x0a, 0xa6, 0x96, 0x7d,
299 : 0x64, 0x4b, 0x3b, 0x17, 0xbb, 0xb8, 0x92, 0x82, 0x60, 0x48, 0x1c, 0xbb, 0xb0, 0x99, 0x82, 0x67,
300 : 0x48, 0x20, 0xa6, 0x9d, 0x7f, 0x6a, 0x3d, 0x25, 0x22, 0xc6, 0xb8, 0x91, 0x6d, 0x50, 0x3b, 0x22,
301 : 0x16, 0x3a, 0x2d, 0x72, 0x86, 0x95, 0xad, 0x25, 0x19, 0x2f, 0x60, 0x71, 0x83, 0x98, 0x35, 0x2b,
302 : 0x35, 0x75, 0x8a, 0x8e, 0xa3, 0x22, 0x2e, 0x21, 0x72, 0x80, 0x99, 0x9e, 0x2d, 0x3b, 0x3b, 0x6f,
303 : 0x86, 0x97, 0xaf, 0x20, 0x20, 0x31, 0x79, 0x8d, 0x98, 0xb0, 0x33, 0x32, 0x37, 0x7d, 0x9e, 0xb1,
304 : 0xb6, 0x1b, 0x31, 0x38, 0x7e, 0x90, 0xa5, 0xb9, 0x31, 0x38, 0x44, 0x83, 0x90, 0xa9, 0xb8, 0x4a,
305 : 0x6f, 0x83, 0xa9, 0xb4, 0xc2, 0xcf, 0x3e, 0x61, 0x6f, 0x9a, 0xa6, 0xb9, 0xce, 0x56, 0x77, 0x8b,
306 : 0xa8, 0xc1, 0xcd, 0xe1, 0x3c, 0x4e, 0x6b, 0x99, 0xb5, 0xc2, 0xd0, 0x4c, 0x67, 0x7c, 0xab, 0xbc,
307 : 0xc6, 0xdc, 0x39, 0x51, 0x69, 0x96, 0xac, 0xb3, 0xcd, 0x00, 0x00, 0x27, 0x6d, 0x90, 0x9a, 0xaa,
308 : 0x27, 0x46, 0x5d, 0x85, 0x99, 0xbe, 0xd7, 0x2d, 0x3b, 0x55, 0x84, 0x9e, 0xb2, 0xc1, 0x00, 0x00,
309 : 0x00, 0x64, 0x85, 0x87, 0x9a, 0x00, 0x00, 0x00, 0x5b, 0x65, 0x73, 0x8d, 0x70, 0x64, 0x15, 0x00,
310 : 0x00, 0x00, 0x00, 0x8f, 0x63, 0x32, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x7b, 0x4f, 0x00, 0x00, 0x00,
311 : 0x00, 0xa5, 0x8f, 0x75, 0x1a, 0x37, 0x15, 0x18, 0xff, 0xff, 0xbe, 0x89, 0x74, 0x58, 0x4e, 0xff,
312 : 0xff, 0xdb, 0x80, 0x70, 0x63, 0x52, 0xff, 0xff, 0xc0, 0xa0, 0x5f, 0x4c, 0xcc, 0xcc, 0xcf, 0x8e,
313 : 0x6f, 0x57, 0x45, 0xda, 0xd1, 0xc9, 0xc1, 0x8a, 0x5d, 0x40, 0xca, 0xb6, 0xa1, 0x8b, 0x7c, 0x5b,
314 : 0x48, 0xc3, 0xb7, 0x9e, 0x7c, 0x6c, 0x4f, 0x38, 0xb7, 0xa6, 0x96, 0x76, 0x60, 0x51, 0x32, 0xb0,
315 : 0xa6, 0x89, 0x6e, 0x5c, 0x49, 0x26, 0xa7, 0x95, 0x81, 0x62, 0x57, 0x44, 0x23, 0x78, 0x4f, 0x20,
316 : 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x3e, 0x7e, 0x84, 0x9b, 0xa9, 0x00, 0x43, 0x62, 0x75, 0x8c,
317 : 0x91, 0x9c, 0x32, 0x3e, 0x66, 0x74, 0x80, 0x99, 0x9e, 0x3a, 0x55, 0x6d, 0x9a, 0xa7, 0xb9, 0xc3,
318 : 0x4a, 0x6f, 0x91, 0xad, 0xb3, 0xc2, 0xcd, 0x3e, 0x52, 0x70, 0x8b, 0x9f, 0xb3, 0xc6, 0x4b, 0x77,
319 : 0x8b, 0xac, 0xc1, 0xcd, 0xe1, 0x50, 0x65, 0x85, 0x9c, 0xb8, 0xc5, 0xd4, 0x3e, 0x5b, 0x83, 0xa3,
320 : 0xb4, 0xc2, 0xd0, 0x31, 0x4c, 0x63, 0x8c, 0xa0, 0xb0, 0xc7, 0x40, 0x5c, 0x77, 0x82, 0x9f, 0xa8,
321 : 0xb7, 0x21, 0x4d, 0x63, 0x91, 0xa2, 0xb5, 0xc8, 0x29, 0x35, 0x3d, 0x75, 0x7e, 0xa2, 0xae, 0x11,
322 : 0x00, 0x46, 0x73, 0x91, 0xa2, 0xad, 0x2a, 0x3d, 0x69, 0x7d, 0x85, 0x8f, 0xa3,
323 : };
324 :
325 0 : unsigned short pantoneIndex = ((unsigned short)col1 << 8) | (unsigned short)col0;
326 0 : double pantoneSaturation = (double)(((unsigned short)col3 << 8) | (unsigned short)col2) / 100.0;
327 : typedef struct
328 : {
329 : unsigned char r;
330 : unsigned char g;
331 : unsigned char b;
332 : } RGBColor;
333 0 : RGBColor pureColor = { 0, 0, 0 };
334 0 : if (pantoneIndex < sizeof(WaldoColorType0_R)/sizeof(WaldoColorType0_R[0])
335 : && pantoneIndex < sizeof(WaldoColorType0_G)/sizeof(WaldoColorType0_G[0])
336 : && pantoneIndex < sizeof(WaldoColorType0_B)/sizeof(WaldoColorType0_B[0]))
337 : {
338 0 : pureColor.r = WaldoColorType0_R[pantoneIndex];
339 0 : pureColor.g = WaldoColorType0_G[pantoneIndex];
340 0 : pureColor.b = WaldoColorType0_B[pantoneIndex];
341 : }
342 0 : unsigned tmpRed = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.r*pantoneSaturation);
343 0 : unsigned tmpGreen = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.g*pantoneSaturation);
344 0 : unsigned tmpBlue = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.b*pantoneSaturation);
345 0 : red = (tmpRed < 255 ? (unsigned char)tmpRed : 255);
346 0 : green = (tmpGreen < 255 ? (unsigned char)tmpGreen : 255);
347 0 : blue = (tmpBlue < 255 ? (unsigned char)tmpBlue : 255);
348 : break;
349 : }
350 : // CMYK 100
351 : case 0x01:
352 : case 0x02:
353 : case 0x15:
354 : case 0x14:
355 : {
356 : double cmyk[4] =
357 : {
358 : (double)col0,
359 : (double)col1,
360 : (double)col2,
361 : (double)col3
362 0 : };
363 0 : unsigned char rgb[3] = { 0, 0, 0 };
364 0 : cmsDoTransform(m_colorTransformCMYK2RGB, cmyk, rgb, 1);
365 0 : red = rgb[0];
366 0 : green = rgb[1];
367 0 : blue = rgb[2];
368 : break;
369 : }
370 : // CMYK 255
371 : case 0x03:
372 : case 0x11:
373 : {
374 : double cmyk[4] =
375 : {
376 : (double)col0*100.0/255.0,
377 : (double)col1*100.0/255.0,
378 : (double)col2*100.0/255.0,
379 : (double)col3*100.0/255.0
380 0 : };
381 0 : unsigned char rgb[3] = { 0, 0, 0 };
382 0 : cmsDoTransform(m_colorTransformCMYK2RGB, cmyk, rgb, 1);
383 0 : red = rgb[0];
384 0 : green = rgb[1];
385 0 : blue = rgb[2];
386 : break;
387 : }
388 : // CMY
389 : case 0x04:
390 : {
391 0 : red = 255 - col0;
392 0 : green = 255 - col1;
393 0 : blue = 255 - col2;
394 0 : break;
395 : }
396 : // RGB
397 : case 0x05:
398 : {
399 0 : unsigned char input[3] = { col2, col1, col0 };
400 0 : unsigned char output[3] = { 0, 0, 0 };
401 0 : cmsDoTransform(m_colorTransformRGB2RGB, input, output, 1);
402 0 : red = output[0];
403 0 : green = output[1];
404 0 : blue = output[2];
405 : break;
406 : }
407 : // HSB
408 : case 0x06:
409 : {
410 0 : unsigned short hue = (col1<<8) | col0;
411 0 : double saturation = (double)col2/255.0;
412 0 : double brightness = (double)col3/255.0;
413 :
414 0 : while (hue > 360)
415 0 : hue -= 360;
416 :
417 : double satRed, satGreen, satBlue;
418 :
419 0 : if (hue < 120)
420 : {
421 0 : satRed = (double)(120 - hue) / 60.0;
422 0 : satGreen = (double)hue / 60.0;
423 0 : satBlue = 0;
424 : }
425 0 : else if (hue < 240)
426 : {
427 0 : satRed = 0;
428 0 : satGreen = (double)(240 - hue) / 60.0;
429 0 : satBlue = (double)(hue - 120) / 60.0;
430 : }
431 : else
432 : {
433 0 : satRed = (double)(hue - 240) / 60.0;
434 0 : satGreen = 0.0;
435 0 : satBlue = (double)(360 - hue) / 60.0;
436 : }
437 0 : red = (unsigned char)cdr_round(255*(1 - saturation + saturation * (satRed > 1 ? 1 : satRed)) * brightness);
438 0 : green = (unsigned char)cdr_round(255*(1 - saturation + saturation * (satGreen > 1 ? 1 : satGreen)) * brightness);
439 0 : blue = (unsigned char)cdr_round(255*(1 - saturation + saturation * (satBlue > 1 ? 1 : satBlue)) * brightness);
440 0 : break;
441 : }
442 : // HLS
443 : case 0x07:
444 : {
445 0 : unsigned short hue = (col1<<8) | col0;
446 0 : double lightness = (double)col2/255.0;
447 0 : double saturation = (double)col3/255.0;
448 :
449 0 : while (hue > 360)
450 0 : hue -= 360;
451 :
452 : double satRed, satGreen, satBlue;
453 :
454 0 : if (hue < 120)
455 : {
456 0 : satRed = (double)(120 - hue) / 60.0;
457 0 : satGreen = (double)hue/60.0;
458 0 : satBlue = 0.0;
459 : }
460 0 : else if (hue < 240)
461 : {
462 0 : satRed = 0;
463 0 : satGreen = (double)(240 - hue) / 60.0;
464 0 : satBlue = (double)(hue - 120) / 60.0;
465 : }
466 : else
467 : {
468 0 : satRed = (double)(hue - 240) / 60.0;
469 0 : satGreen = 0;
470 0 : satBlue = (double)(360 - hue) / 60.0;
471 : }
472 :
473 0 : double tmpRed = 2*saturation*(satRed > 1 ? 1 : satRed) + 1 - saturation;
474 0 : double tmpGreen = 2*saturation*(satGreen > 1 ? 1 : satGreen) + 1 - saturation;
475 0 : double tmpBlue = 2*saturation*(satBlue > 1 ? 1 : satBlue) + 1 - saturation;
476 :
477 0 : if (lightness < 0.5)
478 : {
479 0 : red = (unsigned char)cdr_round(255.0*lightness*tmpRed);
480 0 : green = (unsigned char)cdr_round(255.0*lightness*tmpGreen);
481 0 : blue = (unsigned char)cdr_round(255.0*lightness*tmpBlue);
482 : }
483 : else
484 : {
485 0 : red = (unsigned char)cdr_round(255*((1 - lightness) * tmpRed + 2 * lightness - 1));
486 0 : green = (unsigned char)cdr_round(255*((1 - lightness) * tmpGreen + 2 * lightness - 1));
487 0 : blue = (unsigned char)cdr_round(255*((1 - lightness) * tmpBlue + 2 * lightness - 1));
488 : }
489 0 : break;
490 : }
491 : // Grayscale
492 : case 0x09:
493 : {
494 0 : red = col0;
495 0 : green = col0;
496 0 : blue = col0;
497 0 : break;
498 : }
499 : // Lab
500 : case 0x0c:
501 : {
502 : cmsCIELab Lab;
503 0 : Lab.L = (double)col0*100.0/255.0;
504 0 : Lab.a = (double)(signed char)col1;
505 0 : Lab.b = (double)(signed char)col2;
506 0 : unsigned char rgb[3] = { 0, 0, 0 };
507 0 : cmsDoTransform(m_colorTransformLab2RGB, &Lab, rgb, 1);
508 0 : red = rgb[0];
509 0 : green = rgb[1];
510 0 : blue = rgb[2];
511 : break;
512 : }
513 : // Lab
514 : case 0x12:
515 : {
516 : cmsCIELab Lab;
517 0 : Lab.L = (double)col0*100.0/255.0;
518 0 : Lab.a = (double)((signed char)(col1 - 0x80));
519 0 : Lab.b = (double)((signed char)(col2 - 0x80));
520 0 : unsigned char rgb[3] = { 0, 0, 0 };
521 0 : cmsDoTransform(m_colorTransformLab2RGB, &Lab, rgb, 1);
522 0 : red = rgb[0];
523 0 : green = rgb[1];
524 0 : blue = rgb[2];
525 : break;
526 : }
527 : default:
528 0 : break;
529 : }
530 0 : return (unsigned)((red << 16) | (green << 8) | blue);
531 : }
532 :
533 0 : WPXString libcdr::CDRParserState::getRGBColorString(const libcdr::CDRColor &color)
534 : {
535 0 : WPXString tempString;
536 0 : tempString.sprintf("#%.6x", _getRGBColor(color));
537 0 : return tempString;
538 : }
539 :
540 : /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|