Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CIccTagXmlColorantTable Class Reference

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlColorantTable:
+ Collaboration diagram for CIccTagXmlColorantTable:

Public Member Functions

virtual const char * GetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual ~CIccTagXmlColorantTable ()
 
- Public Member Functions inherited from CIccTagColorantTable
 CIccTagColorantTable (const CIccTagColorantTable &ITCT)
 Name: CIccTagColorantTable::CIccTagColorantTable.
 
 CIccTagColorantTable (int nsize=1)
 Name: CIccTagColorantTable::CIccTagColorantTable.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagColorantTable::Describe.
 
icColorantTableEntryGetEntry (icUInt32Number index)
 
icColorSpaceSignature GetPCS () const
 
icUInt32Number GetSize () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagColorantTableoperator= (const CIccTagColorantTable &ColorantTableTag)
 Name: CIccTagColorantTable::operator=.
 
icColorantTableEntryoperator[] (icUInt32Number index)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagColorantTable::Read.
 
void SetPCS (icColorSpaceSignature sig)
 
bool SetSize (icUInt16Number nSize, bool bZeroNew=true)
 Name: CIccTagColorantTable::SetSize.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagColorantTable::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagColorantTable::Write.
 
virtual ~CIccTagColorantTable ()
 Name: CIccTagColorantTable::~CIccTagColorantTable.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 
- Public Member Functions inherited from CIccTagXml
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual ~CIccTagXml (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 
- Protected Attributes inherited from CIccTagColorantTable
icUInt32Number m_nCount
 
icColorSpaceSignature m_PCS
 
icColorantTableEntrym_pData
 

Detailed Description

Definition at line 409 of file IccTagXml.h.

Constructor & Destructor Documentation

◆ ~CIccTagXmlColorantTable()

virtual CIccTagXmlColorantTable::~CIccTagXmlColorantTable ( )
inlinevirtual

Definition at line 412 of file IccTagXml.h.

412{}

Member Function Documentation

◆ GetClassName()

virtual const char * CIccTagXmlColorantTable::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTagColorantTable.

Definition at line 414 of file IccTagXml.h.

414{return "CIccTagXmlColorantTable"; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlColorantTable::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

Definition at line 416 of file IccTagXml.h.

416{return this; }

◆ ParseXml()

bool CIccTagXmlColorantTable::ParseXml ( xmlNode * pNode,
std::string & parseStr )
virtual

Implements CIccTagXml.

Definition at line 1834 of file IccTagXml.cpp.

1835{
1836 pNode = icXmlFindNode(pNode, "ColorantTable");
1837
1838 if (pNode && pNode->children) {
1839 pNode = pNode->children;
1840
1841 icUInt16Number n = (icUInt16Number)icXmlNodeCount(pNode, "Colorant");
1842
1843 if (n) {
1845 SetSize(n);
1846
1847 for (i=0; pNode; pNode=pNode->next) {
1848 if (pNode->type == XML_ELEMENT_NODE &&
1849 !icXmlStrCmp(pNode->name, "Colorant") &&
1850 i<n) {
1851 std::string str;
1852 const icChar *name = icXmlAttrValue(pNode, "Name");
1853 xmlAttr *L = icXmlFindAttr(pNode, "Channel1");
1854 xmlAttr *a = icXmlFindAttr(pNode, "Channel2");
1855 xmlAttr *b = icXmlFindAttr(pNode, "Channel3");
1856
1857 if (name && L && a && b) {
1858 strncpy(m_pData[i].name, icUtf8ToAnsi(str, name), sizeof(m_pData[i].name));
1859 m_pData[i].name[sizeof(m_pData[i].name)-1]=0;
1860
1861 icFloatNumber lab[3];
1862
1863 lab[0] = (icFloatNumber)atof(icXmlAttrValue(L));
1864 lab[1] = (icFloatNumber)atof(icXmlAttrValue(a));
1865 lab[2] = (icFloatNumber)atof(icXmlAttrValue(b));
1866
1867 icLabToPcs(lab);
1868 m_pData[i].data[0] = icFtoU16(lab[0]);
1869 m_pData[i].data[1] = icFtoU16(lab[1]);
1870 m_pData[i].data[2] = icFtoU16(lab[2]);
1871
1872 i++;
1873 }
1874 else
1875 return false;
1876 }
1877 }
1878 return i==n;
1879 }
1880 return false;
1881 }
1882 return false;
1883}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
char icChar
Definition IccDefs.h:109
void icLabToPcs(icFloatNumber *Lab)
Definition IccUtil.cpp:927
icUInt16Number icFtoU16(icFloatNumber num)
Definition IccUtil.cpp:745
const char * icUtf8ToAnsi(std::string &buf, const char *szSrc)
icUInt32Number icXmlNodeCount(xmlNode *pNode, const char *szNodeName)
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
unsigned int icUInt32Number
bool SetSize(icUInt16Number nSize, bool bZeroNew=true)
Name: CIccTagColorantTable::SetSize.
icColorantTableEntry * m_pData
unsigned short icUInt16Number
icInt8Number name[32]
icUInt16Number data[3]

References icFtoU16(), icLabToPcs(), icUtf8ToAnsi(), icXmlAttrValue(), icXmlFindAttr(), icXmlFindNode(), icXmlNodeCount(), and icXmlStrCmp.

+ Here is the call graph for this function:

◆ ToXml()

bool CIccTagXmlColorantTable::ToXml ( std::string & xml,
std::string blanks = "" )
virtual

Implements CIccTagXml.

Definition at line 1809 of file IccTagXml.cpp.

1810{
1811 char buf[256];
1812 char fix[256];
1813 int i;
1814 std::string str;
1815
1816 xml += blanks + "<ColorantTable>\n";
1817 for (i=0; i<(int)m_nCount; i++) {
1818 icFloatNumber lab[3];
1819 lab[0] = icU16toF(m_pData[i].data[0]);
1820 lab[1] = icU16toF(m_pData[i].data[1]);
1821 lab[2] = icU16toF(m_pData[i].data[2]);
1822 icLabFromPcs(lab);
1823 sprintf(buf, " <Colorant Name=\"%s\" Channel1=\"" icXmlFloatFmt "\" Channel2=\"" icXmlFloatFmt "\" Channel3=\"" icXmlFloatFmt "\"/>\n",
1824 icFixXml(fix, icAnsiToUtf8(str, m_pData[i].name)), lab[0], lab[1], lab[2]);
1825 xml += blanks + buf;
1826 }
1827 //xml += "\n";
1828 xml += blanks + "</ColorantTable>\n";
1829
1830 return true;
1831}
icFloatNumber icU16toF(icUInt16Number num)
Definition IccUtil.cpp:759
void icLabFromPcs(icFloatNumber *Lab)
Floating point encoding of Lab in PCS is in range 0.0 to 1.0.
Definition IccUtil.cpp:919
const char * icFixXml(std::string &buf, const char *szStr)
const char * icAnsiToUtf8(std::string &buf, const char *szSrc)
#define icXmlFloatFmt
icUInt32Number m_nCount

References icAnsiToUtf8(), icFixXml(), icLabFromPcs(), icU16toF(), and icXmlFloatFmt.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: