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

Class: CIccTagColorantTable. More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagColorantTable:
+ Collaboration diagram for CIccTagColorantTable:

Public Member Functions

 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.
 
virtual const icCharGetClassName () const
 
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 IIccExtensionTagGetExtension ()
 
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.
 

Protected Attributes

icUInt32Number m_nCount
 
icColorSpaceSignature m_PCS
 
icColorantTableEntrym_pData
 

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
 

Detailed Description

Class: CIccTagColorantTable.

Purpose: Colorant Table Tag

Definition at line 1386 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagColorantTable() [1/2]

CIccTagColorantTable::CIccTagColorantTable ( int nSize = 1)

Name: CIccTagColorantTable::CIccTagColorantTable.

Purpose: Constructor

Args: nSize = number of entries

Definition at line 8552 of file IccTagBasic.cpp.

8553{
8554 m_nCount = nSize;
8555 if (m_nCount<1)
8556 m_nCount = 1;
8557
8558 m_pData = (icColorantTableEntry*)calloc(nSize, sizeof(icColorantTableEntry));
8559}
icColorantTableEntry * m_pData
icUInt32Number m_nCount
ColorantTable Entry.

◆ CIccTagColorantTable() [2/2]

CIccTagColorantTable::CIccTagColorantTable ( const CIccTagColorantTable & ITCT)

Name: CIccTagColorantTable::CIccTagColorantTable.

Purpose: Copy Constructor

Args: ITCT = The CIccTagUnknown object to be copied

Definition at line 8572 of file IccTagBasic.cpp.

8573{
8574 m_PCS = ITCT.m_PCS;
8575 m_nCount = ITCT.m_nCount;
8576
8578 memcpy(m_pData, ITCT.m_pData, m_nCount*sizeof(icColorantTableEntry));
8579}
icColorSpaceSignature m_PCS

References m_nCount, m_PCS, and m_pData.

◆ ~CIccTagColorantTable()

CIccTagColorantTable::~CIccTagColorantTable ( )
virtual

Name: CIccTagColorantTable::~CIccTagColorantTable.

Purpose: Destructor

Definition at line 8617 of file IccTagBasic.cpp.

8618{
8619 if (m_pData)
8620 free(m_pData);
8621}

Member Function Documentation

◆ Describe()

void CIccTagColorantTable::Describe ( std::string & sDescription,
int nVerboseness )
virtual

Name: CIccTagColorantTable::Describe.

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

Definition at line 8738 of file IccTagBasic.cpp.

8739{
8740 icChar buf[128];
8741
8742 icUInt32Number i, nLen, nMaxLen=0;
8743 icFloatNumber Lab[3] = {0};
8744
8745 sprintf(buf, "BEGIN_COLORANTS %u\n", m_nCount);
8746 sDescription += buf;
8747
8748 for (i=0; i<m_nCount; i++) {
8749 nLen = (icUInt32Number)strlen(m_pData[i].name);
8750 if (nLen>nMaxLen)
8751 nMaxLen =nLen;
8752 }
8753 sDescription += "# NAME ";
8754
8755 if (m_PCS == icSigXYZData) {
8756 sprintf(buf, "XYZ_X XYZ_Y XYZ_Z\n");
8757 sDescription += buf;
8758 }
8759 else {
8760 sprintf(buf, "Lab_L Lab_a Lab_b\n");
8761 sDescription += buf;
8762 }
8763 for (i=0; i<m_nCount; i++) {
8764 sprintf(buf, "%2u \"%s\"", i, m_pData[i].name);
8765 sDescription += buf;
8766 memset(buf, ' ', 128);
8767 buf[nMaxLen + 1 - strlen(m_pData[i].name)] ='\0';
8768 sDescription += buf;
8769
8770 if (m_PCS == icSigXYZData) {
8771 sprintf(buf, "%7.4lf %7.4lf %7.4lf\n", icUSFtoD(m_pData[i].data[0]), icUSFtoD(m_pData[i].data[1]), icUSFtoD(m_pData[i].data[2]));
8772 sDescription += buf;
8773 }
8774 else {
8775 Lab[0] = icU16toF(m_pData[i].data[0]);
8776 Lab[1] = icU16toF(m_pData[i].data[1]);
8777 Lab[2] = icU16toF(m_pData[i].data[2]);
8778 icLabFromPcs(Lab);
8779 sprintf(buf, "%7.4lf %8.4lf %8.4lf\n", Lab[0], Lab[1], Lab[2]);
8780 sDescription += buf;
8781 }
8782 }
8783
8784}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
char icChar
Definition IccDefs.h:109
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
icFloatNumber icUSFtoD(icU1Fixed15Number num)
Definition IccUtil.cpp:601
unsigned int icUInt32Number
@ icSigXYZData

