IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccTagSpectralViewingConditions Class Reference

#include <IccTagBasic.h>

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

Public Member Functions

 CIccTagSpectralViewingConditions ()
 
 CIccTagSpectralViewingConditions (const CIccTagSpectralViewingConditions &ITRCS)
 
virtual ~CIccTagSpectralViewingConditions ()
 
icFloatNumberapplyRangeToObserver (const icSpectralRange &newRange) const
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
virtual const icCharGetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
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 icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
virtual CIccTagNewCopy () const
 
CIccTagSpectralViewingConditionsoperator= (const CIccTagSpectralViewingConditions &RespCurveSet16Tag)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
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
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccTagCreate (icTagTypeSignature sig)
 

Data Fields

icFloatXYZNumber m_illuminantXYZ
 
icUInt32Number m_nReserved
 
icUInt16Number m_reserved2
 
icUInt16Number m_reserved3
 
icFloatXYZNumber m_surroundXYZ
 

Protected Attributes

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

Detailed Description

Class: CIccTagSpectralViewingConditions

Purpose: The responseCurveSet16 Tag type

Constructor & Destructor Documentation

◆ CIccTagSpectralViewingConditions() [1/2]

CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions ( )

Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions

Purpose: Constructor

10824{
10827 m_observerRange.end = 0;
10829 m_observer = NULL;
10830
10832 m_colorTemperature = 5000.0f;
10833
10837
10838 m_illuminant = 0;
10839
10840 m_illuminantXYZ.X = 0;
10841 m_illuminantXYZ.Y = 0;
10842 m_illuminantXYZ.Z = 0;
10843
10844 m_surroundXYZ.X = 0;
10845 m_surroundXYZ.Y = 0;
10846 m_surroundXYZ.Z = 0;
10847}
@ icIlluminantD50
Definition icProfileHeader.h:1192
icUInt16Number steps
Definition icProfileHeader.h:1469
icFloat32Number Z
Definition icProfileHeader.h:1443
icFloat16Number start
Definition icProfileHeader.h:1467
icFloat16Number end
Definition icProfileHeader.h:1468
icFloat32Number Y
Definition icProfileHeader.h:1442
icFloat32Number X
Definition icProfileHeader.h:1441
@ icStdObs1931TwoDegrees
Definition icProfileHeader.h:1177
icStandardObserver m_stdObserver
Definition IccTagBasic.h:1730
icSpectralRange m_observerRange
Definition IccTagBasic.h:1732
icFloatNumber * m_illuminant
Definition IccTagBasic.h:1739
icSpectralRange m_illuminantRange
Definition IccTagBasic.h:1738
icFloatXYZNumber m_surroundXYZ
Definition IccTagBasic.h:1724
icFloatNumber m_colorTemperature
Definition IccTagBasic.h:1736
icFloatXYZNumber m_illuminantXYZ
Definition IccTagBasic.h:1723
icFloatNumber * m_observer
Definition IccTagBasic.h:1733
icIlluminant m_stdIlluminant
Definition IccTagBasic.h:1735

References icSpectralRange::end, icIlluminantD50, icStdObs1931TwoDegrees, m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, m_surroundXYZ, icSpectralRange::start, icSpectralRange::steps, icFloatXYZNumber::X, icFloatXYZNumber::Y, and icFloatXYZNumber::Z.

◆ CIccTagSpectralViewingConditions() [2/2]

CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions ( const CIccTagSpectralViewingConditions SVCT)

Name: CIccTagSpectralViewingConditions::CIccTagSpectralViewingConditions

Purpose: Copy Constructor

Args: SVCT = The CIccTagSpectralViewingConditions object to be copied

10861{
10866
10867 if (SVCT.m_observer && SVCT.m_observerRange.steps) {
10869 if (m_observer) {
10870 memcpy(m_observer, SVCT.m_observer, SVCT.m_observerRange.steps*3*sizeof(icFloat32Number));
10871 }
10872 }
10873 else {
10874 m_observer = NULL;
10875 }
10876
10879
10883
10884 if (SVCT.m_illuminant && SVCT.m_illuminantRange.steps) {
10886 if (m_illuminant) {
10888 }
10889 }
10890 else {
10891 m_illuminant = NULL;
10892 }
10893
10894 m_illuminantXYZ.X = 0;
10895 m_illuminantXYZ.Y = 0;
10896 m_illuminantXYZ.Z = 0;
10897
10898 m_surroundXYZ.X = 0;
10899 m_surroundXYZ.Y = 0;
10900 m_surroundXYZ.Z = 0;
10901}
float icFloat32Number
Definition icProfileHeader.h:313

