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

Class: CIccTagSpectralViewingConditions. More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagSpectralViewingConditions:
+ Collaboration diagram for CIccTagSpectralViewingConditions:

Public Member Functions

icFloatNumberapplyRangeToObserver (const icSpectralRange &newRange) const
 
 CIccTagSpectralViewingConditions ()
 Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions.
 
 CIccTagSpectralViewingConditions (const CIccTagSpectralViewingConditions &ITRCS)
 Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagSpectralViewingConditions::Describe.
 
virtual const icCharGetClassName () const
 
const icFloatNumbergetIlluminant (icSpectralRange &illumRange) const
 
icFloatNumber getIlluminantCCT () const
 
const icFloatNumbergetObserver (icSpectralRange &observerRange) const
 
CIccMatrixMathgetObserverMatrix (const icSpectralRange &newRange) const
 
icIlluminant getStdIllumiant () const
 
icStandardObserver getStdObserver () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagSpectralViewingConditionsoperator= (const CIccTagSpectralViewingConditions &RespCurveSet16Tag)
 Name: CIccTagSpectralViewingConditions::operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagSpectralViewingConditions::Read.
 
bool setIlluminant (icFloatNumber *pWhiteXYZ)
 
bool setIlluminant (icIlluminant illumId, const icSpectralRange &illumRange, const icFloatNumber *illum, icFloatNumber illumCCT=0.0f)
 
bool setObserver (icStandardObserver observerId, const icSpectralRange &observerRange, const icFloatNumber *observer)
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagSpectralViewingConditions::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagSpectralViewingConditions::Write.
 
virtual ~CIccTagSpectralViewingConditions ()
 Name: CIccTagSpectralViewingConditions::~CIccTagResponseCurveSet16.
 
- 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.
 

Public Attributes

icFloatXYZNumber m_illuminantXYZ
 
icUInt16Number m_reserved2
 
icUInt16Number m_reserved3
 
icFloatXYZNumber m_surroundXYZ
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 

Protected Attributes

icFloatNumber m_colorTemperature
 
icFloatNumberm_illuminant
 
icSpectralRange m_illuminantRange
 
icFloatNumberm_observer
 
icSpectralRange m_observerRange
 
icIlluminant m_stdIlluminant
 
icStandardObserver m_stdObserver
 

Additional Inherited Members

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

Detailed Description

Class: CIccTagSpectralViewingConditions.

Purpose: The responseCurveSet16 Tag type

Definition at line 1691 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagSpectralViewingConditions() [1/2]

CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions ( )

Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions.

Purpose: Constructor

Definition at line 10760 of file IccTagBasic.cpp.

10761{
10764 m_observerRange.end = 0;
10766 m_observer = NULL;
10767
10769 m_colorTemperature = 5000.0f;
10770
10774
10775 m_illuminant = 0;
10776
10777 m_illuminantXYZ.X = 0;
10778 m_illuminantXYZ.Y = 0;
10779 m_illuminantXYZ.Z = 0;
10780
10781 m_surroundXYZ.X = 0;
10782 m_surroundXYZ.Y = 0;
10783 m_surroundXYZ.Z = 0;
10784}
@ icIlluminantD50
@ icStdObs1931TwoDegrees
icFloat32Number Z
icFloat32Number Y
icFloat32Number X
icUInt16Number steps
icFloat16Number start
icFloat16Number end

References icIlluminantD50, and icStdObs1931TwoDegrees.

◆ CIccTagSpectralViewingConditions() [2/2]

CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions ( const CIccTagSpectralViewingConditions & SVCT)

Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions.

Purpose: Copy Constructor

Args: SVCT = The CIccTagSpectralViewingConditions object to be copied

Definition at line 10797 of file IccTagBasic.cpp.