References icLabFromPcs(), icSigXYZData, icU16toF(), and icUSFtoD().

+ Here is the call graph for this function:

◆ GetClassName()

virtual const icChar * CIccTagColorantTable::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlColorantTable.

Definition at line 1396 of file IccTagBasic.h.

1396{ return "CIccTagColorantTable"; }

◆ GetEntry()

icColorantTableEntry * CIccTagColorantTable::GetEntry ( icUInt32Number index)
inline

Definition at line 1404 of file IccTagBasic.h.

1404{return &m_pData[index];}

◆ GetPCS()

icColorSpaceSignature CIccTagColorantTable::GetPCS ( ) const
inline

Definition at line 1409 of file IccTagBasic.h.

1409{return m_PCS;};

◆ GetSize()

icUInt32Number CIccTagColorantTable::GetSize ( ) const
inline

Definition at line 1405 of file IccTagBasic.h.

1405{ return m_nCount; }

◆ GetType()

virtual icTagTypeSignature CIccTagColorantTable::GetType ( ) const
inlinevirtual

Function: GetType()

Purpose: Get Tag Type. Each derived tag will implement it's own GetType() function.

Reimplemented from CIccTag.

Definition at line 1395 of file IccTagBasic.h.

1395{ return icSigColorantTableType; }
@ icSigColorantTableType

References icSigColorantTableType.

◆ NewCopy()

virtual CIccTag * CIccTagColorantTable::NewCopy ( ) const
inlinevirtual

Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.

Parameter(s): none

Returns a new CIccTag object that is a copy of this object.

Reimplemented from CIccTag.

Definition at line 1392 of file IccTagBasic.h.

1392{return new CIccTagColorantTable(*this);}
CIccTagColorantTable(int nsize=1)
Name: CIccTagColorantTable::CIccTagColorantTable.

◆ operator=()

CIccTagColorantTable & CIccTagColorantTable::operator= ( const CIccTagColorantTable & ColorantTableTag)

Name: CIccTagColorantTable::operator=.

Purpose: Copy Operator

Args: ColorantTableTag = The CIccTagColorantTable object to be copied

Definition at line 8592 of file IccTagBasic.cpp.

8593{
8594 if (&ColorantTableTag == this)
8595 return *this;
8596
8597 m_PCS = ColorantTableTag.m_PCS;
8598 m_nCount = ColorantTableTag.m_nCount;
8599
8600 if (m_pData)
8601 free(m_pData);
8603 memcpy(m_pData, ColorantTableTag.m_pData, m_nCount*sizeof(icColorantTableEntry));
8604
8605 return *this;
8606}

References m_nCount, m_PCS, and m_pData.

◆ operator[]()

icColorantTableEntry & CIccTagColorantTable::operator[] ( icUInt32Number index)
inline

Definition at line 1403 of file IccTagBasic.h.

1403{return m_pData[index];}

◆ Read()

bool CIccTagColorantTable::Read ( icUInt32Number size,
CIccIO * pIO )
virtual

