Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccUtilXml.cpp
Go to the documentation of this file.
1/** @file
2 File: IccUtilXml.cpp
3
4 Contains: Implementation of XML conversion utilities
5
6 Version: V1
7
8 Copyright: (c) see ICC Software License
9*/
10
11/*
12 * The ICC Software License, Version 0.2
13 *
14 *
15 * Copyright (c) 2003-2012 The International Color Consortium. All rights
16 * reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 *
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 *
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in
27 * the documentation and/or other materials provided with the
28 * distribution.
29 *
30 * 3. In the absence of prior written permission, the names "ICC" and "The
31 * International Color Consortium" must not be used to imply that the
32 * ICC organization endorses or promotes products derived from this
33 * software.
34 *
35 *
36 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 * DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
40 * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This software consists of voluntary contributions made by many
51 * individuals on behalf of the The International Color Consortium.
52 *
53 *
54 * Membership in the ICC is encouraged when this software is used for
55 * commercial purposes.
56 *
57 *
58 * For more information on The International Color Consortium, please
59 * see <http://www.color.org/>.
60 *
61 *
62 */
63
64#include <time.h>
65#include "IccUtilXml.h"
66#include "IccConvertUTF.h"
67#include "IccTagFactory.h"
68
69#ifdef WIN32
70#include <windows.h>
71#ifdef GetClassName
72#undef GetClassName
73#endif
74#endif
75#include <cstring> /* C strings strcpy, memcpy ... */
76#include <math.h> /* nanf */
77
78
79
86
88{
89 m_len = WStrlen(uzStr);
91
92 m_str = (icUInt16Number *)malloc(m_alloc*sizeof(icUInt16Number));
93 memcpy(m_str, uzStr, m_len+1*sizeof(icUInt16Number));
94}
95
97{
98 size_t sizeSrc = strlen(szStr);
99
100 if (sizeSrc) {
101 m_alloc = AllocSize(sizeSrc*2);
102 m_str = (UTF16 *)calloc(m_alloc, sizeof(icUInt16Number)); //overallocate to allow for up to 4 bytes per character
103 UTF16 *szDest = m_str;
104 icConvertUTF8toUTF16((const UTF8 **)&szStr, (const UTF8 *)&szStr[sizeSrc], &szDest, &szDest[m_alloc], lenientConversion);
105 if (m_str[0]==0xfeff) {
106 size_t i;
107 for (i=1; m_str[i]; i++)
108 m_str[i-1] = m_str[i];
109 m_str[i-1] = 0;
110 }
112 }
113 else {
114 m_alloc = 64;
115 m_len = 0;
116 m_str = (icUInt16Number*)calloc(m_alloc, sizeof(icUInt16Number));
117 }
118}
119
121{
122 m_alloc = str.m_alloc;
123 m_len = str.m_len;
124 m_str = (icUInt16Number*)malloc(m_alloc*sizeof(icUInt16Number));
125
126 memcpy(m_str, str.m_str, (m_alloc)*sizeof(icUInt16Number));
127}
128
133
135{
136 m_len = 0;
137 m_str[0] = 0;
138}
139
141{
142 if (len>m_alloc) {
143 size_t nAlloc = AllocSize(len);
144
146
147 if (!m_str) {
148 m_len = 0;
149 return false;
150 }
151 m_alloc = nAlloc;
152 }
153
154 if (len>m_len) {
155 memset(&m_str[m_len], 0x0020, (len-m_len)*sizeof(icUInt16Number));
156 }
157 m_len = len;
158 m_str[m_len] = 0;
159 return true;
160}
161
163{
164 size_t n=0;
165 while(uzStr[n]) n++;
166
167 return n;
168}
169
171{
172 if (m_alloc<=wstr.m_alloc) {
174 if (m_str)
175 m_alloc = wstr.m_alloc;
176 else
177 m_alloc = 0;
178 }
179 if (m_str) {
180 m_len = wstr.m_len;
181
182 memcpy(m_str, wstr.m_str, (m_len+1)*sizeof(icUInt16Number));
183 }
184 else {
185 m_len = 0;
186 }
187
188 return *this;
189}
190
192{
193 FromUtf8(szStr, 0);
194
195 return *this;
196}
197
199{
200 size_t n = WStrlen(uzStr);
201 size_t nAlloc = AllocSize(n);
202
203 if (m_alloc<=nAlloc) {
205 if (m_str)
206 m_alloc = nAlloc;
207 else
208 m_alloc = 0;
209 }
210 if (m_str) {
211 m_len = n;
212
213 memcpy(m_str, uzStr, (m_len+1)*sizeof(icUInt16Number));
214 }
215 else {
216 m_len = 0;
217 }
218
219 return *this;
220}
221
222
223bool CIccUTF16String::FromUtf8(const char *szStr, size_t sizeSrc)
224{
225 if (!sizeSrc)
226 sizeSrc = strlen(szStr);
227
228 if (sizeSrc) {
229 size_t nAlloc = AllocSize(sizeSrc*2);
230 if (m_alloc<=nAlloc) {
231 m_str = (icUInt16Number*)icRealloc(m_str, nAlloc *sizeof(icUInt16Number));
232 m_alloc = nAlloc;
233 }
234 if (m_str) {
235 memset(m_str, 0, m_alloc * sizeof(icUInt16Number));
236 UTF16 *szDest = m_str;
237 icConvertUTF8toUTF16((const UTF8 **)&szStr, (const UTF8 *)&szStr[sizeSrc], &szDest, &szDest[m_alloc], lenientConversion);
238 if (m_str[0]==0xfeff) {
239 size_t i;
240 for (i=1; m_str[i]; i++)
241 m_str[i-1] = m_str[i];
242 m_str[i-1] = 0;
243 }
245 }
246 else {
247 m_len =0;
248 return false;
249 }
250 }
251 else {
252 m_len = 0;
253 m_str[0] = 0;
254 }
255 return true;
256}
257
258const char *CIccUTF16String::ToUtf8(std::string &buf)
259{
260 return icUtf16ToUtf8(buf, m_str, (int)m_len);
261}
262
263const wchar_t *CIccUTF16String::ToWString(std::wstring &buf)
264{
265 size_t i;
266
267 buf.clear();
268
269 for (i=0; i<m_len; i++) {
270 buf += (wchar_t)m_str[i];
271 }
272
273 return buf.c_str();
274}
275
276const char *icFixXml(std::string &buf, const char *szStr)
277{
278 buf = "";
279 while (*szStr) {
280 switch (*szStr) {
281 case '\'':
282 buf += "&apos;";
283 break;
284 case '&':
285 buf += "&amp;";
286 break;
287 case '\"':
288 buf += "&quot;";
289 break;
290 case '<':
291 buf += "&lt;";
292 break;
293 case '>':
294 buf += "&gt;";
295 break;
296 default:
297 buf += *szStr;
298 }
299 szStr++;
300 }
301
302 return buf.c_str();
303}
304
305const char *icFixXml(char *szDest, const char *szStr)
306{
307 char *m_ptr = szDest;
308
309 while (*szStr) {
310 switch (*szStr) {
311 case '\'':
312 strcpy(m_ptr, "&apos;");
313 m_ptr += 6;
314 break;
315 case '&':
316 strcpy(m_ptr, "&amp;");
317 m_ptr += 5;
318 break;
319 case '\"':
320 strcpy(m_ptr, "&quot;");
321 m_ptr += 6;
322 break;
323 case '<':
324 strcpy(m_ptr, "&lt;");
325 m_ptr += 4;
326 break;
327 case '>':
328 strcpy(m_ptr, "&gt;");
329 m_ptr += 4;
330 break;
331 default:
332 *m_ptr++ = *szStr;
333 }
334 szStr++;
335 }
336 *m_ptr = '\0';
337
338 return szDest;
339}
340
341const char *icUtf16ToUtf8(std::string &buf, const icUInt16Number *szSrc, int sizeSrc/*=0*/)
342{
343 if (!sizeSrc) {
344 sizeSrc = (int)CIccUTF16String::WStrlen(szSrc);
345 }
346
347 int n = sizeSrc*4;
348
349 if (n) {
350 char *szBuf = (char *)malloc(n+1);
351 char *szDest = szBuf;
352 icConvertUTF16toUTF8(&szSrc, &szSrc[sizeSrc], (UTF8**)&szDest, (UTF8*)&szDest[n+1], lenientConversion);
353 *szDest= '\0';
354
355 buf = szBuf;
356 free(szBuf);
357 }
358 else {
359 buf.clear();
360 }
361
362 return buf.c_str();
363}
364
365const unsigned short *icUtf8ToUtf16(CIccUTF16String &buf, const char *szSrc, int sizeSrc/*=0*/)
366{
367 buf.FromUtf8(szSrc, sizeSrc);
368
369 return buf.c_str();
370}
371
372const char *icAnsiToUtf8(std::string &buf, const char *szSrc)
373{
374#ifdef WIN32
375 size_t len = strlen(szSrc)+1;
376 wchar_t *szUnicodeBuf = (wchar_t*)malloc(len*sizeof(icUInt16Number)*2);
377 char *szBuf = (char*)malloc(len*2);
378
379 size_t n;
380
381 n=MultiByteToWideChar(CP_ACP, 0, szSrc, (int)len-1, szUnicodeBuf, (int)len*2);
382 szUnicodeBuf[n] = '\0';
383
384 n = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)szUnicodeBuf, (int)n, szBuf, (int)len*2, 0, NULL);
385 szBuf[n] = '\0';
386
387 buf = szBuf;
388
389 free(szBuf);
390 free(szUnicodeBuf);
391#else
392 buf = szSrc;
393#endif
394 return buf.c_str();
395}
396
397const char *icUtf8ToAnsi(std::string &buf, const char *szSrc)
398{
399#ifdef WIN32
400 size_t len = strlen(szSrc)+1;
401 wchar_t *szUnicodeBuf = (wchar_t*)malloc(len*sizeof(icUInt16Number)*2);
402 char *szBuf = (char*)malloc(len*2);
403
404 size_t n;
405
406 n=MultiByteToWideChar(CP_UTF8, 0, szSrc, (int)len, szUnicodeBuf, (int)len*2);
407 szUnicodeBuf[n] = '\0';
408
409 n = WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)szUnicodeBuf, (int)n, szBuf, (int)len*2, "?", NULL);
410 szBuf[n] = '\0';
411
412 buf = szBuf;
413
414 free(szBuf);
415 free(szUnicodeBuf);
416#else
417 buf = szSrc;
418#endif
419 return buf.c_str();
420}
421
423{
424public:
425 CIccDumpXmlCLUT(std::string *xml, icConvertType nType, std::string blanks, icUInt16Number nSamples, icUInt8Number nPixelsPerRow)
426 {
427 m_xml = xml;
428 m_nType = nType;
429 m_blanks = blanks;
430 m_nSamples = nSamples;
431 m_nPixelsPerRow = nPixelsPerRow;
432 m_nCurPixel = 0;
433 }
434
435 virtual void PixelOp(icFloatNumber* pGridAdr, icFloatNumber* pData)
436 {
437 int i;
438 char buf[128];
439
441 *m_xml += m_blanks;
442
443 switch(m_nType) {
444 case icConvert8Bit:
445 for (i=0; i<m_nSamples; i++) {
446 sprintf(buf, " %3d", (icUInt8Number)(pData[i]*255.0 + 0.5));
447 *m_xml += buf;
448 }
449 break;
450 case icConvert16Bit:
451 for (i=0; i<m_nSamples; i++) {
452 sprintf(buf, " %5d", (icUInt16Number)(pData[i]*65535.0 + 0.5));
453 *m_xml += buf;
454 }
455 break;
456 case icConvertFloat:
457 default:
458 for (i=0; i<m_nSamples; i++) {
459 sprintf(buf, " %13.8f", pData[i]);
460 *m_xml += buf;
461 }
462 break;
463 }
464 m_nCurPixel++;
465 if (!(m_nCurPixel % m_nPixelsPerRow)) {
466 *m_xml += "\n";
467 }
468 }
469
470 void Finish()
471 {
473 *m_xml += "\n";
474 }
475 }
476
477 std::string *m_xml;
479 std::string m_blanks;
483};
484
485bool icCLUTDataToXml(std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks,
486 bool bSaveGridPoints/*=false*/)
487{
488 char buf[128];
489 int nStartType = nType;
490 if (nType == icConvertVariable) {
491 nType = pCLUT->GetPrecision()==1 ? icConvert8Bit : icConvert16Bit;
492 }
493
494 if (bSaveGridPoints) {
495 xml += blanks + " <GridPoints>";
496 int i;
497
498 for (i=0; i<pCLUT->GetInputDim(); i++) {
499 if (i)
500 sprintf(buf, " %d", pCLUT->GridPoint(i));
501 else
502 sprintf(buf, "%d", pCLUT->GridPoint(i));
503 xml += buf;
504 }
505 xml += "</GridPoints>\n";
506 }
507
508 int nPixelsPerRow = pCLUT->GridPoint(0);
509
510 // if the CLUT has no GridPoints, profile is invalid
511 if (nPixelsPerRow == 0) {
512 printf("\nError! - CLUT Table not found.\n");
513 return false;
514 }
515
516 CIccDumpXmlCLUT dumper(&xml, nType, blanks + " ", pCLUT->GetOutputChannels(), nPixelsPerRow);
517
518 xml += blanks + " <TableData";
519
520 if (nStartType == icConvertVariable && nType == icConvert8Bit) {
521 sprintf(buf, " Precision=\"1\"");
522 xml += buf;
523 }
524
525 xml += ">\n";
526
527 pCLUT->Iterate(&dumper);
528
529 dumper.Finish();
530
531 xml += blanks + " </TableData>\n";
532
533 return true;
534
535}
536
537bool icCLUTToXml(std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks,
538 bool bSaveGridPoints/*=false*/, const char *szExtraAttrs/*=""*/, const char *szName/*="CLUT"*/)
539{
540 char buf[128];
541 xml += blanks + "<" + szName;
542
543 if (!bSaveGridPoints) {
544 sprintf(buf, " GridGranularity=\"%d\"", pCLUT->GridPoint(0));
545 xml += buf;
546 }
547
548 if (szExtraAttrs && *szExtraAttrs) {
549 xml += szExtraAttrs;
550 }
551 xml += ">\n";
552
553 icCLUTDataToXml(xml, pCLUT, nType, blanks, bSaveGridPoints);
554
555 xml += blanks + "</" + szName + ">\n";
556 return true;
557}
558
559icFloatNumber icXmlStrToFloat(const xmlChar *szStr)
560{
561 float f=0.0;
562 sscanf((const char*)szStr, "%f", &f);
563
564 return (icFloatNumber)f;
565}
566
567icSignature icXmlStrToSig(const char *szStr)
568{
569 return icGetSigVal(szStr);
570}
571
572const char *icXmlAttrValue(xmlAttr *attr, const char *szDefault)
573{
574 if (attr && attr->children && attr->children->type == XML_TEXT_NODE && attr->children->content)
575 return (const char*)attr->children->content;
576
577 return szDefault;
578}
579
580const char *icXmlAttrValue(xmlNode *pNode, const char *szName, const char *szDefault)
581{
582 xmlAttr *attr = icXmlFindAttr(pNode, szName);
583 if (attr) {
584 return icXmlAttrValue(attr, szDefault);
585 }
586 return szDefault;
587}
588
590{
591 if (!pNode || !pNode->children || !pNode->children->content)
592 return 0;
593
594 return icGetSigVal((const char*)pNode->children->content);
595}
596
597static int hexValue(char c)
598{
599 if (c>='0' && c<='9')
600 return c-'0';
601 if (c>='A' && c<='F')
602 return c-'A'+10;
603 if (c>='a' && c<='f')
604 return c-'a'+10;
605 return -1;
606}
607
608
609icUInt32Number icXmlGetHexData(void *pBuf, const char *szText, icUInt32Number nBufSize)
610{
611 unsigned char *pDest = (unsigned char*)pBuf;
612 icUInt32Number rv =0;
613
614 while(*szText && rv<nBufSize) {
615 int c1=hexValue(szText[0]);
616 int c2=hexValue(szText[1]);
617 if (c1>=0 && c2>=0) {
618 *pDest = c1*16+ c2;
619 pDest++;
620 szText +=2;
621 rv++;
622 }
623 else {
624 szText++;
625 }
626 }
627 return rv;
628}
629
631{
632 icUInt32Number rv =0;
633
634 while(*szText) {
635 int c1=hexValue(szText[0]);
636 int c2=hexValue(szText[1]);
637 if (c1>=0 && c2>=0) {
638 szText +=2;
639 rv++;
640 }
641 else {
642 szText++;
643 }
644 }
645 return rv;
646}
647
648icUInt32Number icXmlDumpHexData(std::string &xml, std::string blanks, void *pBuf, icUInt32Number nBufSize)
649{
650 icUInt8Number *m_ptr = (icUInt8Number *)pBuf;
651 char buf[15];
653
654 for (i=0; i<nBufSize; i++, m_ptr++) {
655 if (!(i%32)) {
656 if (i)
657 xml += "\n";
658 xml += blanks;
659 }
660 sprintf(buf, "%02x", *m_ptr);
661 xml += buf;
662 }
663 if (i) {
664 xml += "\n";
665 }
666 return i;
667}
668
669xmlAttr *icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
670{
671 if (!pNode) return NULL;
672
673 xmlAttr *attr;
674
675 for (attr = pNode->properties; attr; attr = attr->next) {
676 if (attr->type != XML_ATTRIBUTE_NODE)
677 continue;
678
679 if (!icXmlStrCmp(attr->name, szAttrName)) {
680 return attr;
681 }
682 }
683
684 return NULL;
685}
686
687xmlNode *icXmlFindNode(xmlNode *pNode, const char *szNodeName)
688{
689 if (!pNode) return NULL;
690
691 for (; pNode; pNode = pNode->next) {
692 if (pNode->type != XML_ELEMENT_NODE)
693 continue;
694
695 if (!icXmlStrCmp(pNode->name, szNodeName)) {
696 return pNode;
697 }
698 }
699
700 return NULL;
701}
702
703icUInt32Number icXmlNodeCount(xmlNode *pNode, const char *szNodeName)
704{
705 icUInt32Number rv = 0;
706 for (; pNode; pNode = pNode->next) {
707 if (pNode->type == XML_ELEMENT_NODE &&
708 !icXmlStrCmp(pNode->name, szNodeName)) {
709 rv++;
710 }
711 }
712 return rv;
713}
714
715icUInt32Number icXmlNodeCount2(xmlNode *pNode, const char *szNodeName1, const char *szNodeName2)
716{
717 icUInt32Number rv = 0;
718 for (; pNode; pNode = pNode->next) {
719 if (pNode->type == XML_ELEMENT_NODE &&
720 (!icXmlStrCmp(pNode->name, szNodeName1) || !icXmlStrCmp(pNode->name, szNodeName2))) {
721 rv++;
722 }
723 }
724 return rv;
725}
726
727icUInt32Number icXmlNodeCount3(xmlNode *pNode, const char *szNodeName1, const char *szNodeName2, const char *szNodeName3)
728{
729 icUInt32Number rv = 0;
730 for (; pNode; pNode = pNode->next) {
731 if (pNode->type == XML_ELEMENT_NODE &&
732 (!icXmlStrCmp(pNode->name, szNodeName1) || !icXmlStrCmp(pNode->name, szNodeName2) || !icXmlStrCmp(pNode->name, szNodeName3))) {
733 rv++;
734 }
735 }
736 return rv;
737}
738
739template <class T, icTagTypeSignature Tsig>
741{
742 m_pBuf = NULL;
743 m_nSize = 0;
744}
745
746template <class T, icTagTypeSignature Tsig>
748{
749 if (m_pBuf) {
750 free(m_pBuf);
751 }
752}
753
754template <class T, icTagTypeSignature Tsig>
756{
757 char scanType[2] = {0};
758 scanType[0] = (Tsig == icSigFloatArrayType ? 'f' : 'n');
759 scanType[1] = 0;
760
761 icUInt32Number n = icXmlNodeCount(pNode, scanType);
762
763 if (n) {
764 if (!SetSize(n))
765 return false;
766 return ParseArray(m_pBuf, m_nSize, pNode);
767 }
768
769 for ( ;pNode && pNode->type!= XML_TEXT_NODE; pNode=pNode->next);
770
771 if (!pNode || !pNode->content)
772 return false;
773
774 n = ParseTextCount((const char*)pNode->content);
775
776 if (!n || !SetSize(n))
777 return false;
778
779 return ParseArray(m_pBuf, m_nSize, pNode);
780}
781
782template <class T, icTagTypeSignature Tsig>
784{
785 icUInt32Number n = ParseTextCount(szText);
786
787 if (n) {
788 if (!SetSize(n))
789 return false;
790
791 return ParseText(m_pBuf, m_nSize, szText)==m_nSize;
792 }
793
794 return false;
795}
796
797template <class T, icTagTypeSignature Tsig>
799{
800 if (pNode->children && pNode->children->type==XML_TEXT_NODE) {
801 return ParseTextArray((const char*)pNode->children->content);
802 }
803 return false;
804}
805
806template <class T, icTagTypeSignature Tsig>
807bool CIccXmlArrayType<T, Tsig>::ParseTextArrayNum(const char *szText, icUInt32Number num, std::string &parseStr)
808{
809 icUInt32Number n = ParseTextCountNum(szText, num, parseStr);
810 if (n) {
811 if (!SetSize(n))
812 return false;
813 return ParseText(m_pBuf, m_nSize, szText)==m_nSize;
814 }
815
816 return false;
817}
818
819template <class T, icTagTypeSignature Tsig>
820bool CIccXmlArrayType<T, Tsig>::DumpArray(std::string &xml, std::string blanks, T *buf, icUInt32Number nBufSize,
821 icConvertType nType, icUInt8Number nColumns)
822{
823 char str[200];
824
825 if (!nColumns) nColumns = 1;
827
828 for (i=0; i<nBufSize; i++) {
829 if (!(i%nColumns)) {
830 xml += blanks;
831 }
832 else {
833 xml += " ";
834 }
835
836 switch (Tsig) {
838 switch (nType) {
839 case icConvert8Bit:
840 default:
841 sprintf(str, "%u", (icUInt8Number)buf[i]);
842 break;
843
844 case icConvert16Bit:
845 sprintf(str, "%u", (icUInt16Number)((icFloatNumber)buf[i] * 65535.0 / 255.0 + 0.5));
846 break;
847
848 case icConvertFloat:
849 sprintf(str, icXmlFloatFmt, (icFloatNumber)buf[i] / 255.0);
850 break;
851 }
852 break;
853
855 switch (nType) {
856 case icConvert8Bit:
857 sprintf(str, "%u", (icUInt16Number)((icFloatNumber)buf[i] * 255.0 / 65535.0 + 0.5));
858 break;
859
860 case icConvert16Bit:
861 default:
862 sprintf(str, "%u", (icUInt16Number)buf[i]);
863 break;
864
865 case icConvertFloat:
866 sprintf(str, icXmlFloatFmt, (icFloatNumber)buf[i] / 65535.0);
867 break;
868 }
869 break;
870
872 sprintf(str, "%u", (icUInt32Number)buf[i]);
873 break;
874
876 // unused
877 break;
878
882 switch (nType) {
883 case icConvert8Bit:
884 sprintf(str, "%u", (icUInt8Number)(buf[i] * 255.0 + 0.5));
885 break;
886
887 case icConvert16Bit:
888 sprintf(str, "%u", (icUInt16Number)(buf[i] * 65535.0 + 0.5));
889 break;
890
891 case icConvertFloat:
892 default:
893 sprintf(str, icXmlFloatFmt, (icFloatNumber)buf[i]);
894 }
895 break;
896 }
897 xml += str;
898 if (i%nColumns == nColumns-1) {
899 xml += "\n";
900 }
901 }
902
903 if (i%nColumns) {
904 xml += "\n";
905 }
906
907 return true;
908}
909
910// for multi-platform support
911// replaced "_inline" with "inline"
912static inline bool icIsNumChar(char c)
913{
914 if ((c>='0' && c<='9') || c=='.' || c=='+' || c=='-' || c=='e' || c == 'n' || c == 'a')
915 return true;
916 return false;
917}
918
919// function used when checking contents of a file
920// count the number of entries.
921template <class T, icTagTypeSignature Tsig>
923{
924 icUInt32Number n = 0;
925 bool bInNum = false;
926 //icUInt32Number count = 1;
927
928 //while (*szText) {
929 for (icUInt32Number i=0; i<num; i++) {
930 if (icIsNumChar(*szText)) {
931 if (!bInNum) {
932 bInNum = true;
933 }
934 }
935 else if (bInNum && !strncmp(szText, "#QNAN", 5)) { //Handle 1.#QNAN000 (non a number)
936 i+=4;
937 szText+=4;
938 }
939 // an invalid character is encountered (not digit and not space)
940 else if (!isspace(*szText) && i <= num ){
941 char line[100];
942 sprintf(line, "Data '%c' in position %d is not a number. ", *szText, i);
943 parseStr += line;
944 return false;
945 }
946 else if (bInNum) { //char is a space
947 n++;
948 bInNum = false;
949 }
950 szText++;
951 //count++;
952 }
953 if (bInNum) {
954 n++;
955 }
956
957 return n;
958}
959
960template <class T, icTagTypeSignature Tsig>
962{
963 icUInt32Number n = 0;
964 bool bInNum = false;
965
966 while (*szText) {
967 if (icIsNumChar(*szText)) {
968 if (!bInNum) {
969 bInNum = true;
970 }
971 }
972 else if (bInNum && !strncmp(szText, "#QNAN", 5)) { //Handle 1.#QNAN000 (non a number)
973 szText+=4;
974 }
975 else if (bInNum) {
976 n++;
977 bInNum = false;
978 }
979 szText++;
980 }
981 if (bInNum) {
982 n++;
983 }
984
985 return n;
986}
987
988template <class T, icTagTypeSignature Tsig>
990{
991 icUInt32Number n = 0, b = 0;
992 bool bInNum = false;
993 char num[256] = {0};
994
995 while (*szText && n<nSize) {
996 if (icIsNumChar(*szText)) {
997 if (!bInNum) {
998 bInNum = true;
999 b=0;
1000 }
1001 num[b] = *szText;
1002
1003 if (b+2<sizeof(num))
1004 b++;
1005 }
1006 else if (bInNum) {
1007 num[b] = 0;
1008 if (!strncmp(num, "nan", 3) || !strncmp(num, "-nan", 4)) {
1009 pBuf[n] = (T)nanf(num);
1010 }
1011 else {
1012 pBuf[n] = (T)atof(num);
1013 }
1014 n++;
1015 bInNum = false;
1016 }
1017 szText++;
1018 }
1019 if (bInNum) {
1020 num[b] = 0;
1021 if (!strncmp(num, "nan", 3) || !strncmp(num, "-nan", 4)) {
1022 pBuf[n] = (T)nanf(num);
1023 }
1024 else {
1025 pBuf[n] = (T)atof(num);
1026 }
1027 n++;
1028 }
1029
1030 return n;
1031}
1032
1033template <class T, icTagTypeSignature Tsig>
1034bool CIccXmlArrayType<T, Tsig>::ParseArray(T* pBuf, icUInt32Number nSize, xmlNode *pNode)
1035{
1037 if (Tsig==icSigFloatArrayType) {
1038 n = icXmlNodeCount(pNode, "f");
1039
1040 if (!n) {
1041 if (pNode->type!=XML_TEXT_NODE || !pNode->content)
1042 return false;
1043
1044 n = ParseTextCount((const char*)pNode->content);
1045 if (!n || n>nSize)
1046 return false;
1047
1048 ParseText(pBuf, n, (const char*)pNode->content);
1049 }
1050 else {
1051 if (n>nSize)
1052 return false;
1053
1055 for (i=0; i<nSize && pNode; pNode = pNode->next) {
1056 if (pNode->type == XML_ELEMENT_NODE &&
1057 !icXmlStrCmp(pNode->name, "f") &&
1058 pNode->children &&
1059 pNode->children->content) {
1060 float f;
1061 sscanf((const char *)(pNode->children->content), "%f", &f);
1062 pBuf[i] = (T)f;
1063 i++;
1064 }
1065 }
1066 }
1067 }
1068 else {
1069 n = icXmlNodeCount(pNode, "n");
1070
1071 if (!n) {
1072 if (pNode->type!=XML_TEXT_NODE || !pNode->content)
1073 return false;
1074
1075 n = ParseTextCount((const char *)pNode->content);
1076 if (!n || n>nSize)
1077 return false;
1078
1079 n = ParseText(pBuf, n, (const char *)pNode->content);
1080 }
1081 else {
1082 if (n>nSize)
1083 return false;
1084
1086 for (i=0; i<nSize && pNode; pNode = pNode->next) {
1087 if (pNode->type == XML_ELEMENT_NODE &&
1088 !icXmlStrCmp(pNode->name, "n") &&
1089 pNode->children &&
1090 pNode->children->content) {
1091 pBuf[i] = (T)atol((const char *)(pNode->children->content));
1092 i++;
1093 }
1094 }
1095 }
1096 }
1097 return nSize==n;
1098}
1099
1100
1101template <class T, icTagTypeSignature Tsig>
1103{
1104 if (m_pBuf) {
1105 free(m_pBuf);
1106 }
1107 m_pBuf = (T*)malloc(nSize * sizeof(T));
1108 if (!m_pBuf) {
1109 m_nSize = 0;
1110 return false;
1111 }
1112 m_nSize = nSize;
1113
1114 return true;
1115}
1116
1117//Make sure typedef classes get built
1125
1126
1128{
1129 if (!strcmp(szRenderingIntent, "Perceptual"))
1130 return icPerceptual;
1131 else if (!strcmp(szRenderingIntent, "Media-relative colorimetric"))
1133 else if (!strcmp(szRenderingIntent, "Saturation"))
1134 return icSaturation;
1135 else if (!strcmp(szRenderingIntent, "ICC-absolute colorimetric"))
1137
1138 return icPerceptual;
1139}
1140
1142{
1143 const icChar *rv = CIccTagCreator::GetTagTypeSigName(tagTypeSig);
1144
1145 // if the tag signature is not found, it is a custom type.
1146 if (!rv)
1147 return "PrivateType";
1148
1149 return rv;
1150}
1151
1153{
1154 return CIccTagCreator::GetTagTypeNameSig(szTagType);
1155
1156}
1157
1159{
1160 const icChar *rv = CIccTagCreator::GetTagSigName(tagTypeSig);
1161
1162 // if the tag signature is not found, it is a custom type.
1163 if (!rv)
1164 return "PrivateTag";
1165
1166 return rv;
1167}
1168
1173
1174
1176{
1177 if (!strcmp(str, "Unknown observer"))
1178 return icStdObsUnknown;
1179
1180 if (!strcmp(str, "CIE 1931 (two degree) standard observer"))
1182
1183 if (!strcmp(str, "CIE 1964 (ten degree) standard observer"))
1184 return icStdObs1964TenDegrees;
1185
1186 return icStdObsCustom;
1187}
1188
1189
1191{
1192 if (!strcmp(str, "Geometry Unknown"))
1193 return icGeometryUnknown;
1194
1195 if (!strcmp(str, "Geometry 0-45 or 45-0"))
1196 return icGeometry045or450;
1197
1198 if (!strcmp(str, "Geometry 0-d or d-0"))
1199 return icGeometry0dord0;
1200
1201 if (!strcmp(str, "Max Geometry"))
1202 return icMaxEnumGeometry;
1203
1204 return icGeometryUnknown;
1205}
1206
1208{
1209 if (!strcmp(str, "Flare 0"))
1210 return icFlare0;
1211
1212 if (!strcmp(str, "Flare 100"))
1213 return icFlare100;
1214
1215 if (!strcmp(str, "Max Flare"))
1216 return icMaxEnumFlare;
1217
1218 return icFlare0;
1219}
1220
1222{
1223 if (!strcmp(str, "Illuminant Unknown"))
1224 return icIlluminantUnknown;
1225
1226 if (!strcmp(str, "Illuminant D50") || !strcmp(str, "D50"))
1227 return icIlluminantD50;
1228
1229 if (!strcmp(str, "Illuminant D65") || !strcmp(str, "D65"))
1230 return icIlluminantD65;
1231
1232 if (!strcmp(str, "Illuminant D93") || !strcmp(str, "D93"))
1233 return icIlluminantD93;
1234
1235 if (!strcmp(str, "Illuminant F2") || !strcmp(str, "F2"))
1236 return icIlluminantF2;
1237
1238 if (!strcmp(str, "Illuminant D55") || !strcmp(str, "D55"))
1239 return icIlluminantD55;
1240
1241 if (!strcmp(str, "Illuminant A") || !strcmp(str, "A"))
1242 return icIlluminantA;
1243
1244 if (!strcmp(str, "Illuminant EquiPowerE") || !strcmp(str, "Illuminant E") || !strcmp(str, "E"))
1246
1247 if (!strcmp(str, "Illuminant F8") || !strcmp(str, "F8"))
1248 return icIlluminantF8;
1249
1250 if (!strcmp(str, "Illuminant Black Body") || !strcmp(str, "Black Body"))
1251 return icIlluminantBlackBody;
1252
1253 if (!strcmp(str, "Illuminant Daylight") || !strcmp(str, "Daylight"))
1254 return icIlluminantDaylight;
1255
1256 if (!strcmp(str, "Illuminant B") || !strcmp(str, "B"))
1257 return icIlluminantB;
1258
1259 if (!strcmp(str, "Illuminant C") || !strcmp(str, "C"))
1260 return icIlluminantC;
1261
1262 if (!strcmp(str, "Illuminant F1") || !strcmp(str, "F1"))
1263 return icIlluminantF1;
1264
1265 if (!strcmp(str, "Illuminant F3") || !strcmp(str, "F3"))
1266 return icIlluminantF3;
1267
1268 if (!strcmp(str, "Illuminant F4") || !strcmp(str, "F4"))
1269 return icIlluminantF4;
1270
1271 if (!strcmp(str, "Illuminant F5") || !strcmp(str, "F5"))
1272 return icIlluminantF5;
1273
1274 if (!strcmp(str, "Illuminant F6") || !strcmp(str, "F6"))
1275 return icIlluminantF6;
1276
1277 if (!strcmp(str, "Illuminant F7") || !strcmp(str, "F7"))
1278 return icIlluminantF7;
1279
1280 if (!strcmp(str, "Illuminant F9") || !strcmp(str, "F9"))
1281 return icIlluminantF9;
1282
1283 if (!strcmp(str, "Illuminant F10") || !strcmp(str, "F10"))
1284 return icIlluminantF10;
1285
1286 if (!strcmp(str, "Illuminant F11") || !strcmp(str, "F11"))
1287 return icIlluminantF11;
1288
1289 if (!strcmp(str, "Illuminant F12") || !strcmp(str, "F12"))
1290 return icIlluminantF12;
1291
1292 return icIlluminantCustom;
1293}
1294
1296{
1297 switch (str) {
1298 case icStdObsUnknown:
1299 return "Unknown Observer";
1300
1302 return "CIE 1931 standard colorimetric observer";
1303
1305 return "CIE 1964 standard colorimetric observer";
1306
1307 default:
1308 return "Unknown Observer";
1309 }
1310}
1311
1313{
1314 unsigned int day=0, month=0, year=0, hours=0, minutes=0, seconds=0;
1315 icDateTimeNumber dateTime = {};
1316
1317 if (!stricmp(str, "now")) {
1318 time_t rawtime;
1319 struct tm * timeinfo;
1320
1321 time ( &rawtime );
1322 timeinfo = localtime ( &rawtime );
1323 year = timeinfo->tm_year+1900;
1324 month = timeinfo->tm_mon+1;
1325 day = timeinfo->tm_mday;
1326 hours = timeinfo->tm_hour;
1327 minutes = timeinfo->tm_min;
1328 seconds = timeinfo->tm_sec;
1329 }
1330 else {
1331 sscanf(str, "%d-%02d-%02dT%02d:%02d:%02d", &year, &month, &day, &hours, &minutes, &seconds);
1332 }
1333
1334 dateTime.year = year;
1335 dateTime.month = month;
1336 dateTime.day = day;
1337 dateTime.hours = hours;
1338 dateTime.minutes = minutes;
1339 dateTime.seconds = seconds;
1340
1341 return dateTime;
1342}
1343
1345{
1346 icUInt64Number devAttr = 0;
1347 xmlAttr *attr = icXmlFindAttr(pNode, "ReflectiveOrTransparency");
1348 if (attr && !strcmp(icXmlAttrValue(attr), "transparency")) {
1349 devAttr |= icTransparency;
1350 }
1351
1352 attr = icXmlFindAttr(pNode, "GlossyOrMatte");
1353 if (attr && !strcmp(icXmlAttrValue(attr), "matte")) {
1354 devAttr |= icMatte;
1355 }
1356
1357 attr = icXmlFindAttr(pNode, "MediaPolarity");
1358 if (attr && !strcmp(icXmlAttrValue(attr), "negative")) {
1359 devAttr |= icMediaNegative;
1360 }
1361
1362 attr = icXmlFindAttr(pNode, "MediaColour");
1363 if (attr && !strcmp(icXmlAttrValue(attr), "blackAndWhite")) {
1364 devAttr |= icMediaBlackAndWhite;
1365 }
1366
1367 attr = icXmlFindAttr(pNode, "VendorSpecific");
1368 if (attr) {
1369 icUInt64Number vendor;
1370 sscanf(icXmlAttrValue(attr), "%llx", &vendor);
1371 devAttr |= vendor;
1372 }
1373
1374 return devAttr;
1375}
1376
1378{
1379 if (!strcmp(str, "ITU-R BT.709"))
1380 return icColorantITU;
1381
1382 if (!strcmp(str, "SMPTE RP145-1994"))
1383 return icColorantSMPTE;
1384
1385 if (!strcmp(str, "EBU Tech.3213-E"))
1386 return icColorantEBU;
1387
1388 if (!strcmp(str, "P22"))
1389 return icColorantP22;
1390
1391 return icColorantUnknown;
1392}
1393
1395{
1396 if (!strcmp(str, "Status A"))
1397 return icSigStatusA;
1398
1399 if (!strcmp(str, "Status E"))
1400 return icSigStatusE;
1401
1402 if (!strcmp(str, "Status I"))
1403 return icSigStatusI;
1404
1405 if (!strcmp(str, "Status T"))
1406 return icSigStatusT;
1407
1408 if (!strcmp(str, "Status M"))
1409 return icSigStatusM;
1410
1411 if (!strcmp(str, "DIN with no polarizing filter"))
1412 return icSigDN;
1413
1414 if (!strcmp(str, "DIN with polarizing filter"))
1415 return icSigDNP;
1416
1417 if (!strcmp(str, "Narrow band DIN with no polarizing filter"))
1418 return icSigDNN;
1419
1420 if (!strcmp(str, "Narrow band DIN with polarizing filter"))
1421 return icSigDNNP;
1422
1423 return icSigStatusA;
1424}
1425
1426const std::string icGetDeviceAttrName(icUInt64Number devAttr)
1427{
1428 char line[256];
1429 std::string xml;
1430
1431 if (devAttr & icTransparency)
1432 sprintf(line, "<DeviceAttributes ReflectiveOrTransparency=\"transparency\"");
1433 else
1434 sprintf(line, "<DeviceAttributes ReflectiveOrTransparency=\"reflective\"");
1435 xml += line;
1436
1437
1438 if (devAttr & icMatte)
1439 sprintf(line, " GlossyOrMatte=\"matte\"");
1440 else
1441 sprintf(line, " GlossyOrMatte=\"glossy\"");
1442 xml += line;
1443
1444
1445 if (devAttr & icMediaNegative)
1446 sprintf(line, " MediaPolarity=\"negative\"");
1447 else
1448 sprintf(line, " MediaPolarity=\"positive\"");
1449 xml += line;
1450
1451 if (devAttr & icMediaBlackAndWhite)
1452 sprintf(line, " MediaColour=\"blackAndwhite\"");
1453 else
1454 sprintf(line, " MediaColour=\"colour\"");
1455 xml += line;
1456
1458
1459 if (devAttr & otherAttr) {
1460 sprintf(line, " VendorSpecific=\"%016llx\"", devAttr & otherAttr);
1461 xml += line;
1462 }
1463
1464 xml += "/>\n";
1465
1466 return xml;
1467}
1468
1469const std::string icGetHeaderFlagsName(icUInt32Number flags, bool bUsesMCS)
1470{
1471 char line[256];
1472 std::string xml;
1473
1474 if (flags & icEmbeddedProfileTrue)
1475 sprintf(line, "<ProfileFlags EmbeddedInFile=\"true\"");
1476 else
1477 sprintf(line, "<ProfileFlags EmbeddedInFile=\"false\"");
1478 xml += line;
1479
1480 if (flags & icUseWithEmbeddedDataOnly)
1481 sprintf(line, " UseWithEmbeddedDataOnly=\"true\"");
1482 else
1483 sprintf(line, " UseWithEmbeddedDataOnly=\"false\"");
1484 xml += line;
1485
1486 if (flags & icExtendedRangePCS) {
1487 sprintf(line, " ExtendedRangePCS=\"true\"");
1488 xml += line;
1489 }
1490
1492
1493 if (bUsesMCS) {
1494 if (flags & icMCSNeedsSubsetTrue)
1495 sprintf(line, " MCSNeedsSubset=\"true\"");
1496 else
1497 sprintf(line, " MCSNeedsSubset=\"false\"");
1498 xml += line;
1499
1500 otherFlags &= ~icMCSNeedsSubsetTrue;
1501 }
1502
1503 if (flags & otherFlags) {
1504 sprintf(line, " VendorFlags=\"%08x\"", flags & otherFlags);
1505 xml += line;
1506 }
1507
1508 xml += "/>\n";
1509
1510 return xml;
1511}
1512
1513const std::string icGetPadSpace(double value)
1514{
1515 std::string space = "";
1516 if ( value >=0 && value < 10)
1517 space = " ";
1518 if ( value >=10 && value < 100)
1519 space = " ";
1520 if ( value >=100 && value < 1000 )
1521 space = " ";
1522
1523 return space;
1524}
1525
icUtfConversionResult icConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, icUtfConversionFlags flags)
icUtfConversionResult icConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, icUtfConversionFlags flags)
unsigned short UTF16
unsigned char UTF8
@ lenientConversion
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
char icChar
Definition IccDefs.h:109
#define stricmp
const icChar * szName
File: IccTagFactory.h.
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
Definition IccUtil.cpp:111
icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
icMeasurementGeometry icGeNamedtMeasurementGeometryValue(const icChar *str)
const char * icUtf8ToAnsi(std::string &buf, const char *szSrc)
const std::string icGetDeviceAttrName(icUInt64Number devAttr)
icUInt32Number icXmlNodeCount3(xmlNode *pNode, const char *szNodeName1, const char *szNodeName2, const char *szNodeName3)
icColorantEncoding icGetColorantValue(const icChar *str)
icUInt32Number icXmlNodeCount(xmlNode *pNode, const char *szNodeName)
icUInt32Number icXmlGetHexDataSize(const char *szText)
icDateTimeNumber icGetDateTimeValue(const icChar *str)
const char * icUtf16ToUtf8(std::string &buf, const icUInt16Number *szSrc, int sizeSrc)
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
icUInt32Number icXmlNodeCount2(xmlNode *pNode, const char *szNodeName1, const char *szNodeName2)
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
icUInt32Number icXmlGetHexData(void *pBuf, const char *szText, icUInt32Number nBufSize)
icTagTypeSignature icGetTypeNameTagSig(const icChar *szTagType)
const unsigned short * icUtf8ToUtf16(CIccUTF16String &buf, const char *szSrc, int sizeSrc)
icUInt32Number icXmlGetChildSigVal(xmlNode *pNode)
static bool icIsNumChar(char c)
icMeasurementFlare icGetNamedMeasurementFlareValue(const icChar *str)
const icChar * icGetStandardObserverName(icStandardObserver str)
const icChar * icGetTagSigTypeName(icTagTypeSignature tagTypeSig)
icUInt32Number icXmlDumpHexData(std::string &xml, std::string blanks, void *pBuf, icUInt32Number nBufSize)
const icChar * icGetTagSigName(icTagSignature tagTypeSig)
bool icCLUTDataToXml(std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks, bool bSaveGridPoints)
icTagSignature icGetTagNameSig(const icChar *szName)
icUInt64Number icGetDeviceAttrValue(xmlNode *pNode)
const std::string icGetHeaderFlagsName(icUInt32Number flags, bool bUsesMCS)
const std::string icGetPadSpace(double value)
const char * icFixXml(std::string &buf, const char *szStr)
icIlluminant icGetIlluminantValue(const icChar *str)
icMeasurementUnitSig icGetMeasurementValue(const icChar *str)
icStandardObserver icGetNamedStandardObserverValue(const icChar *str)
static int hexValue(char c)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
icRenderingIntent icGetRenderingIntentValue(const icChar *szRenderingIntent)
icFloatNumber icXmlStrToFloat(const xmlChar *szStr)
icSignature icXmlStrToSig(const char *szStr)
bool icCLUTToXml(std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks, bool bSaveGridPoints, const char *szExtraAttrs, const char *szName)
const char * icAnsiToUtf8(std::string &buf, const char *szSrc)
File: IccUtilXml.cpp.
#define icSigFloatArrayType
Definition IccUtilXml.h:173
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
const char * icUtf16ToUtf8(std::string &buf, const icUInt16Number *szSrc, int sizeSrc=0)
icConvertType
@ icConvert8Bit
@ icConvertFloat
@ icConvert16Bit
@ icConvertVariable
#define icXmlFloatFmt
icTagTypeSignature
@ icSigUInt16ArrayType
float nanf(const char *tagp)
unsigned int icUInt32Number
Class: CIccCLUT.
Definition IccTagLut.h:326
icUInt8Number GetInputDim() const
Definition IccTagLut.h:356
icUInt16Number GetOutputChannels() const
Definition IccTagLut.h:357
void Iterate(IIccCLUTExec *pExec)
Name: CIccCLUT::Iterate.
icUInt8Number GridPoint(int index) const
Definition IccTagLut.h:350
icUInt8Number GetPrecision()
Definition IccTagLut.h:381
icUInt32Number m_nCurPixel
CIccDumpXmlCLUT(std::string *xml, icConvertType nType, std::string blanks, icUInt16Number nSamples, icUInt8Number nPixelsPerRow)
icConvertType m_nType
icUInt16Number m_nSamples
icUInt8Number m_nPixelsPerRow
std::string * m_xml
std::string m_blanks
virtual void PixelOp(icFloatNumber *pGridAdr, icFloatNumber *pData)
static icTagTypeSignature GetTagTypeNameSig(const icChar *szName)
Function: GetTagTypeNameSig(szTypeName) Get signature based on display name of tag type.
static const icChar * GetTagSigName(icTagSignature tagTypeSig)
Function: GetTagSigName(tagSig) Get display name of tagSig.
static icTagSignature GetTagNameSig(const icChar *szName)
Function: GetTagNameSig(szTagName) Get signature from tag display name.
static const icChar * GetTagTypeSigName(icTagTypeSignature tagTypeSig)
Function: GetTagTypeSigName(tagTypeSig) Get display name of tagTypeSig.
static size_t AllocSize(size_t n)
Definition IccUtilXml.h:102
const char * ToUtf8(std::string &buf)
static size_t WStrlen(const icUInt16Number *uzStr)
bool FromUtf8(const char *szStr, size_t sizeSrc=0)
icUInt16Number * m_str
Definition IccUtilXml.h:105
virtual ~CIccUTF16String()
const icUInt16Number * c_str()
Definition IccUtilXml.h:93
CIccUTF16String & operator=(const CIccUTF16String &wstr)
bool Resize(size_t len)
const wchar_t * ToWString(std::wstring &buf)
icUInt32Number ParseText(T *pBuf, icUInt32Number nSize, const char *szText)
bool ParseTextArray(const char *szText)
bool SetSize(icUInt32Number nSize)
static bool ParseArray(T *buf, icUInt32Number nBufSize, xmlNode *pNode)
bool ParseTextArrayNum(const char *szText, icUInt32Number num, std::string &parseStr)
static bool DumpArray(std::string &xml, std::string blanks, T *buf, icUInt32Number nBufSize, icConvertType nType, icUInt8Number nColumns)
static icUInt32Number ParseTextCountNum(const char *szText, icUInt32Number num, std::string &parseStr)
static icUInt32Number ParseTextCount(const char *szText)
Interface Class: IIccCLUTExec.
Definition IccTagLut.h:285
unsigned char icUInt8Number
Number definitions.
unsigned short icUInt16Number
#define icMediaBlackAndWhite
icIlluminant
Pre-defined illuminants, used in measurement and viewing conditions type.
@ icIlluminantF6
@ icIlluminantF8
@ icIlluminantF1
@ icIlluminantEquiPowerE
@ icIlluminantF11
@ icIlluminantF7
@ icIlluminantF2
@ icIlluminantF4
@ icIlluminantF3
@ icIlluminantD55
@ icIlluminantDaylight
@ icIlluminantB
@ icIlluminantA
@ icIlluminantF9
@ icIlluminantBlackBody
@ icIlluminantUnknown
@ icIlluminantD65
@ icIlluminantF10
@ icIlluminantD93
@ icIlluminantD50
@ icIlluminantC
@ icIlluminantF5
@ icIlluminantF12
#define icTransparency
icMeasurementFlare
Other enums.
@ icFlare100
@ icFlare0
icColorantEncoding
Colorant and Phosphor Encodings used in chromaticity type.
@ icColorantEBU
@ icColorantUnknown
@ icColorantITU
@ icColorantSMPTE
@ icColorantP22
#define icStdObsCustom
#define icMatte
#define icMediaNegative
icUInt32Number icSignature
#define icEmbeddedProfileTrue
icMeasurementUnitSig
Measurement Unit Signatures used in ResponseCurveSet16Type.
@ icSigStatusI
@ icSigStatusE
@ icSigDNNP
@ icSigStatusA
@ icSigDN
@ icSigStatusT
@ icSigDNP
@ icSigDNN
@ icSigStatusM
@ icSigUInt8ArrayType
@ icSigFloat64ArrayType
@ icSigUInt64ArrayType
@ icSigFloat32ArrayType
@ icSigUInt32ArrayType
icUInt32Number icUInt64Number[2]
#define icMaxEnumFlare
Convenience Enum Definition - Not defined in ICC specification.
#define icUseWithEmbeddedDataOnly
icMeasurementGeometry
Measurement Geometry, used in the measurmentType tag.
@ icGeometry045or450
@ icGeometry0dord0
@ icGeometryUnknown
#define icMaxEnumGeometry
Convenience Enum Definition - Not defined in ICC specification.
icTagSignature
public tags and sizes
#define icExtendedRangePCS
icRenderingIntent
Rendering Intents, used in the profile header.
@ icPerceptual
@ icRelativeColorimetric
@ icAbsoluteColorimetric
@ icSaturation
#define icMCSNeedsSubsetTrue
#define icIlluminantCustom
icStandardObserver
Standard Observer, used in the measurmentType tag.
@ icStdObsUnknown
@ icStdObs1964TenDegrees
@ icStdObs1931TwoDegrees
The base date time number.
icUInt16Number year
icUInt16Number month
icUInt16Number minutes
icUInt16Number seconds
icUInt16Number hours
icUInt16Number day