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

Class: CIccTagChromaticity. More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagChromaticity:
+ Collaboration diagram for CIccTagChromaticity:

Public Member Functions

 CIccTagChromaticity (const CIccTagChromaticity &ITCh)
 Name: CIccTagChromaticity::CIccTagChromaticity.
 
 CIccTagChromaticity (int nSize=3)
 Name: CIccTagChromaticity::CIccTagChromaticity.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagChromaticity::Describe.
 
virtual const icCharGetClassName () const
 
icUInt32Number GetSize () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
icChromaticityNumberGetxy (icUInt32Number index)
 
virtual bool IsArrayType ()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagChromaticityoperator= (const CIccTagChromaticity &ChromTag)
 Name: CIccTagChromaticity::operator=.
 
icChromaticityNumberoperator[] (icUInt32Number index)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagChromaticity::Read.
 
bool SetSize (icUInt16Number nSize, bool bZeroNew=true)
 Name: CIccTagChromaticity::SetSize.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagChromaticity::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagChromaticity::Write.
 
virtual ~CIccTagChromaticity ()
 Name: CIccTagChromaticity::~CIccTagChromaticity.
 
- 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 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 Attributes

icUInt16Number m_nColorantType
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 

Protected Attributes

icUInt16Number m_nChannels
 
icChromaticityNumberm_xy
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 

Detailed Description

Class: CIccTagChromaticity.

Purpose: the chromaticity tag - xy chromaticity values for each channel

Definition at line 704 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagChromaticity() [1/2]

CIccTagChromaticity::CIccTagChromaticity ( int nSize = 3)

Name: CIccTagChromaticity::CIccTagChromaticity.

Purpose: Constructor

Args: nSize = number of xy entries

Definition at line 3753 of file IccTagBasic.cpp.

3754{
3755 m_nChannels = nSize;
3756 if (m_nChannels <3)
3757 m_nChannels = 3;
3758 m_xy = (icChromaticityNumber*)calloc(nSize, sizeof(icChromaticityNumber));
3759}
icUInt16Number m_nChannels
icChromaticityNumber * m_xy
xy Chromaticity Number

◆ CIccTagChromaticity() [2/2]

CIccTagChromaticity::CIccTagChromaticity ( const CIccTagChromaticity & ITCh)

Name: CIccTagChromaticity::CIccTagChromaticity.

Purpose: Copy Constructor

Args: ITCh = The CIccTagChromaticity object to be copied

Definition at line 3772 of file IccTagBasic.cpp.

3773{
3774 m_nChannels = ITCh.m_nChannels;
3775
3777 memcpy(m_xy, ITCh.m_xy, sizeof(icChromaticityNumber)*m_nChannels);
3778}

References m_nChannels, and m_xy.

◆ ~CIccTagChromaticity()

CIccTagChromaticity::~CIccTagChromaticity ( )
virtual

Name: CIccTagChromaticity::~CIccTagChromaticity.

Purpose: Destructor

Definition at line 3815 of file IccTagBasic.cpp.

3816{
3817 if (m_xy)
3818 free(m_xy);
3819}

Member Function Documentation

◆ Describe()

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

Name: CIccTagChromaticity::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 3932 of file IccTagBasic.cpp.

3933{
3934 icChar buf[128];
3935 CIccInfo Fmt;
3936
3938 //sDescription.reserve(sDescription.size() + m_nChannels*79);
3939 sprintf(buf, "Number of Channels : %u\n", m_nChannels);
3940 sDescription += buf;
3941
3942 sprintf(buf, "Colorant Encoding : %s\n", Fmt.GetColorantEncoding((icColorantEncoding)m_nColorantType));
3943 sDescription += buf;
3944
3945 for (i=0; i<m_nChannels; i++) {
3946 sprintf(buf, "value[%u]: x=%.3lf, y=%.3lf\n", i, icUFtoD(m_xy[i].x), icUFtoD(m_xy[i].y));
3947 sDescription += buf;
3948 }
3949
3950}
char icChar
Definition IccDefs.h:109
icFloatNumber icUFtoD(icU16Fixed16Number num)
Definition IccUtil.cpp:580
unsigned int icUInt32Number
Type: Class.
Definition IccUtil.h:303
const icChar * GetColorantEncoding(icColorantEncoding colorant)
Definition IccUtil.cpp:2317
icUInt16Number m_nColorantType
icColorantEncoding
Colorant and Phosphor Encodings used in chromaticity type.

References CIccInfo::GetColorantEncoding(), and icUFtoD().

+ Here is the call graph for this function:

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlChromaticity.

Definition at line 716 of file IccTagBasic.h.

716{ return "CIccTagChromaticity"; }

◆ GetSize()

icUInt32Number CIccTagChromaticity::GetSize ( ) const
inline

Definition at line 725 of file IccTagBasic.h.

725{ return m_nChannels; }

◆ GetType()

virtual icTagTypeSignature CIccTagChromaticity::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 715 of file IccTagBasic.h.

715{ return icSigChromaticityType; }
@ icSigChromaticityType

References icSigChromaticityType.

◆ Getxy()

icChromaticityNumber * CIccTagChromaticity::Getxy ( icUInt32Number index)
inline

Definition at line 724 of file IccTagBasic.h.

724{return &m_xy[index];}

◆ IsArrayType()

virtual bool CIccTagChromaticity::IsArrayType ( )
inlinevirtual

Reimplemented from CIccTag.

Definition at line 713 of file IccTagBasic.h.

713{ return m_nChannels > 1; }

◆ NewCopy()

virtual CIccTag * CIccTagChromaticity::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 710 of file IccTagBasic.h.

710{return new CIccTagChromaticity(*this);}
CIccTagChromaticity(int nSize=3)
Name: CIccTagChromaticity::CIccTagChromaticity.

◆ operator=()

CIccTagChromaticity & CIccTagChromaticity::operator= ( const CIccTagChromaticity & ChromTag)

Name: CIccTagChromaticity::operator=.

Purpose: Copy Operator

Args: ChromTag = The CIccTagChromaticity object to be copied

Definition at line 3791 of file IccTagBasic.cpp.

3792{
3793 if (&ChromTag == this)
3794 return *this;
3795
3796 m_nChannels = ChromTag.m_nChannels;
3797
3798 if (m_xy)
3799 free(m_xy);
3801 memcpy(m_xy, ChromTag.m_xy, sizeof(icChromaticityNumber)*m_nChannels);
3802
3803 return *this;
3804}

References m_nChannels, and m_xy.

◆ operator[]()

icChromaticityNumber & CIccTagChromaticity::operator[] ( icUInt32Number index)
inline

Definition at line 723 of file IccTagBasic.h.

723{return m_xy[index];}

◆ Read()

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

Name: CIccTagChromaticity::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 3836 of file IccTagBasic.cpp.

3837{
3839 icUInt16Number nChannels;
3840
3841 if (sizeof(icTagTypeSignature) +
3842 sizeof(icUInt32Number) +
3843 sizeof(icUInt32Number) +
3844 sizeof(icChromaticityNumber) > size)
3845 return false;
3846
3847 if (!pIO) {
3848 return false;
3849 }
3850
3851 if (!pIO->Read32(&sig))
3852 return false;
3853
3854 if (!pIO->Read32(&m_nReserved))
3855 return false;
3856
3857 if (!pIO->Read16(&nChannels) ||
3858 !pIO->Read16(&m_nColorantType))
3859 return false;
3860
3861 icUInt32Number nNum = (size-3*sizeof(icUInt32Number)) / sizeof(icChromaticityNumber);
3862 icUInt32Number nNum32 = (nNum*sizeof(icChromaticityNumber)) / sizeof(icU16Fixed16Number);
3863
3864 if (nNum < nChannels)
3865 return false;
3866
3867 // SetSize casts from icUInt32Number down to icUInt16Number. Check for overflow
3868 if (nNum > (icUInt16Number)nNum)
3869 return false;
3870
3871 if (!SetSize((icUInt16Number)nNum))
3872 return false;
3873
3874 if (pIO->Read32(&m_xy[0], nNum32) != (icInt32Number)nNum32 )
3875 return false;
3876
3877 return true;
3878}
icArraySignature sig
icTagTypeSignature
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: CIccTagChromaticity::SetSize.
icUInt32Number m_nReserved
unsigned short icUInt16Number
icUInt32Number icU16Fixed16Number
long icInt32Number

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

+ Here is the call graph for this function:

◆ SetSize()

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

Name: CIccTagChromaticity::SetSize.

Purpose: Sets the size of the xy chromaticity array.

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

Definition at line 3963 of file IccTagBasic.cpp.

3964{
3965 if (m_nChannels == nSize)
3966 return true;
3967
3969
3970 if (!m_xy) {
3971 m_nChannels = 0;
3972 return false;
3973 }
3974
3975 if (bZeroNew && nSize > m_nChannels) {
3976 memset(&m_xy[m_nChannels], 0, (nSize - m_nChannels)*sizeof(icChromaticityNumber));
3977 }
3978
3979 m_nChannels = nSize;
3980 return true;
3981}
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 CIccTagChromaticity::Validate ( std::string sigPath,
std::string & sReport,
const CIccProfile * pProfile = NULL ) const
virtual

Name: CIccTagChromaticity::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 3998 of file IccTagBasic.cpp.