Name: CIccTagColorantTable::Read.

Purpose: Read in the tag contents into a data block

Args: size - # of bytes in tag, pIO - IO object to read tag from

Return: true = successful, false = failure

Reimplemented from CIccTag.

Definition at line 8638 of file IccTagBasic.cpp.

8639{
8641 icUInt32Number nCount;
8642
8643 if (sizeof(icTagTypeSignature) +
8644 sizeof(icUInt32Number) +
8645 sizeof(icUInt32Number) +
8646 sizeof(icColorantTableEntry) > size)
8647 return false;
8648
8649 if (!pIO) {
8650 return false;
8651 }
8652
8653 if (!pIO->Read32(&sig))
8654 return false;
8655
8656 if (!pIO->Read32(&m_nReserved))
8657 return false;
8658
8659 if (!pIO->Read32(&nCount))
8660 return false;
8661
8662 icUInt32Number nNum = (size - 3*sizeof(icUInt32Number))/sizeof(icColorantTableEntry);
8663 icUInt32Number nNum8 = sizeof(m_pData->name);
8664 icUInt32Number nNum16 = sizeof(m_pData->data)/sizeof(icUInt16Number);
8665
8666 if (nNum < nCount || nCount > 0xffff)
8667 return false;
8668
8669 if (!SetSize((icUInt16Number)nCount))
8670 return false;
8671
8672 for (icUInt32Number i=0; i<nCount; i++) {
8673 if (pIO->Read8(&m_pData[i].name[0], nNum8) != (icInt32Number)nNum8)
8674 return false;
8675
8676 if (pIO->Read16(&m_pData[i].data[0], nNum16) != (icInt32Number)nNum16)
8677 return false;
8678 }
8679
8680 return true;
8681}
icArraySignature sig
icTagTypeSignature
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
bool SetSize(icUInt16Number nSize, bool bZeroNew=true)
Name: CIccTagColorantTable::SetSize.
icUInt32Number m_nReserved
unsigned short icUInt16Number
long icInt32Number
icInt8Number name[32]
icUInt16Number data[3]

References CIccIO::Read16(), CIccIO::Read32(), CIccIO::Read8(), and sig.

+ Here is the call graph for this function:

◆ SetPCS()

void CIccTagColorantTable::SetPCS ( icColorSpaceSignature sig)
inline

Definition at line 1408 of file IccTagBasic.h.

1408{m_PCS = sig;}

References sig.

◆ SetSize()

bool CIccTagColorantTable::SetSize ( icUInt16Number nSize,
bool bZeroNew = true )

Name: CIccTagColorantTable::SetSize.

Purpose: Sets the size of the data array.

Args: nSize - number of entries, bZeroNew - flag to zero newly formed values

Definition at line 8797 of file IccTagBasic.cpp.

8798{
8799 if (m_nCount == nSize)
8800 return true;
8801
8803
8804 if (!m_pData) {
8805 m_nCount = 0;
8806 return false;
8807 }
8808
8809 if (bZeroNew && nSize > m_nCount) {
8810 memset(&m_pData[m_nCount], 0, (nSize-m_nCount)*sizeof(icColorantTableEntry));
8811 }
8812 m_nCount = nSize;
8813
8814 return true;
8815}
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
Definition IccUtil.cpp:111

References icRealloc().

+ Here is the call graph for this function:

◆ Validate()

icValidateStatus CIccTagColorantTable::Validate ( std::string sigPath,
std::string & sReport,
const CIccProfile * pProfile = NULL ) const
virtual

Name: CIccTagColorantTable::Validate.

Purpose: Check tag data validity.

Args: sig = signature of tag being validated, sReport = String to add report information to

Return: icValidateStatusOK if valid, or other error status.

Reimplemented from CIccTag.

Definition at line 8832 of file IccTagBasic.cpp.