References icSpectralRange::end, m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, m_surroundXYZ, icSpectralRange::start, icSpectralRange::steps, icFloatXYZNumber::X, icFloatXYZNumber::Y, and icFloatXYZNumber::Z.

Referenced by NewCopy().

+ Here is the caller graph for this function:

◆ ~CIccTagSpectralViewingConditions()

CIccTagSpectralViewingConditions::~CIccTagSpectralViewingConditions ( )
virtual

Name: CIccTagSpectralViewingConditions::~CIccTagResponseCurveSet16

Purpose: Destructor

10969{
10970 if (m_observer)
10971 delete [] m_observer;
10972
10973 if (m_illuminant)
10974 delete [] m_illuminant;
10975}

References m_illuminant, and m_observer.

Member Function Documentation

◆ applyRangeToObserver()

icFloatNumber * CIccTagSpectralViewingConditions::applyRangeToObserver ( const icSpectralRange newRange) const
11302{
11303 int n = newRange.steps*3;
11304 icFloatNumber *rv = (icFloatNumber*)malloc(n*sizeof(icFloatNumber));
11305
11307 if (range) {
11308 range->VectorMult(rv, m_observer);
11309 range->VectorMult(&rv[newRange.steps], &m_observer[m_observerRange.steps]);
11310 range->VectorMult(&rv[newRange.steps*2], &m_observer[m_observerRange.steps*2]);
11311 delete range;
11312 }
11313 else {
11314 memcpy(rv, m_observer, m_observerRange.steps*3*sizeof(icFloatNumber));
11315 }
11316
11317 return rv;
11318}
float icFloatNumber
Definition IccDefs.h:101
Definition IccMatrixMath.h:94
static CIccMatrixMath * rangeMap(const icSpectralRange &from, const icSpectralRange &to)
Definition IccMatrixMath.cpp:409
virtual void VectorMult(icFloatNumber *pDst, const icFloatNumber *pSrc) const
Definition IccMatrixMath.cpp:154

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

+ Here is the call graph for this function:

◆ Create()

CIccTag * CIccTag::Create ( icTagTypeSignature  sig)
staticinherited

Name: CIccTag::Create

Purpose: This is a static tag creator based upon tag signature type

Args: sig = tag type signature

Return: Pointer to Allocated tag

144{
145 return CIccTagCreator::CreateTag(sig);
146}
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Definition IccTagFactory.h:279