10798{
10803
10804 if (SVCT.m_observer && SVCT.m_observerRange.steps) {
10806 if (m_observer) {
10807 memcpy(m_observer, SVCT.m_observer, SVCT.m_observerRange.steps*3*sizeof(icFloat32Number));
10808 }
10809 }
10810 else {
10811 m_observer = NULL;
10812 }
10813
10816
10820
10821 if (SVCT.m_illuminant && SVCT.m_illuminantRange.steps) {
10823 if (m_illuminant) {
10825 }
10826 }
10827 else {
10828 m_illuminant = NULL;
10829 }
10830
10831 m_illuminantXYZ.X = 0;
10832 m_illuminantXYZ.Y = 0;
10833 m_illuminantXYZ.Z = 0;
10834
10835 m_surroundXYZ.X = 0;
10836 m_surroundXYZ.Y = 0;
10837 m_surroundXYZ.Z = 0;
10838}
float icFloat32Number

References icSpectralRange::end, m_colorTemperature, m_illuminant, m_illuminantRange, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, icSpectralRange::start, and icSpectralRange::steps.

◆ ~CIccTagSpectralViewingConditions()

CIccTagSpectralViewingConditions::~CIccTagSpectralViewingConditions ( )
virtual

Name: CIccTagSpectralViewingConditions::~CIccTagResponseCurveSet16.

Purpose: Destructor

Definition at line 10905 of file IccTagBasic.cpp.

10906{
10907 if (m_observer)
10908 delete [] m_observer;
10909
10910 if (m_illuminant)
10911 delete [] m_illuminant;
10912}

Member Function Documentation

◆ applyRangeToObserver()

icFloatNumber * CIccTagSpectralViewingConditions::applyRangeToObserver ( const icSpectralRange & newRange) const

Definition at line 11238 of file IccTagBasic.cpp.

11239{
11240 int n = newRange.steps*3;
11241 icFloatNumber *rv = (icFloatNumber*)malloc(n*sizeof(icFloatNumber));
11242
11244 if (range) {
11245 range->VectorMult(rv, m_observer);
11246 range->VectorMult(&rv[newRange.steps], &m_observer[m_observerRange.steps]);
11247 range->VectorMult(&rv[newRange.steps*2], &m_observer[m_observerRange.steps*2]);
11248 delete range;
11249 }
11250 else {
11251 memcpy(rv, m_observer, m_observerRange.steps*3*sizeof(icFloatNumber));
11252 }
11253
11254 return rv;
11255}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
Type: Class.
static CIccMatrixMath * rangeMap(const icSpectralRange &from, const icSpectralRange &to)
Name: CIccMatrixMath::rangeMap.
virtual void VectorMult(icFloatNumber *pDst, const icFloatNumber *pSrc) const
Name: CIccMatrixMath::VectorMult.

References CIccMatrixMath::rangeMap(), icSpectralRange::steps, and CIccMatrixMath::VectorMult().

+ Here is the call graph for this function:

◆ Describe()

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

Name: CIccTagSpectralViewingConditions::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 11101 of file IccTagBasic.cpp.

