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

#include <IccMpeXml.h>

+ Inheritance diagram for CIccMpeXmlToneMap:
+ Collaboration diagram for CIccMpeXmlToneMap:

Public Member Functions

virtual const char * GetClassName () const
 
virtual IIccExtensionMpeGetExtension ()
 
virtual CIccToneMapFuncNewToneMapFunc ()
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual ~CIccMpeXmlToneMap ()
 
- Public Member Functions inherited from CIccMpeToneMap
virtual void Apply (CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
 Name: CIccMpeToneMap::Apply.
 
virtual bool Begin (icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
 Name: CIccMpeToneMap::Begin.
 
 CIccMpeToneMap (const CIccMpeToneMap &toneMap)
 Name: CIccMpeToneMap::CIccMpeToneMap.
 
 CIccMpeToneMap (icUInt16Number nOutputChannels=1)
 Name: CIccMpeToneMap::CIccMpeToneMap.
 
virtual void Describe (std::string &sDescription, int nVerboseness=0)
 Name: CIccMpeToneMap::Describe.
 
virtual icElemTypeSignature GetType () const
 
bool Insert (CIccToneMapFunc *pToneMapFunc)
 Name: CIccMpeToneMap::PushBackFunc.
 
virtual CIccMultiProcessElementNewCopy () const
 
CIccMpeToneMapoperator= (const CIccMpeToneMap &toneMap)
 Name: &CIccMpeToneMap::operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccMpeToneMap::Read.
 
void SetLumCurve (CIccCurveSetCurve *pLumCurve)
 Name: CIccMpeToneMap::SetLumCurve.
 
void SetNumOutputChannels (icUInt16Number nOutputChannels)
 Name: CIccMpeToneMap::SetNumOutputChannels.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
 Name: CIccMpeToneMap::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccMpeToneMap::Write.
 
virtual ~CIccMpeToneMap ()
 Name: CIccMpeToneMap::~CIccMpeToneMap.
 
- Public Member Functions inherited from CIccMultiProcessElement
 CIccMultiProcessElement ()
 
virtual icAcsSignature GetBAcsSig ()
 
virtual icAcsSignature GetEAcsSig ()
 
virtual CIccApplyMpeGetNewApply (CIccApplyTagMpe *pApplyTag)
 Name: CIccMultiProcessElement::GetNewApply()
 
virtual bool IsAcs ()
 
virtual bool IsLateBinding () const
 
virtual bool IsLateBindingReflectance () const
 
virtual bool IsSupported ()
 
virtual icUInt16Number NumInputChannels () const
 
virtual icUInt16Number NumOutputChannels () const
 
virtual ~CIccMultiProcessElement ()
 
- Public Member Functions inherited from CIccMpeXml
virtual const char * GetExtClassName ()
 
virtual ~CIccMpeXml (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccMultiProcessElement
static CIccMultiProcessElementCreate (icElemTypeSignature sig)
 Name: CIccMultiProcessElement::Create.
 
- Public Attributes inherited from CIccMultiProcessElement
icUInt32Number m_nReserved
 
- Protected Member Functions inherited from CIccMpeToneMap
void ClearToneFuncs ()
 Name: CIccMpeToneMap::ClearToneFuncs.
 
CIccToneMapFunc ** CopyToneFuncs () const
 Name: CIccMpeToneMap::CopyToneFuncs.
 
- Protected Attributes inherited from CIccMpeToneMap
icUInt16Number m_nFunc
 
CIccCurveSetCurvem_pLumCurve
 
CIccToneMapFunc ** m_pToneFuncs
 
- Protected Attributes inherited from CIccMultiProcessElement
icUInt16Number m_nInputChannels
 
icUInt16Number m_nOutputChannels
 

Detailed Description

Definition at line 151 of file IccMpeXml.h.

Constructor & Destructor Documentation

◆ ~CIccMpeXmlToneMap()

virtual CIccMpeXmlToneMap::~CIccMpeXmlToneMap ( )
inlinevirtual

Definition at line 154 of file IccMpeXml.h.

154{}

Member Function Documentation

◆ GetClassName()

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

Reimplemented from CIccMpeToneMap.

Definition at line 156 of file IccMpeXml.h.

156{ return "CIccMpeXmlToneMap"; }

◆ GetExtension()

virtual IIccExtensionMpe * CIccMpeXmlToneMap::GetExtension ( )
inlinevirtual

Reimplemented from CIccMultiProcessElement.

Definition at line 160 of file IccMpeXml.h.

160{ return this; }

◆ NewToneMapFunc()

virtual CIccToneMapFunc * CIccMpeXmlToneMap::NewToneMapFunc ( )
inlinevirtual

Reimplemented from CIccMpeToneMap.

Definition at line 158 of file IccMpeXml.h.

158{ return new CIccXmlToneMapFunc(); }

◆ ParseXml()

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

Implements CIccMpeXml.

Definition at line 1777 of file IccMpeXml.cpp.

1778{
1779 icUInt16Number nInputChannels = atoi(icXmlAttrValue(pNode, "InputChannels"));
1780 icUInt16Number nOutputChannels = atoi(icXmlAttrValue(pNode, "OutputChannels"));
1781 if (!nInputChannels || !nOutputChannels || nInputChannels!=nOutputChannels+1) {
1782 parseStr += "Invalid InputChannels or OutputChannels In ToneMapElement\n";
1783 return false;
1784 }
1785 m_nInputChannels = nInputChannels;
1786
1787 SetNumOutputChannels(nOutputChannels);
1788
1789 if (!m_pToneFuncs) {
1790 parseStr += "Unable to allocate ToneMapFunctions\n";
1791 return false;
1792 }
1793
1794 xmlNode* pSubNode = icXmlFindNode(pNode->children, "LuminanceCurve");
1795
1796 if (pSubNode) {
1797 xmlNode* pNode;
1798 for (pNode = pSubNode->children; pNode && pNode->type != XML_ELEMENT_NODE; pNode = pNode->next);
1799 m_pLumCurve = ParseXmlCurve(pNode, parseStr);
1800 if (!m_pLumCurve) {
1801 parseStr += "Unable to parse Luminance Curve\n";
1802 return false;
1803 }
1804 }
1805 else {
1806 parseStr += "Missing Luminance Curve";
1807 }
1808
1809 pSubNode = icXmlFindNode(pNode->children, "ToneMapFunctions");
1810
1811 if (pSubNode) {
1812 xmlNode* pNode;
1813 int nIndex = 0;
1814 for (pNode = pSubNode->children, nIndex = 0;
1815 pNode;
1816 pNode = pNode->next) {
1817 if (pNode->type == XML_ELEMENT_NODE) {
1818 if (nIndex >= nOutputChannels) {
1819 parseStr += "Too many ToneFunctions";
1820 return false;
1821 }
1822 else if (!strcmp((const char*)pNode->name, "DuplicateFunction")) {
1823 const char* attr = icXmlAttrValue(pNode, "Index", NULL);
1824
1825 if (attr) {
1826 int nCopyIndex = atoi(attr);
1827 if (nCopyIndex >= 0 && nCopyIndex < nIndex) {
1828 m_pToneFuncs[nIndex] = m_pToneFuncs[nCopyIndex];
1829 nIndex++;
1830 }
1831 else {
1832 parseStr += "Invalid index for duplicate ToneMapFunction\n";
1833 return false;
1834 }
1835 }
1836 else {
1837 parseStr += "Missing index for duplicate ToneMapFunction\n";
1838 return false;
1839 }
1840 }
1841 else if (!strcmp((const char*)pNode->name, "ToneMapFunction")) {
1843
1844 if (!pFunc->ParseXml(pNode, parseStr)) {
1845 delete pFunc;
1846 return false;
1847 }
1848 if (!Insert(pFunc))
1849 return false;
1850 nIndex++;
1851 }
1852 else {
1853 parseStr += std::string("Unknown Tone Map Function '") + (const char*)pNode->name + "'\n";
1854 return false;
1855 }
1856 }
1857 }
1858 if (nIndex < m_nOutputChannels) {
1859 parseStr += "Missing ToneMap Functions\n";
1860 }
1861 }
1862
1863 return true;
1864}
static icCurveSetCurvePtr ParseXmlCurve(xmlNode *pNode, std::string parseStr)
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
CIccToneMapFunc ** m_pToneFuncs
void SetNumOutputChannels(icUInt16Number nOutputChannels)
Name: CIccMpeToneMap::SetNumOutputChannels.
bool Insert(CIccToneMapFunc *pToneMapFunc)
Name: CIccMpeToneMap::PushBackFunc.
CIccCurveSetCurve * m_pLumCurve
icUInt16Number m_nOutputChannels
Definition IccTagMPE.h:192
icUInt16Number m_nInputChannels
Definition IccTagMPE.h:191
virtual bool ParseXml(xmlNode *pNode, std::string &parseStr)
unsigned short icUInt16Number

References icXmlAttrValue(), icXmlFindNode(), CIccXmlToneMapFunc::ParseXml(), and ParseXmlCurve().

+ Here is the call graph for this function:

◆ ToXml()

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

Implements CIccMpeXml.

Definition at line 1724 of file IccMpeXml.cpp.

1725{
1726 char buf[128], line[128];
1727 sprintf(buf, "<ToneMapElement InputChannels=\"%d\" OutputChannels=\"%d\"", NumInputChannels(), NumOutputChannels());
1728 xml += blanks + buf;
1729
1730 if (m_nReserved) {
1731 sprintf(buf, " Reserved=\"%u\"", m_nReserved);
1732 xml += buf;
1733 }
1734 xml += ">\n";
1735
1736 if (m_pLumCurve) {
1737 xml += blanks + " <LuminanceCurve>\n";
1738 if (!ToXmlCurve(xml, blanks + " ", m_pLumCurve))
1739 return false;
1740 xml += blanks + " </LuminanceCurve>\n";
1741 }
1742
1743 if (m_pToneFuncs) {
1744 xml += blanks + " <ToneMapFunctions>\n";
1745 int i, j;
1746 for (i = 0; i < NumOutputChannels(); i++) {
1747 if (m_pToneFuncs[i] && !strcmp(m_pToneFuncs[i]->GetClassName(), "CIccXmlToneMapFunc")) {
1749
1750 //check for duplicate curves
1751 for (j = 0; j < i; j++) {
1752 if (m_pToneFuncs[i] == m_pToneFuncs[j])
1753 break;
1754 }
1755
1756 //handle case of duplicate curve
1757 if (j < i) {
1758 sprintf(line, "<DuplicateFunction Index=\"%d\"/>\n", j);
1759 xml += blanks + " ";
1760 xml += line;
1761 }
1762 else if (!pFunc->ToXml(xml, blanks + " "))
1763 return false;
1764 }
1765 else
1766 return false;
1767 }
1768 xml += blanks + " </ToneMapFunctions>\n";
1769 }
1770
1771 xml += blanks + "</ToneMapElement>\n";
1772
1773 return true;
1774}
static bool ToXmlCurve(std::string &xml, std::string blanks, icCurveSetCurvePtr pCurve)
virtual const char * GetClassName() const
Definition IccMpeXml.h:156
virtual icUInt16Number NumInputChannels() const
Definition IccTagMPE.h:159
virtual icUInt16Number NumOutputChannels() const
Definition IccTagMPE.h:160
icUInt32Number m_nReserved
Definition IccTagMPE.h:188
virtual bool ToXml(std::string &xml, std::string blanks="")

References CIccXmlToneMapFunc::ToXml(), and ToXmlCurve().

+ Here is the call graph for this function:

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