References CIccTagCreator::CreateTag().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagStruct::LoadElem(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeTintArray::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and CIccProfileDescText::SetType().

+ Here is the call graph for this function:
+ Here is the caller 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.

11165{
11166 icChar buf[128];
11167 CIccInfo info;
11168
11169 sprintf(buf, "StdObserver: %s\n\n", info.GetStandardObserverName(m_stdObserver));
11170 sDescription += buf;
11171
11172 sprintf(buf, "Illuminant Tristimulus values: X = %.4lf, Y = %.4lf, Z = %.4lf\n\n",
11174 sDescription += buf;
11175
11176 if (m_observer) {
11177 sprintf(buf, "Observer Functions: start=%.1fnm end=%.1fnm, steps=%d\n",
11179 sDescription += buf;
11180
11181 if (nVerboseness > 75) {
11183 int i, j;
11184 for (j=0; j<3; j++) {
11185 for (i=0; i<m_observerRange.steps; i++) {
11186 sprintf(buf, " %.4f", *ptr);
11187 sDescription += buf;
11188 ptr++;
11189 }
11190 sDescription += "\n\n";
11191 }
11192 }
11193 }
11194 else {
11195 sDescription += "No custom Observer defined\n\n";
11196 }
11197
11198 sDescription += "StdIlluminant Type: ";
11199
11200 sDescription += info.GetIlluminantName(m_stdIlluminant);
11201 sDescription += "\n";
11202
11203 sprintf(buf, "Color Temperature: %.1fK\n\n", m_colorTemperature);
11204 sDescription += buf;
11205
11206 if (m_illuminant) {
11207 sprintf(buf, "Illuminant SPD: start=%.1fm end=%.1fnm, steps=%d\n",
11209 sDescription += buf;
11210 if (nVerboseness > 75) {
11212 int i;
11213 for (i=0; i<m_illuminantRange.steps; i++) {
11214 sprintf(buf, " %.4f", *ptr);
11215 sDescription += buf;
11216 ptr++;
11217 }
11218 }
11219 sDescription += "\n\n";
11220 }
11221 else {
11222 sDescription += "No custom Observer defined\n\n";
11223 }
11224
11225 sprintf(buf, "Surround Tristimulus values: X = %.4lf, Y = %.4lf, Z = %.4lf\n",
11227 sDescription += buf;
11228}
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API icFloat32Number icF16toF(icFloat16Number num)
Definition IccUtil.cpp:629
Definition IccUtil.h:303
const icChar * GetIlluminantName(icIlluminant val)
Definition IccUtil.cpp:2169
const icChar * GetStandardObserverName(icStandardObserver val)
Definition IccUtil.cpp:2151

References icSpectralRange::end, CIccInfo::GetIlluminantName(), CIccInfo::GetStandardObserverName(), icF16toF(), m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, m_surroundXYZ, icSpectralRange::start, icSpectralRange::steps, icFloatXYZNumber::X, icFloatXYZNumber::Y, and icFloatXYZNumber::Z.

+ Here is the call graph for this function:

◆ DetachIO()

virtual void CIccTag::DetachIO ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

183{}

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlSpectralViewingConditions.

1701{ return "CIccTagSpectralViewingConditions"; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTag::GetExtension ( )
inlinevirtualinherited

Reimplemented in CIccTagXmlUnknown, CIccTagXmlText, CIccTagXmlUtf8Text, CIccTagXmlZipUtf8Text, CIccTagXmlZipXml, CIccTagXmlUtf16Text, CIccTagXmlTextDescription, CIccTagXmlSignature, CIccTagXmlNamedColor2, CIccTagXmlXYZ, CIccTagXmlChromaticity, CIccTagXmlCicp, CIccTagXmlSparseMatrixArray, CIccTagXmlFixedNum< T, Tsig >, CIccTagXmlNum< T, A, Tsig >, CIccTagXmlFloatNum< T, A, Tsig >, CIccTagXmlMeasurement, CIccTagXmlMultiLocalizedUnicode, CIccTagXmlTagData, CIccTagXmlDateTime, CIccTagXmlColorantOrder, CIccTagXmlColorantTable, CIccTagXmlViewingConditions, CIccTagXmlSpectralDataInfo, CIccTagXmlSpectralViewingConditions, CIccTagXmlProfileSeqDesc, CIccTagXmlResponseCurveSet16, CIccTagXmlCurve, CIccTagXmlParametricCurve, CIccTagXmlSegmentedCurve, CIccTagXmlLutAtoB, CIccTagXmlLutBtoA, CIccTagXmlLut8, CIccTagXmlLut16, CIccTagXmlMultiProcessElement, CIccTagXmlProfileSequenceId, CIccTagXmlDict, CIccTagXmlStruct, CIccTagXmlArray, CIccTagXmlGamutBoundaryDesc, CIccTagXmlEmbeddedHeightImage, CIccTagXmlEmbeddedNormalImage, and CIccTagXmlEmbeddedProfile.

143{return NULL;}

Referenced by icCurvesFromXml(), icCurvesToXml(), icProfDescToXml(), icXmlParseProfDesc(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeXmlTintArray::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlArray::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ getIlluminant()

const icFloatNumber * CIccTagSpectralViewingConditions::getIlluminant ( icSpectralRange illumRange) const
11406{
11408 for (int i = 0; i < NUM_KNOWN_ILLUM; i++) {
11409 if (m_stdIlluminant == icKnownIllums[i].illum) {
11410 illumRange = icKnownIllumObsRange;
11411 return &icKnownIllums[i].spd[0];
11412 }
11413 }
11414 }
11415
11416 illumRange = m_illuminantRange;
11417 return m_illuminant;
11418}
static icIllumDef icKnownIllums[]
Definition IccTagBasic.cpp:11343
#define NUM_KNOWN_ILLUM
Definition IccTagBasic.cpp:11401
static icSpectralRange icKnownIllumObsRange
Definition IccTagBasic.cpp:11403
icFloatNumber spd[81]
Definition IccTagBasic.cpp:11340

References icKnownIllumObsRange, icKnownIllums, icIllumDef::illum, m_illuminant, m_illuminantRange, m_stdIlluminant, icIllumDef::spd, and icSpectralRange::steps.

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

+ Here is the caller graph for this function:

◆ getIlluminantCCT()

icFloatNumber CIccTagSpectralViewingConditions::getIlluminantCCT ( ) const
inline
1713{ return m_colorTemperature; }

References 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
11570{
11571 if (!m_observer || !m_observerRange.steps) {
11572 for (int i = 0; i < NUM_KNOWN_OBSERVERS; i++) {
11573 if (m_stdObserver == icKnownObservers[i].obs) {
11574 observerRange = icKnownIllumObsRange;
11575 return &icKnownObservers[i].cmf[0];
11576 }
11577 }
11578 }
11579
11580 observerRange = m_observerRange;
11581 return m_observer;
11582}
#define NUM_KNOWN_OBSERVERS
Definition IccTagBasic.cpp:11566
static icObserverDef icKnownObservers[]
Definition IccTagBasic.cpp:11488
icFloatNumber cmf[81 *3]
Definition IccTagBasic.cpp:11485

References icObserverDef::cmf, icKnownIllumObsRange, icKnownObservers, m_observer, m_observerRange, m_stdObserver, icObserverDef::obs, and icSpectralRange::steps.

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

+ Here is the caller graph for this function:

◆ getObserverMatrix()

CIccMatrixMath * CIccTagSpectralViewingConditions::getObserverMatrix ( const icSpectralRange newRange) const
11321{
11322 CIccMatrixMath *pMtx=new CIccMatrixMath(3, newRange.steps);
11323
11324 CIccMatrixMath *range = CIccPcsXform::rangeMap(m_observerRange, newRange);
11325 if (range) {
11326 range->VectorMult(pMtx->entry(0), m_observer);
11327 range->VectorMult(pMtx->entry(1), &m_observer[m_observerRange.steps]);
11328 range->VectorMult(pMtx->entry(2), &m_observer[m_observerRange.steps*2]);
11329 delete range;
11330 }
11331 else {
11332 memcpy(pMtx->entry(0), m_observer, m_observerRange.steps*3*sizeof(icFloatNumber));
11333 }
11334
11335 return pMtx;
11336}
icFloatNumber * entry(icUInt16Number nRow, icUInt16Number nCol=0)
Definition IccMatrixMath.h:111

References CIccMatrixMath::CIccMatrixMath(), CIccMatrixMath::entry(), m_observer, m_observerRange, 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
1712{ return m_stdIlluminant; }

References m_stdIlluminant.

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

+ Here is the caller graph for this function:

◆ getStdObserver()

icStandardObserver CIccTagSpectralViewingConditions::getStdObserver ( ) const
inline
1714{ return m_stdObserver; }

References m_stdObserver.

Referenced by IIccProfileConnectionConditions::getPccObserver().

+ Here is the caller graph for this function:

◆ GetTagArrayType()

virtual icArraySignature CIccTag::GetTagArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagArray.

133{ return icSigUndefinedArray; }
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray.

Referenced by icGetTagArrayHandlerOfType(), and CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ GetTagStructType()

virtual icStructSignature CIccTag::GetTagStructType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagStruct.

132{ return icSigUndefinedStruct; }
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct.

Referenced by icGetTagStructHandlerOfType(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ 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.

@ icSigSpectralViewingConditionsType
Definition icProfileHeader.h:561

References icSigSpectralViewingConditionsType.

Referenced by Write().

+ Here is the caller graph for this function:

◆ IsArrayType()

virtual bool CIccTag::IsArrayType ( )
inlinevirtualinherited

Reimplemented in CIccTagXYZ, CIccTagChromaticity, CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, CIccTagFloatNum< T, Tsig >, and CIccTagData.

135{ return false; }

Referenced by MyTagDialog::MyTagDialog(), and DumpTag().

+ Here is the caller graph for this function:

◆ IsMBBType()

virtual bool CIccTag::IsMBBType ( )
inlinevirtualinherited

Reimplemented in CIccMBB.

136{ return false; } //If true then CIccTag can be cast as an CIccMBB

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ IsNumArrayType()

virtual bool CIccTag::IsNumArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, and CIccTagFloatNum< T, Tsig >.

137{ return false;} //If true then CIccTag can be cast as a CIccTagNumArray

Referenced by CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), CIccTagStruct::GetElemNumberValue(), CIccStructNamedColor::GetNumArray(), CIccMpeXmlTintArray::ParseXml(), and CIccMpeTintArray::Read().

+ Here is the caller graph for this function:

◆ IsSupported()

virtual bool CIccTag::IsSupported ( )
inlinevirtualinherited

Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes. By Default inherited classes are supported. Unknown tag types are not supported.

Returns true if tag type is supported.

Reimplemented in CIccTagUnknown, CIccTagEmbeddedProfile, and CIccTagMultiProcessElement.

153{ return true; }

◆ 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.

1697{return new CIccTagSpectralViewingConditions(*this);}
CIccTagSpectralViewingConditions()
Definition IccTagBasic.cpp:10823

References CIccTagSpectralViewingConditions().

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions().

+ Here is the call graph for this function:
+ 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

10915{
10920
10921 if (SVCT.m_observer && SVCT.m_observerRange.steps) {
10923 if (m_observer) {
10924 memcpy(m_observer, SVCT.m_observer, SVCT.m_observerRange.steps*3*sizeof(icFloat32Number));
10925 }
10926 }
10927 else {
10928 m_observer = NULL;
10929 }
10930
10933
10937
10938 if (SVCT.m_illuminant && SVCT.m_illuminantRange.steps) {
10940 if (m_illuminant) {
10942 }
10943 }
10944 else {
10945 m_illuminant = NULL;
10946 }
10947
10948 m_illuminantXYZ.X = 0;
10949 m_illuminantXYZ.Y = 0;
10950 m_illuminantXYZ.Z = 0;
10951
10952 m_surroundXYZ.X = 0;
10953 m_surroundXYZ.Y = 0;
10954 m_surroundXYZ.Z = 0;
10955
10956 return *this;
10957}

References icSpectralRange::end, m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, m_observer, m_observerRange, m_stdIlluminant, m_stdObserver, m_surroundXYZ, icSpectralRange::start, icSpectralRange::steps, icFloatXYZNumber::X, icFloatXYZNumber::Y, and icFloatXYZNumber::Z.

◆ Read() [1/2]

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.

10993{
10995
10996 //check size properly
10997 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
10998 sizeof(icUInt32Number)*4;
10999 if (headerSize > size)
11000 return false;
11001
11002 if (!pIO) {
11003 return false;
11004 }
11005
11006 if (!pIO->Read32(&sig) ||
11007 !pIO->Read32(&m_nReserved))
11008 return false;
11009
11010
11011 if (!pIO->Read32(&m_stdObserver) ||
11012 !pIO->Read16(&m_observerRange.start) ||
11013 !pIO->Read16(&m_observerRange.end) ||
11014 !pIO->Read16(&m_observerRange.steps) ||
11015 !pIO->Read16(&m_reserved2))
11016 return false;
11017
11018 icUInt32Number vals;
11019
11020 if (m_observer) {
11021 delete [] m_observer;
11022 m_observer = NULL;
11023 }
11024
11025 icUInt32Number observerSize = 0;
11026
11027 if (m_observerRange.steps) {
11028 vals = m_observerRange.steps * 3;
11029
11030 observerSize = vals * sizeof(icFloat32Number);
11031
11032 if (headerSize + observerSize > size)
11033 return false;
11034
11035 m_observer = new icFloat32Number[vals];
11036 if (!m_observer)
11037 return false;
11038
11039 if (pIO->ReadFloat32Float(&m_observer[0], vals) != vals)
11040 return false;
11041 }
11042
11043 icUInt32Number illumInfoSize = 2 * sizeof(icUInt32Number) + 4 * sizeof(icUInt16Number);
11044 if (headerSize + observerSize +illumInfoSize > size)
11045 return false;
11046
11047 if (!pIO->Read32(&m_stdIlluminant) ||
11049 !pIO->Read16(&m_illuminantRange.start) ||
11050 !pIO->Read16(&m_illuminantRange.end) ||
11051 !pIO->Read16(&m_illuminantRange.steps) ||
11052 !pIO->Read16(&m_reserved3))
11053 return false;
11054
11055
11056 if (m_illuminant) {
11057 delete [] m_illuminant;
11058 m_illuminant = NULL;
11059 }
11060
11061 icUInt32Number illuminantSize = 0;
11062
11064 vals = m_illuminantRange.steps;
11065
11066 illuminantSize = vals * sizeof(icFloat32Number);
11067
11068 if (headerSize + observerSize + illumInfoSize + illuminantSize > size)
11069 return false;
11070
11071 m_illuminant = new icFloat32Number[vals];
11072 if (!m_illuminant)
11073 return false;
11074
11075 if (pIO->ReadFloat32Float(&m_illuminant[0], vals) != vals)
11076 return false;
11077 }
11078 else {
11080 }
11081
11082 if (headerSize + observerSize + illumInfoSize + illuminantSize + 6*sizeof(icFloat32Number) > size)
11083 return false;
11084
11085 if (pIO->ReadFloat32Float(&m_illuminantXYZ, 3)!=3 ||
11086 pIO->ReadFloat32Float(&m_surroundXYZ, 3)!=3)
11087 return false;
11088
11089 return true;
11090}
unsigned short icUInt16Number
Definition icProfileHeader.h:256
unsigned long icUInt32Number
Definition icProfileHeader.h:262
icTagTypeSignature
Definition icProfileHeader.h:526
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
Definition IccTagBasic.h:235
icUInt16Number m_reserved2
Definition IccTagBasic.h:1726
icUInt16Number m_reserved3
Definition IccTagBasic.h:1727
bool setIlluminant(icIlluminant illumId, const icSpectralRange &illumRange, const icFloatNumber *illum, icFloatNumber illumCCT=0.0f)
Definition IccTagBasic.cpp:11420

References icSpectralRange::end, m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, CIccTag::m_nReserved, m_observer, m_observerRange, m_reserved2, m_reserved3, m_stdIlluminant, m_stdObserver, m_surroundXYZ, CIccIO::Read16(), CIccIO::Read32(), CIccIO::ReadFloat32Float(), setIlluminant(), icSpectralRange::start, and icSpectralRange::steps.

+ Here is the call graph for this function:

◆ Read() [2/2]

virtual bool CIccTag::Read ( icUInt32Number  size,
CIccIO pIO,
CIccProfile pProfile 
)
inlinevirtualinherited

Function: Read(size, pIO) - Read tag from file. Each derived tag will implement it's own Read() function.

Parameter(s): size - number of bytes in tag including the type signature. pIO - IO object used to read in tag. The IO object should already be initialized to point to the begining of the tag.

Returns true if Read is successful.

Reimplemented in CIccTagEmbeddedProfile.

197{ return Read(size, pIO); }
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References CIccTag::Read().

+ Here is the call graph for this function:

◆ ReadAll()

virtual bool CIccTag::ReadAll ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

Reimplemented in CIccTagEmbeddedProfile.

175{ return true; }

◆ setIlluminant() [1/2]

bool CIccTagSpectralViewingConditions::setIlluminant ( icFloatNumber pWhiteXYZ)
11452{
11453 icSpectralRange zeroRange;
11454 memset(&zeroRange, 0, sizeof(zeroRange));
11455 icFloatNumber white[3] = {0};
11456 white[0] = pWhiteXYZ[0] / pWhiteXYZ[1];
11457 white[1] = 1.0;
11458 white[2] = pWhiteXYZ[2] / pWhiteXYZ[1];
11459
11460 if (!pWhiteXYZ || !icNotZero(pWhiteXYZ[1])) {
11461 setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11462 return false;
11463 }
11464
11466 if ((icIsNear(white[0], icD50XYZ[0]) && icIsNear(white[2], icD50XYZ[2])) ||
11467 (icIsNear(white[0], 0.9642f, 0.0001f) && icIsNear(white[2], 0.8251f, 0.0001f))) {
11468 return setIlluminant(icIlluminantD50, zeroRange, NULL, 5000);
11469 }
11470 else if (icIsNear(white[0], 0.9505f, 0.0001f) && icIsNear(white[2], 1.0888f, 0.0001f)) {
11471 return setIlluminant(icIlluminantD65, zeroRange, NULL, 6504);
11472 }
11473 }
11474// else if (m_stdObserver == icStdObs1964TenDegrees) {
11475// setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11476// return false;
11477// }
11478
11479 setIlluminant(icIlluminantUnknown, zeroRange, NULL);
11480 return false;
11481}
@ icIlluminantUnknown
Definition icProfileHeader.h:1191
@ icIlluminantD65
Definition icProfileHeader.h:1193
Definition icProfileHeader.h:1466
ICCPROFLIB_API icFloatNumber icD50XYZ[3]
Definition IccUtil.cpp:782
ICCPROFLIB_API bool icIsNear(icFloatNumber v1, icFloatNumber v2, icFloatNumber nearRange=1.0e-8)
Definition IccUtil.cpp:142
#define icNotZero(v)
Definition IccUtil.h:89

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

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

◆ setIlluminant() [2/2]

bool CIccTagSpectralViewingConditions::setIlluminant ( icIlluminant  illumId,
const icSpectralRange illumRange,
const icFloatNumber illum,
icFloatNumber  illumCCT = 0.0f 
)
11421{
11422 m_stdIlluminant = illumId;
11423 m_colorTemperature = illumCCT;
11424
11425 if (m_illuminant) {
11426 delete[] m_illuminant;
11427 m_illuminant = nullptr;
11428 }
11429
11430 m_illuminantRange = illumRange;
11431
11432 if (illumRange.steps && illum) {
11433 icUInt32Number size = illumRange.steps;
11434 m_illuminant = new icFloatNumber[size]; // Replaced malloc with new[]
11435 if (m_illuminant)
11436 memcpy(m_illuminant, illum, size * sizeof(icFloatNumber)); // Retained memcpy
11437 else {
11438 memset(&m_illuminantRange, 0, sizeof(m_illuminantRange));
11439 return false;
11440 }
11441 } else {
11442 if (!illum)
11443 memset(&m_illuminantRange, 0, sizeof(m_illuminantRange));
11444
11445 m_illuminant = nullptr;
11446 }
11447
11448 return true;
11449}

References m_colorTemperature, m_illuminant, m_illuminantRange, m_stdIlluminant, and icSpectralRange::steps.

Referenced by CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(), CIccTagXmlSpectralViewingConditions::ParseXml(), Read(), and setIlluminant().

+ Here is the caller graph for this function:

◆ setObserver()

bool CIccTagSpectralViewingConditions::setObserver ( icStandardObserver  observerId,
const icSpectralRange observerRange,
const icFloatNumber observer 
)
11585{
11586 m_stdObserver = observerId;
11587 m_observerRange = observerRange;
11588 if (m_observer) {
11589 delete [] m_observer;
11590 }
11591
11592 if (observerRange.steps && observer) {
11593 icUInt32Number size = observerRange.steps * 3;
11594 m_observer = new icFloatNumber[size];
11595 if (m_observer)
11596 memcpy(m_observer, observer, size*sizeof(icFloatNumber));
11597 else {
11598 memset(&m_observerRange, 0, sizeof(m_observerRange));
11599 return false;
11600 }
11601 }
11602 else {
11603 if (!observer)
11604 memset(&m_observerRange, 0, sizeof(m_illuminantRange));
11605
11606 m_observer = NULL;
11607 }
11608
11609 return true;
11610}

References m_illuminantRange, m_observer, m_observerRange, m_stdObserver, and 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.

11247{
11248 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
11249
11250 CIccInfo Info;
11251 std::string sSigPathName = Info.GetSigPathName(sigPath);
11252
11253 rv = icMaxStatus(rv, Info.CheckData(sReport, m_illuminantXYZ, sSigPathName + ":>illuminantXYZ"));
11254 rv = icMaxStatus(rv, Info.CheckData(sReport, m_surroundXYZ, sSigPathName + ":>surroundXYZ"));
11255
11256 rv = icMaxStatus(rv, Info.CheckLuminance(sReport, m_illuminantXYZ, sSigPathName + ":>illuminantXYZ"));
11257 rv = icMaxStatus(rv, Info.CheckLuminance(sReport, m_surroundXYZ, sSigPathName + ":>surroundXYZ"));
11258
11259 icSpectralRange range;
11260
11261 if (getObserver(range)) {
11262 rv = icMaxStatus(rv, Info.CheckData(sReport, range, sSigPathName + ":>observerRange"));
11263
11264 if (!m_observer && pProfile && pProfile->m_Header.version < icVersionNumberV5_1) {
11265 sReport += icMsgValidateNonCompliant;
11266 sReport += sSigPathName;
11267 sReport += " - Missing Observer CMF not supported by profile version!\r\n";
11269 }
11270 }
11271 else {
11272 rv = icMaxStatus(rv, Info.CheckData(sReport, m_observerRange, sSigPathName + ":>observerRange"));
11273
11274 sReport += icMsgValidateCriticalError;
11275 sReport += sSigPathName;
11276 sReport += " - Missing Observer CMF!\r\n";
11278 }
11279
11280 if (getIlluminant(range)) {
11281 rv = icMaxStatus(rv, Info.CheckData(sReport, range, sSigPathName + ":>illuminantRange"));
11282
11283 if (!m_illuminant && pProfile && pProfile->m_Header.version < icVersionNumberV5_1) {
11284 sReport += icMsgValidateNonCompliant;
11285 sReport += sSigPathName;
11286 sReport += " - Missing illuminant SPD not supported by profile version!\r\n";
11288 }
11289 }
11290 else {
11291 rv = icMaxStatus(rv, Info.CheckData(sReport, m_illuminantRange, sSigPathName + ":>illuminantRange"));
11292 sReport += icMsgValidateCriticalError;
11293 sReport += sSigPathName;
11294 sReport += " - Missing Illuminant SPD!\r\n";
11296 }
11297
11298 return rv;
11299}
#define icVersionNumberV5_1
Definition icProfileHeader.h:194
icValidateStatus
Definition IccDefs.h:119
@ icValidateCriticalError
Definition IccDefs.h:123
@ icValidateNonCompliant
Definition IccDefs.h:122
ICCPROFLIB_API const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
ICCPROFLIB_API const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
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
Definition IccTagBasic.cpp:164
const icFloatNumber * getObserver(icSpectralRange &observerRange) const
Definition IccTagBasic.cpp:11569
const icFloatNumber * getIlluminant(icSpectralRange &illumRange) const
Definition IccTagBasic.cpp:11405

References CIccInfo::CheckData(), CIccInfo::CheckData(), CIccInfo::CheckLuminance(), getIlluminant(), getObserver(), CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateCriticalError, icMsgValidateNonCompliant, icValidateCriticalError, icValidateNonCompliant, m_illuminant, m_illuminantRange, m_illuminantXYZ, m_observer, m_observerRange, m_surroundXYZ, CIccTag::Validate(), and icHeader::version.

+ 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.

11107{
11109
11110 if (!pIO) {
11111 return false;
11112 }
11113
11114 if (!pIO->Write32(&sig) ||
11115 !pIO->Write32(&m_nReserved))
11116 return false;
11117
11118
11119 if (!pIO->Write32(&m_stdObserver) ||
11120 !pIO->Write16(&m_observerRange.start) ||
11121 !pIO->Write16(&m_observerRange.end) ||
11122 !pIO->Write16(&m_observerRange.steps) ||
11123 !pIO->Write16(&m_reserved2))
11124 return false;
11125
11127
11128 if (vals)
11129 if (pIO->WriteFloat32Float(&m_observer[0], vals) != vals)
11130 return false;
11131
11132 if (!pIO->Write32(&m_stdIlluminant) ||
11135 !pIO->Write16(&m_illuminantRange.end) ||
11137 !pIO->Write16(&m_reserved3))
11138 return false;
11139
11140 vals = m_illuminantRange.steps;
11141
11142 if (vals)
11143 if (pIO->WriteFloat32Float(&m_illuminant[0], vals) != vals)
11144 return false;
11145
11146 if (pIO->WriteFloat32Float(&m_illuminantXYZ, 3)!=3 ||
11147 pIO->WriteFloat32Float(&m_surroundXYZ, 3)!=3)
11148 return false;
11149
11150 return true;
11151}
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
Definition IccTagBasic.h:1700

References icSpectralRange::end, GetType(), m_colorTemperature, m_illuminant, m_illuminantRange, m_illuminantXYZ, CIccTag::m_nReserved, m_observer, m_observerRange, m_reserved2, m_reserved3, m_stdIlluminant, m_stdObserver, m_surroundXYZ, icSpectralRange::start, icSpectralRange::steps, CIccIO::Write16(), CIccIO::Write32(), and CIccIO::WriteFloat32Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_colorTemperature

◆ m_illuminant

◆ m_illuminantRange

◆ m_illuminantXYZ

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagText::Read(), CIccTagUtf8Text::Read(), CIccTagZipUtf8Text::Read(), CIccTagUtf16Text::Read(), CIccTagTextDescription::Read(), CIccTagSignature::Read(), CIccTagNamedColor2::Read(), CIccTagXYZ::Read(), CIccTagChromaticity::Read(), CIccTagCicp::Read(), CIccTagSparseMatrixArray::Read(), CIccTagFixedNum< T, Tsig >::Read(), CIccTagNum< T, Tsig >::Read(), CIccTagFloatNum< T, Tsig >::Read(), CIccTagMeasurement::Read(), CIccTagMultiLocalizedUnicode::Read(), CIccTagData::Read(), CIccTagDateTime::Read(), CIccTagColorantOrder::Read(), CIccTagColorantTable::Read(), CIccTagViewingConditions::Read(), CIccTagProfileSeqDesc::Read(), CIccTagResponseCurveSet16::Read(), CIccTagSpectralDataInfo::Read(), Read(), CIccTagEmbeddedHeightImage::Read(), CIccTagEmbeddedNormalImage::Read(), CIccTagStruct::Read(), CIccTagArray::Read(), CIccTagDict::Read(), CIccTagCurve::Read(), CIccTagParametricCurve::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagGamutBoundaryDesc::Read(), CIccTagMultiProcessElement::Read(), CIccTagProfileSequenceId::Read(), CIccTagEmbeddedProfile::Read(), CIccTag::Validate(), CIccTagText::Write(), CIccTagUtf8Text::Write(), CIccTagZipUtf8Text::Write(), CIccTagUtf16Text::Write(), CIccTagTextDescription::Write(), CIccTagSignature::Write(), CIccTagNamedColor2::Write(), CIccTagXYZ::Write(), CIccTagChromaticity::Write(), CIccTagCicp::Write(), CIccTagSparseMatrixArray::Write(), CIccTagFixedNum< T, Tsig >::Write(), CIccTagNum< T, Tsig >::Write(), CIccTagFloatNum< T, Tsig >::Write(), CIccTagMeasurement::Write(), CIccTagMultiLocalizedUnicode::Write(), CIccTagData::Write(), CIccTagDateTime::Write(), CIccTagColorantOrder::Write(), CIccTagColorantTable::Write(), CIccTagViewingConditions::Write(), CIccTagProfileSeqDesc::Write(), CIccTagResponseCurveSet16::Write(), CIccTagSpectralDataInfo::Write(), Write(), CIccTagEmbeddedHeightImage::Write(), CIccTagEmbeddedNormalImage::Write(), CIccTagStruct::Write(), CIccTagArray::Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), CIccTagCurve::Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_observer

◆ m_observerRange

◆ m_reserved2

◆ m_reserved3

◆ m_stdIlluminant

◆ m_stdObserver

◆ m_surroundXYZ


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