11102{
11103 icChar buf[128];
11104 CIccInfo info;
11105
11106 sprintf(buf, "StdObserver: %s\n\n", info.GetStandardObserverName(m_stdObserver));
11107 sDescription += buf;
11108
11109 sprintf(buf, "Illuminant Tristimulus values: X = %.4lf, Y = %.4lf, Z = %.4lf\n\n",
11111 sDescription += buf;
11112
11113 if (m_observer) {
11114 sprintf(buf, "Observer Functions: start=%.1fnm end=%.1fnm, steps=%d\n",
11116 sDescription += buf;
11117
11118 if (nVerboseness > 75) {
11120 int i, j;
11121 for (j=0; j<3; j++) {
11122 for (i=0; i<m_observerRange.steps; i++) {
11123 sprintf(buf, " %.4f", *ptr);
11124 sDescription += buf;
11125 ptr++;
11126 }
11127 sDescription += "\n\n";
11128 }
11129 }
11130 }
11131 else {
11132 sDescription += "No custom Observer defined\n\n";
11133 }
11134
11135 sDescription += "StdIlluminant Type: ";
11136
11137 sDescription += info.GetIlluminantName(m_stdIlluminant);
11138 sDescription += "\n";
11139
11140 sprintf(buf, "Color Temperature: %.1fK\n\n", m_colorTemperature);
11141 sDescription += buf;
11142
11143 if (m_illuminant) {
11144 sprintf(buf, "Illuminant SPD: start=%.1fm end=%.1fnm, steps=%d\n",
11146 sDescription += buf;
11147 if (nVerboseness > 75) {
11149 int i;
11150 for (i=0; i<m_illuminantRange.steps; i++) {
11151 sprintf(buf, " %.4f", *ptr);
11152 sDescription += buf;
11153 ptr++;
11154 }
11155 }
11156 sDescription += "\n\n";
11157 }
11158 else {
11159 sDescription += "No custom Observer defined\n\n";
11160 }
11161
11162 sprintf(buf, "Surround Tristimulus values: X = %.4lf, Y = %.4lf, Z = %.4lf\n",
11164 sDescription += buf;
11165}
char icChar
Definition IccDefs.h:109
icFloatNumber icF16toF(icFloat16Number num)
Definition IccUtil.cpp:629
Type: Class.
Definition IccUtil.h:303
const icChar * GetIlluminantName(icIlluminant val)
Definition IccUtil.cpp:2169
const icChar * GetStandardObserverName(icStandardObserver val)
Definition IccUtil.cpp:2151

References CIccInfo::GetIlluminantName(), CIccInfo::GetStandardObserverName(), and icF16toF().

+ Here is the call graph for this function:

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlSpectralViewingConditions.

Definition at line 1701 of file IccTagBasic.h.

1701{ return "CIccTagSpectralViewingConditions"; }

◆ getIlluminant()

const icFloatNumber * CIccTagSpectralViewingConditions::getIlluminant ( icSpectralRange & illumRange) const

Definition at line 11342 of file IccTagBasic.cpp.

11343{
11345 for (int i = 0; i < NUM_KNOWN_ILLUM; i++) {
11346 if (m_stdIlluminant == icKnownIllums[i].illum) {
11347 illumRange = icKnownIllumObsRange;
11348 return &icKnownIllums[i].spd[0];
11349 }
11350 }
11351 }
11352
11353 illumRange = m_illuminantRange;
11354 return m_illuminant;
11355}
static icIllumDef icKnownIllums[]
#define NUM_KNOWN_ILLUM
static icSpectralRange icKnownIllumObsRange
icFloatNumber spd[81]

References icKnownIllumObsRange, icKnownIllums, NUM_KNOWN_ILLUM, and icIllumDef::spd.

Referenced by CIccMpeReflectanceCLUT::Begin(), CIccMpeReflectanceObserver::Begin(), CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(), IIccProfileConnectionConditions::getObserverIlluminantScaleFactor(), IIccProfileConnectionConditions::getReflectanceObserver(), and IIccProfileConnectionConditions::hasIlluminantSPD().

+ Here is the caller graph for this function:

◆ getIlluminantCCT()

icFloatNumber CIccTagSpectralViewingConditions::getIlluminantCCT ( ) const
inline

Definition at line 1713 of file IccTagBasic.h.

1713{ return m_colorTemperature; }

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(), and IIccProfileConnectionConditions::getPccCCT().

+ Here is the caller graph for this function:

◆ getObserver()

const icFloatNumber * CIccTagSpectralViewingConditions::getObserver ( icSpectralRange & observerRange) const

Definition at line 11506 of file IccTagBasic.cpp.

11507{
11508 if (!m_observer || !m_observerRange.steps) {
11509 for (int i = 0; i < NUM_KNOWN_OBSERVERS; i++) {
11510 if (m_stdObserver == icKnownObservers[i].obs) {
11511 observerRange = icKnownIllumObsRange;
11512 return &icKnownObservers[i].cmf[0];
11513 }
11514 }
11515 }
11516
11517 observerRange = m_observerRange;
11518 return m_observer;
11519}
#define NUM_KNOWN_OBSERVERS
static icObserverDef icKnownObservers[]
icFloatNumber cmf[81 *3]

References icObserverDef::cmf, icKnownIllumObsRange, icKnownObservers, and NUM_KNOWN_OBSERVERS.

Referenced by IIccProfileConnectionConditions::getEmissiveObserver(), IIccProfileConnectionConditions::getObserverIlluminantScaleFactor(), and IIccProfileConnectionConditions::getObserverWhiteScaleFactor().

+ Here is the caller graph for this function:

◆ getObserverMatrix()

CIccMatrixMath * CIccTagSpectralViewingConditions::getObserverMatrix ( const icSpectralRange & newRange) const

Definition at line 11257 of file IccTagBasic.cpp.

11258{
11259 CIccMatrixMath *pMtx=new CIccMatrixMath(3, newRange.steps);
11260
11261 CIccMatrixMath *range = CIccPcsXform::rangeMap(m_observerRange, newRange);
11262 if (range) {
11263 range->VectorMult(pMtx->entry(0), m_observer);
11264 range->VectorMult(pMtx->entry(1), &m_observer[m_observerRange.steps]);
11265 range->VectorMult(pMtx->entry(2), &m_observer[m_observerRange.steps*2]);
11266 delete range;
11267 }
11268 else {
11269 memcpy(pMtx->entry(0), m_observer, m_observerRange.steps*3*sizeof(icFloatNumber));
11270 }
11271
11272 return pMtx;
11273}
icFloatNumber * entry(icUInt16Number nRow, icUInt16Number nCol=0)

References CIccMatrixMath::entry(), icSpectralRange::steps, and CIccMatrixMath::VectorMult().

Referenced by IIccProfileConnectionConditions::getReflectanceObserver().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStdIllumiant()

icIlluminant CIccTagSpectralViewingConditions::getStdIllumiant ( ) const
inline

Definition at line 1712 of file IccTagBasic.h.

1712{ return m_stdIlluminant; }

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(), and IIccProfileConnectionConditions::getPccIlluminant().

+ Here is the caller graph for this function:

◆ getStdObserver()

icStandardObserver CIccTagSpectralViewingConditions::getStdObserver ( ) const
inline

Definition at line 1714 of file IccTagBasic.h.

1714{ return m_stdObserver; }

Referenced by IIccProfileConnectionConditions::getPccObserver().

+ Here is the caller graph for this function:

◆ GetType()

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

@ icSigSpectralViewingConditionsType

References icSigSpectralViewingConditionsType.

◆ NewCopy()

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

1697{return new CIccTagSpectralViewingConditions(*this);}
CIccTagSpectralViewingConditions()
Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions.

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions().

+ Here is the caller graph for this function:

◆ operator=()

CIccTagSpectralViewingConditions & CIccTagSpectralViewingConditions::operator= ( const CIccTagSpectralViewingConditions & SVCT)

Name: CIccTagSpectralViewingConditions::operator=.

Purpose: Copy Operator

Args: specViewCondTag = The CIccTagSpectralViewingConditions object to be copied

Definition at line 10851 of file IccTagBasic.cpp.

10852{
10857
10858 if (SVCT.m_observer && SVCT.m_observerRange.steps) {
10860 if (m_observer) {
10861 memcpy(m_observer, SVCT.m_observer, SVCT.m_observerRange.steps*3*sizeof(icFloat32Number));
10862 }
10863 }
10864 else {
10865 m_observer = NULL;
10866 }
10867
10870
10874
10875 if (SVCT.m_illuminant && SVCT.m_illuminantRange.steps) {
10877 if (m_illuminant) {
10879 }
10880 }
10881 else {
10882 m_illuminant = NULL;
10883 }
10884
10885 m_illuminantXYZ.X = 0;
10886 m_illuminantXYZ.Y = 0;
10887 m_illuminantXYZ.Z = 0;
10888
10889 m_surroundXYZ.X = 0;
10890 m_surroundXYZ.Y = 0;
10891 m_surroundXYZ.Z = 0;
10892
10893 return *this;
10894}

References icSpectralRange::end, m_colorTemperature, m_illuminant, m_illuminantRange, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, icSpectralRange::start, and icSpectralRange::steps.

◆ Read()

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

Name: CIccTagSpectralViewingConditions::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 10929 of file IccTagBasic.cpp.

10930{
10932
10933 //check size properly
10934 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
10935 sizeof(icUInt32Number)*4;
10936 if (headerSize > size)
10937 return false;
10938
10939 if (!pIO) {
10940 return false;
10941 }
10942
10943 if (!pIO->Read32(&sig) ||
10944 !pIO->Read32(&m_nReserved))
10945 return false;
10946
10947
10948 if (!pIO->Read32(&m_stdObserver) ||
10949 !pIO->Read16(&m_observerRange.start) ||
10950 !pIO->Read16(&m_observerRange.end) ||
10951 !pIO->Read16(&m_observerRange.steps) ||
10952 !pIO->Read16(&m_reserved2))
10953 return false;
10954
10955 icUInt32Number vals;
10956
10957 if (m_observer) {
10958 delete [] m_observer;
10959 m_observer = NULL;
10960 }
10961
10962 icUInt32Number observerSize = 0;
10963
10964 if (m_observerRange.steps) {
10965 vals = m_observerRange.steps * 3;
10966
10967 observerSize = vals * sizeof(icFloat32Number);
10968
10969 if (headerSize + observerSize > size)
10970 return false;
10971
10972 m_observer = new icFloat32Number[vals];
10973 if (!m_observer)
10974 return false;
10975
10976 if (pIO->ReadFloat32Float(&m_observer[0], vals) != vals)
10977 return false;
10978 }
10979
10980 icUInt32Number illumInfoSize = 2 * sizeof(icUInt32Number) + 4 * sizeof(icUInt16Number);
10981 if (headerSize + observerSize +illumInfoSize > size)
10982 return false;
10983
10984 if (!pIO->Read32(&m_stdIlluminant) ||
10986 !pIO->Read16(&m_illuminantRange.start) ||
10987 !pIO->Read16(&m_illuminantRange.end) ||
10988 !pIO->Read16(&m_illuminantRange.steps) ||
10989 !pIO->Read16(&m_reserved3))
10990 return false;
10991
10992
10993 if (m_illuminant) {
10994 delete [] m_illuminant;
10995 m_illuminant = NULL;
10996 }
10997
10998 icUInt32Number illuminantSize = 0;
10999
11001 vals = m_illuminantRange.steps;
11002
11003 illuminantSize = vals * sizeof(icFloat32Number);
11004
11005 if (headerSize + observerSize + illumInfoSize + illuminantSize > size)
11006 return false;
11007
11008 m_illuminant = new icFloat32Number[vals];
11009 if (!m_illuminant)
11010 return false;
11011
11012 if (pIO->ReadFloat32Float(&m_illuminant[0], vals) != vals)
11013 return false;
11014 }
11015 else {
11017 }
11018
11019 if (headerSize + observerSize + illumInfoSize + illuminantSize + 6*sizeof(icFloat32Number) > size)
11020 return false;
11021
11022 if (pIO->ReadFloat32Float(&m_illuminantXYZ, 3)!=3 ||
11023 pIO->ReadFloat32Float(&m_surroundXYZ, 3)!=3)
11024 return false;
11025
11026 return true;
11027}
icArraySignature sig
icTagTypeSignature
unsigned int icUInt32Number
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:302
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
bool setIlluminant(icIlluminant illumId, const icSpectralRange &illumRange, const icFloatNumber *illum, icFloatNumber illumCCT=0.0f)
unsigned short icUInt16Number

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

+ Here is the call graph for this function:

◆ setIlluminant() [1/2]

bool CIccTagSpectralViewingConditions::setIlluminant ( icFloatNumber * pWhiteXYZ)

Definition at line 11388 of file IccTagBasic.cpp.

11389{
11390 icSpectralRange zeroRange;
11391 memset(&zeroRange, 0, sizeof(zeroRange));
11392 icFloatNumber white[3] = {0};
11393 white[0] = pWhiteXYZ[0] / pWhiteXYZ[1];
11394 white[1] = 1.0;
11395 white[2] = pWhiteXYZ[2] / pWhiteXYZ[1];
11396
11397 if (!pWhiteXYZ || !icNotZero(pWhiteXYZ[1])) {
11398 setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11399 return false;
11400 }
11401
11403 if ((icIsNear(white[0], icD50XYZ[0]) && icIsNear(white[2], icD50XYZ[2])) ||
11404 (icIsNear(white[0], 0.9642f, 0.0001f) && icIsNear(white[2], 0.8251f, 0.0001f))) {
11405 return setIlluminant(icIlluminantD50, zeroRange, NULL, 5000);
11406 }
11407 else if (icIsNear(white[0], 0.9505f, 0.0001f) && icIsNear(white[2], 1.0888f, 0.0001f)) {
11408 return setIlluminant(icIlluminantD65, zeroRange, NULL, 6504);
11409 }
11410 }
11411// else if (m_stdObserver == icStdObs1964TenDegrees) {
11412// setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11413// return false;
11414// }
11415
11416 setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11417 return false;
11418}
icFloatNumber icD50XYZ[3]
Definition IccUtil.cpp:782
bool icIsNear(icFloatNumber v1, icFloatNumber v2, icFloatNumber nearRange)
Name: icIsNear.
Definition IccUtil.cpp:142
#define icNotZero(v)
Definition IccUtil.h:89
@ icIlluminantUnknown
@ icIlluminantD65
spectral range

References icD50XYZ, icIlluminantD50, icIlluminantD65, icIlluminantUnknown, icIsNear(), icNotZero, and icStdObs1931TwoDegrees.

+ Here is the call graph for this function:

◆ setIlluminant() [2/2]

bool CIccTagSpectralViewingConditions::setIlluminant ( icIlluminant illumId,
const icSpectralRange & illumRange,
const icFloatNumber * illum,
icFloatNumber illumCCT = 0.0f )

Definition at line 11357 of file IccTagBasic.cpp.

11358{
11359 m_stdIlluminant = illumId;
11360 m_colorTemperature = illumCCT;
11361
11362 if (m_illuminant) {
11363 free(m_illuminant);
11364 }
11365
11366 m_illuminantRange = illumRange;
11367
11368 if (illumRange.steps && illum) {
11369 icUInt32Number size = illumRange.steps * sizeof(icFloatNumber);
11370 m_illuminant = (icFloatNumber *)malloc(size);
11371 if (m_illuminant)
11372 memcpy(m_illuminant, illum, size);
11373 else {
11374 memset(&m_illuminantRange, 0, sizeof(m_illuminantRange));
11375 return false;
11376 }
11377 }
11378 else {
11379 if (!illum)
11380 memset(&m_illuminantRange, 0, sizeof(m_illuminantRange));
11381
11382 m_illuminant = NULL;
11383 }
11384
11385 return true;
11386}

References icSpectralRange::steps.

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(), and CIccDefaultEncProfileConverter::ConvertFromParams().

+ Here is the caller graph for this function:

◆ setObserver()

bool CIccTagSpectralViewingConditions::setObserver ( icStandardObserver observerId,
const icSpectralRange & observerRange,
const icFloatNumber * observer )

Definition at line 11521 of file IccTagBasic.cpp.

11522{
11523 m_stdObserver = observerId;
11524 m_observerRange = observerRange;
11525 if (m_observer) {
11526 free(m_observer);
11527 }
11528
11529 if (observerRange.steps && observer) {
11530 icUInt32Number size = observerRange.steps * sizeof(icFloatNumber) * 3;
11531 m_observer = (icFloatNumber *)malloc(size);
11532 if (m_observer)
11533 memcpy(m_observer, observer, size);
11534 else {
11535 memset(&m_observerRange, 0, sizeof(m_observerRange));
11536 return false;
11537 }
11538 }
11539 else {
11540 if (!observer)
11541 memset(&m_observerRange, 0, sizeof(m_illuminantRange));
11542
11543 m_observer = NULL;
11544 }
11545
11546 return true;
11547}

References icSpectralRange::steps.

◆ Validate()

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

Name: CIccTagSpectralViewingConditions::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 11183 of file IccTagBasic.cpp.

11184{
11185 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
11186
11187 CIccInfo Info;
11188 std::string sSigPathName = Info.GetSigPathName(sigPath);
11189
11190 rv = icMaxStatus(rv, Info.CheckData(sReport, m_illuminantXYZ, sSigPathName + ":>illuminantXYZ"));
11191 rv = icMaxStatus(rv, Info.CheckData(sReport, m_surroundXYZ, sSigPathName + ":>surroundXYZ"));
11192
11193 rv = icMaxStatus(rv, Info.CheckLuminance(sReport, m_illuminantXYZ, sSigPathName + ":>illuminantXYZ"));
11194 rv = icMaxStatus(rv, Info.CheckLuminance(sReport, m_surroundXYZ, sSigPathName + ":>surroundXYZ"));
11195
11196 icSpectralRange range;
11197
11198 if (getObserver(range)) {
11199 rv = icMaxStatus(rv, Info.CheckData(sReport, range, sSigPathName + ":>observerRange"));
11200
11201 if (!m_observer && pProfile && pProfile->m_Header.version < icVersionNumberV5_1) {
11202 sReport += icMsgValidateNonCompliant;
11203 sReport += sSigPathName;
11204 sReport += " - Missing Observer CMF not supported by profile version!\r\n";
11206 }
11207 }
11208 else {
11209 rv = icMaxStatus(rv, Info.CheckData(sReport, m_observerRange, sSigPathName + ":>observerRange"));
11210
11211 sReport += icMsgValidateCriticalError;
11212 sReport += sSigPathName;
11213 sReport += " - Missing Observer CMF!\r\n";
11215 }
11216
11217 if (getIlluminant(range)) {
11218 rv = icMaxStatus(rv, Info.CheckData(sReport, range, sSigPathName + ":>illuminantRange"));
11219
11220 if (!m_illuminant && pProfile && pProfile->m_Header.version < icVersionNumberV5_1) {
11221 sReport += icMsgValidateNonCompliant;
11222 sReport += sSigPathName;
11223 sReport += " - Missing illuminant SPD not supported by profile version!\r\n";
11225 }
11226 }
11227 else {
11228 rv = icMaxStatus(rv, Info.CheckData(sReport, m_illuminantRange, sSigPathName + ":>illuminantRange"));
11229 sReport += icMsgValidateCriticalError;
11230 sReport += sSigPathName;
11231 sReport += " - Missing Illuminant SPD!\r\n";
11233 }
11234
11235 return rv;
11236}
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
const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
icValidateStatus CheckLuminance(std::string &sReport, const icFloatXYZNumber &XYZ, std::string sDesc="")
Definition IccUtil.cpp:2516
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
icValidateStatus CheckData(std::string &sReport, const icDateTimeNumber &dateTime, std::string sDesc="")
Definition IccUtil.cpp:2414
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.
const icFloatNumber * getObserver(icSpectralRange &observerRange) const
const icFloatNumber * getIlluminant(icSpectralRange &illumRange) const
#define icVersionNumberV5_1

References CIccInfo::CheckData(), CIccInfo::CheckLuminance(), CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateCriticalError, icMsgValidateNonCompliant, icValidateCriticalError, icValidateNonCompliant, icVersionNumberV5_1, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagSpectralViewingConditions::Write ( CIccIO * pIO)
virtual

Name: CIccTagSpectralViewingConditions::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 11043 of file IccTagBasic.cpp.

11044{
11046
11047 if (!pIO) {
11048 return false;
11049 }
11050
11051 if (!pIO->Write32(&sig) ||
11052 !pIO->Write32(&m_nReserved))
11053 return false;
11054
11055
11056 if (!pIO->Write32(&m_stdObserver) ||
11057 !pIO->Write16(&m_observerRange.start) ||
11058 !pIO->Write16(&m_observerRange.end) ||
11059 !pIO->Write16(&m_observerRange.steps) ||
11060 !pIO->Write16(&m_reserved2))
11061 return false;
11062
11064
11065 if (vals)
11066 if (pIO->WriteFloat32Float(&m_observer[0], vals) != vals)
11067 return false;
11068
11069 if (!pIO->Write32(&m_stdIlluminant) ||
11072 !pIO->Write16(&m_illuminantRange.end) ||
11074 !pIO->Write16(&m_reserved3))
11075 return false;
11076
11077 vals = m_illuminantRange.steps;
11078
11079 if (vals)
11080 if (pIO->WriteFloat32Float(&m_illuminant[0], vals) != vals)
11081 return false;
11082
11083 if (pIO->WriteFloat32Float(&m_illuminantXYZ, 3)!=3 ||
11084 pIO->WriteFloat32Float(&m_surroundXYZ, 3)!=3)
11085 return false;
11086
11087 return true;
11088}
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number WriteFloat32Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:321
virtual icTagTypeSignature GetType() const
Function: GetType()

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

+ Here is the call graph for this function:

Member Data Documentation

◆ m_colorTemperature

icFloatNumber CIccTagSpectralViewingConditions::m_colorTemperature
protected

Definition at line 1736 of file IccTagBasic.h.

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

◆ m_illuminant

icFloatNumber* CIccTagSpectralViewingConditions::m_illuminant
protected

Definition at line 1739 of file IccTagBasic.h.

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

◆ m_illuminantRange

icSpectralRange CIccTagSpectralViewingConditions::m_illuminantRange
protected

Definition at line 1738 of file IccTagBasic.h.

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

◆ m_illuminantXYZ

icFloatXYZNumber CIccTagSpectralViewingConditions::m_illuminantXYZ

◆ m_observer

icFloatNumber* CIccTagSpectralViewingConditions::m_observer
protected

Definition at line 1733 of file IccTagBasic.h.

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

◆ m_observerRange

icSpectralRange CIccTagSpectralViewingConditions::m_observerRange
protected

Definition at line 1732 of file IccTagBasic.h.

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

◆ m_reserved2

icUInt16Number CIccTagSpectralViewingConditions::m_reserved2

Definition at line 1726 of file IccTagBasic.h.

◆ m_reserved3

icUInt16Number CIccTagSpectralViewingConditions::m_reserved3

Definition at line 1727 of file IccTagBasic.h.

◆ m_stdIlluminant

icIlluminant CIccTagSpectralViewingConditions::m_stdIlluminant
protected

Definition at line 1735 of file IccTagBasic.h.

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

◆ m_stdObserver

icStandardObserver CIccTagSpectralViewingConditions::m_stdObserver
protected

Definition at line 1730 of file IccTagBasic.h.

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

◆ m_surroundXYZ

icFloatXYZNumber CIccTagSpectralViewingConditions::m_surroundXYZ

Definition at line 1724 of file IccTagBasic.h.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().


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