3999{
4000 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
4001
4002 CIccInfo Info;
4003 std::string sSigPathName = Info.GetSigPathName(sigPath);
4004
4005 if (m_nColorantType) {
4006
4007 if (m_nChannels!=3) {
4008 sReport += icMsgValidateCriticalError;
4009 sReport += sSigPathName;
4010 sReport += " - Number of device channels must be three.\n";
4012 }
4013
4014 switch(m_nColorantType) {
4015 case icColorantITU:
4016 {
4017 if ( (m_xy[0].x != icDtoUF((icFloatNumber)0.640)) || (m_xy[0].y != icDtoUF((icFloatNumber)0.330)) ||
4018 (m_xy[1].x != icDtoUF((icFloatNumber)0.300)) || (m_xy[1].y != icDtoUF((icFloatNumber)0.600)) ||
4019 (m_xy[2].x != icDtoUF((icFloatNumber)0.150)) || (m_xy[2].y != icDtoUF((icFloatNumber)0.060)) ) {
4020 sReport += icMsgValidateNonCompliant;
4021 sReport += sSigPathName;
4022 sReport += " - Chromaticity data does not match specification.\n";
4024 }
4025 break;
4026 }
4027
4028 case icColorantSMPTE:
4029 {
4030 if ( (m_xy[0].x != icDtoUF((icFloatNumber)0.630)) || (m_xy[0].y != icDtoUF((icFloatNumber)0.340)) ||
4031 (m_xy[1].x != icDtoUF((icFloatNumber)0.310)) || (m_xy[1].y != icDtoUF((icFloatNumber)0.595)) ||
4032 (m_xy[2].x != icDtoUF((icFloatNumber)0.155)) || (m_xy[2].y != icDtoUF((icFloatNumber)0.070)) ) {
4033 sReport += icMsgValidateNonCompliant;
4034 sReport += sSigPathName;
4035 sReport += " - Chromaticity data does not match specification.\n";
4037 }
4038 break;
4039 }
4040
4041 case icColorantEBU:
4042 {
4043 if ( (m_xy[0].x != icDtoUF((icFloatNumber)0.64)) || (m_xy[0].y != icDtoUF((icFloatNumber)0.33)) ||
4044 (m_xy[1].x != icDtoUF((icFloatNumber)0.29)) || (m_xy[1].y != icDtoUF((icFloatNumber)0.60)) ||
4045 (m_xy[2].x != icDtoUF((icFloatNumber)0.15)) || (m_xy[2].y != icDtoUF((icFloatNumber)0.06)) ) {
4046 sReport += icMsgValidateNonCompliant;
4047 sReport += sSigPathName;
4048 sReport += " - Chromaticity data does not match specification.\n";
4050 }
4051 break;
4052 }
4053
4054 case icColorantP22:
4055 {
4056 if ( (m_xy[0].x != icDtoUF((icFloatNumber)0.625)) || (m_xy[0].y != icDtoUF((icFloatNumber)0.340)) ||
4057 (m_xy[1].x != icDtoUF((icFloatNumber)0.280)) || (m_xy[1].y != icDtoUF((icFloatNumber)0.605)) ||
4058 (m_xy[2].x != icDtoUF((icFloatNumber)0.155)) || (m_xy[2].y != icDtoUF((icFloatNumber)0.070)) ) {
4059 sReport += icMsgValidateNonCompliant;
4060 sReport += sSigPathName;
4061 sReport += " - Chromaticity data does not match specification.\n";
4063 }
4064 break;
4065 }
4066
4067 default:
4068 {
4069 sReport += icMsgValidateNonCompliant;
4070 sReport += sSigPathName;
4071 sReport += " - Invalid colorant type encoding.\n";
4073 }
4074 }
4075 }
4076
4077 return rv;
4078}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
icValidateStatus
Definition IccDefs.h:118
@ icValidateCriticalError
Definition IccDefs.h:122
@ icValidateNonCompliant
Definition IccDefs.h:121
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
icU16Fixed16Number icDtoUF(icFloatNumber num)
Definition IccUtil.cpp:566
const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
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.
@ icColorantEBU
@ icColorantITU
@ icColorantSMPTE
@ icColorantP22

References CIccInfo::GetSigPathName(), icColorantEBU, icColorantITU, icColorantP22, icColorantSMPTE, icDtoUF(), icMaxStatus(), icMsgValidateCriticalError, icMsgValidateNonCompliant, icValidateCriticalError, icValidateNonCompliant, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagChromaticity::Write ( CIccIO * pIO)
virtual

Name: CIccTagChromaticity::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 3894 of file IccTagBasic.cpp.

3895{
3897
3898 if (!pIO)
3899 return false;
3900
3901 if (!pIO->Write32(&sig))
3902 return false;
3903
3904 if (!pIO->Write32(&m_nReserved))
3905 return false;
3906
3907 if (!pIO->Write16(&m_nChannels))
3908 return false;
3909
3910 if (!pIO->Write16(&m_nColorantType))
3911 return false;
3912
3914
3915 if (pIO->Write32(&m_xy[0], nNum32) != (icInt32Number)nNum32)
3916 return false;
3917
3918 return true;
3919}
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(), and CIccIO::Write32().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nChannels

icUInt16Number CIccTagChromaticity::m_nChannels
protected

Definition at line 733 of file IccTagBasic.h.

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

◆ m_nColorantType

icUInt16Number CIccTagChromaticity::m_nColorantType

Definition at line 728 of file IccTagBasic.h.

◆ m_xy

icChromaticityNumber* CIccTagChromaticity::m_xy
protected

Definition at line 734 of file IccTagBasic.h.

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


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