8833{
8834 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
8835
8836 CIccInfo Info;
8837 std::string sSigPathName = Info.GetSigPathName(sigPath);
8839
8840 if (!pProfile) {
8841 sReport += icMsgValidateWarning;
8842 sReport += sSigPathName;
8843 sReport += " - Tag validation incomplete: Pointer to profile unavailable.\n";
8845 return rv;
8846 }
8847
8848
8850 if (pProfile->m_Header.deviceClass!=icSigLinkClass) {
8851 sReport += icMsgValidateNonCompliant;
8852 sReport += sSigPathName;
8853 sReport += " - Use of this tag is allowed only in DeviceLink Profiles.\n";
8855 }
8856 if (m_nCount != icGetSpaceSamples(pProfile->m_Header.pcs)) {
8857 sReport += icMsgValidateNonCompliant;
8858 sReport += sSigPathName;
8859 sReport += " - Incorrect number of colorants.\n";
8861 }
8862 }
8863 else {
8864 if (m_nCount != icGetSpaceSamples(pProfile->m_Header.colorSpace)) {
8865 sReport += icMsgValidateNonCompliant;
8866 sReport += sSigPathName;
8867 sReport += " - Incorrect number of colorants.\n";
8869 }
8870 }
8871
8872 return rv;
8873}
icValidateStatus
Definition IccDefs.h:118
@ icValidateWarning
Definition IccDefs.h:120
@ icValidateNonCompliant
Definition IccDefs.h:121
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
const char * icMsgValidateWarning
Definition IccUtil.cpp:90
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
Type: Class.
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Function: Validate Each derived tag will implement it's own IsValid() function.
@ icSigLinkClass
icUInt32Number icSignature
@ icSigColorantTableOutTag

References CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icGetSpaceSamples(), icMaxStatus(), icMsgValidateNonCompliant, icMsgValidateWarning, icSigColorantTableOutTag, icSigLinkClass, icValidateNonCompliant, icValidateWarning, sig, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagColorantTable::Write ( CIccIO * pIO)
virtual

Name: CIccTagColorantTable::Write.

Purpose: Write the tag to a file

Args: pIO - The IO object to write tag to.

Return: true = succesful, false = failure

Reimplemented from CIccTag.

Definition at line 8697 of file IccTagBasic.cpp.

8698{
8700
8701 if (!pIO)
8702 return false;
8703
8704 if (!pIO->Write32(&sig))
8705 return false;
8706
8707 if (!pIO->Write32(&m_nReserved))
8708 return false;
8709
8710 if (!pIO->Write32(&m_nCount))
8711 return false;
8712
8713 icUInt32Number nNum8 = sizeof(m_pData->name);
8714 icUInt32Number nNum16 = sizeof(m_pData->data)/sizeof(icUInt16Number);
8715
8716 for (icUInt32Number i=0; i<m_nCount; i++) {
8717 if (pIO->Write8(&m_pData[i].name[0],nNum8) != (icInt32Number)nNum8)
8718 return false;
8719
8720 if (pIO->Write16(&m_pData[i].data[0],nNum16) != (icInt32Number)nNum16)
8721 return false;
8722 }
8723
8724 return true;
8725}
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
virtual icTagTypeSignature GetType() const
Function: GetType()

References sig, CIccIO::Write16(), CIccIO::Write32(), and CIccIO::Write8().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nCount

icUInt32Number CIccTagColorantTable::m_nCount
protected

Definition at line 1413 of file IccTagBasic.h.

Referenced by CIccTagColorantTable(), and operator=().

◆ m_PCS

icColorSpaceSignature CIccTagColorantTable::m_PCS
protected

Definition at line 1415 of file IccTagBasic.h.

Referenced by CIccTagColorantTable(), and operator=().

◆ m_pData

icColorantTableEntry* CIccTagColorantTable::m_pData
protected

Definition at line 1414 of file IccTagBasic.h.

Referenced by CIccTagColorantTable(), and operator=().


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