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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlNamedColor2:
+ Collaboration diagram for CIccTagXmlNamedColor2:

Public Member Functions

virtual ~CIccTagXmlNamedColor2 ()
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
icInt32Number FindCachedPCSColor (icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0) const
 
icInt32Number FindColor (const icChar *szColor) const
 
icInt32Number FindDeviceColor (icFloatNumber *pDevColor) const
 
icInt32Number FindPCSColor (icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0)
 
icInt32Number FindRootColor (const icChar *szRootColor) const
 
virtual const char * GetClassName () const
 
bool GetColorName (std::string &sColorName, icInt32Number index) const
 
icUInt32Number GetDeviceCoords () const
 
icColorSpaceSignature GetDeviceSpace () const
 
SIccNamedColorEntryGetEntry (icUInt32Number index) const
 
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
icColorSpaceSignature GetPCS () const
 
const icCharGetPrefix () const
 
icUInt32Number GetSize () const
 
const icCharGetSufix () const
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
icUInt32Number GetVendorFlags () const
 
bool InitFindCachedPCSColor ()
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
void Lab2ToLab4 (icFloatNumber *Dst, const icFloatNumber *Src) const
 
void Lab4ToLab2 (icFloatNumber *Dst, const icFloatNumber *Src) const
 
icFloatNumber NegClip (icFloatNumber v) const
 
virtual CIccTagNewCopy () const
 
SIccNamedColorEntryoperator[] (icUInt32Number index) const
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
void ResetPCSCache ()
 Call ResetPCSCache() if entry values change between calls to FindPCSColor()
 
virtual void SetColorSpaces (icColorSpaceSignature csPCS, icColorSpaceSignature csDevice)
 
void SetPrefix (const icChar *szPrefix)
 
bool SetSize (icUInt32Number nSize, icInt32Number nDeviceCoords=-1)
 
void SetSufix (const icChar *szSufix)
 
void SetVendorFlags (icUInt32Number nVendorFlags)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
icFloatNumber UnitClip (icFloatNumber v) const
 
virtual bool UseLegacyPCS () const
 
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

icUInt32Number m_nReserved
 

Protected Attributes

icColorSpaceSignature m_csDevice
 
icColorSpaceSignature m_csPCS
 
SIccNamedColorEntrym_NamedColor
 
SIccNamedLabEntrym_NamedLab
 
icUInt32Number m_nColorEntrySize
 For quick response of repeated FindPCSColor.
 
icUInt32Number m_nDeviceCoords
 
icUInt32Number m_nSize
 
icUInt32Number m_nVendorFlags
 
icChar m_szPrefix [32]
 
icChar m_szSufix [32]
 

Detailed Description

Constructor & Destructor Documentation

◆ ~CIccTagXmlNamedColor2()

virtual CIccTagXmlNamedColor2::~CIccTagXmlNamedColor2 ( )
inlinevirtual
219{}

Member Function Documentation

◆ 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 CIccTagNamedColor2::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtualinherited

Name: CIccTagNamedColor2::Describe

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

3018{
3019 icChar buf[128], szColorVal[40], szColor[40];
3020
3021 icUInt32Number i, j;
3022 SIccNamedColorEntry *pNamedColor=m_NamedColor;
3023
3024 sDescription.reserve(sDescription.size() + m_nSize*79);
3025
3026 sprintf(buf, "BEGIN_NAMED_COLORS flags=%08x %u %u\n", m_nVendorFlags, m_nSize, m_nDeviceCoords);
3027 sDescription += buf;
3028
3029 sprintf(buf, "Prefix=\"%s\"\n", m_szPrefix);
3030 sDescription += buf;
3031
3032 sprintf(buf, "Sufix= \"%s\"\n", m_szSufix);
3033 sDescription += buf;
3034
3035 for (i=0; i<m_nSize; i++) {
3036 sprintf(buf, "Color[%u]: %s :", i, pNamedColor->rootName);
3037 sDescription += buf;
3038
3039 icFloatNumber pcsCoord[3] ={0};
3040 for (j=0; j<3; j++)
3041 pcsCoord[j] = pNamedColor->pcsCoords[j];
3042
3043 if (m_csPCS==icSigLabData) {
3044 for (j=0; j<3; j++)
3045 pcsCoord[j] = (icFloatNumber)(pcsCoord[j] * 65535.0 / 65280.0);
3046 }
3047
3048 for (j=0; j<3; j++) {
3049 icColorIndexName(szColor, m_csPCS, j, 3, "P");
3050 icColorValue(szColorVal, pcsCoord[j], m_csPCS, j);
3051 sprintf(buf, " %s=%s", szColor, szColorVal);
3052 sDescription += buf;
3053 }
3054 if (m_nDeviceCoords) {
3055 sDescription += " :";
3056 for (j=0; j<m_nDeviceCoords; j++) {
3057 icColorIndexName(szColor, m_csDevice, j, m_nDeviceCoords, "D");
3058 icColorValue(szColorVal, pNamedColor->deviceCoords[j], m_csDevice, j);
3059 sprintf(buf, " %s=%s", szColor, szColorVal);
3060 sDescription += buf;
3061 }
3062 }
3063 sDescription += "\n";
3064
3065 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
3066 }
3067}
@ icSigLabData
Definition icProfileHeader.h:847
unsigned long icUInt32Number
Definition icProfileHeader.h:262
icFloatNumber deviceCoords[icAny]
Definition IccTagBasic.h:567
icChar rootName[32]
Definition IccTagBasic.h:565
icFloatNumber pcsCoords[3]
Definition IccTagBasic.h:566
Definition IccTagBasic.h:564
float icFloatNumber
Definition IccDefs.h:101
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API void icColorValue(icChar *szValue, icFloatNumber nValue, icColorSpaceSignature csSig, int nIndex, bool bUseLegacy=false)
Definition IccUtil.cpp:330
ICCPROFLIB_API void icColorIndexName(icChar *szName, icColorSpaceSignature csSig, int nIndex, int nColors, const icChar *szUnknown)
Definition IccUtil.cpp:295
SIccNamedColorEntry * m_NamedColor
Definition IccTagBasic.h:648
icColorSpaceSignature m_csPCS
Definition IccTagBasic.h:656
icUInt32Number m_nVendorFlags
Definition IccTagBasic.h:652
icUInt32Number m_nSize
Definition IccTagBasic.h:654
icChar m_szSufix[32]
Definition IccTagBasic.h:646
icUInt32Number m_nColorEntrySize
For quick response of repeated FindPCSColor.
Definition IccTagBasic.h:650
icUInt32Number m_nDeviceCoords
Definition IccTagBasic.h:653
icChar m_szPrefix[32]
Definition IccTagBasic.h:645
icColorSpaceSignature m_csDevice
Definition IccTagBasic.h:657

References SIccNamedColorEntry::deviceCoords, icColorIndexName(), icColorValue(), icSigLabData, CIccTagNamedColor2::m_csDevice, CIccTagNamedColor2::m_csPCS, CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTagNamedColor2::m_nDeviceCoords, CIccTagNamedColor2::m_nSize, CIccTagNamedColor2::m_nVendorFlags, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, SIccNamedColorEntry::pcsCoords, and SIccNamedColorEntry::rootName.

+ 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{}

◆ FindCachedPCSColor()

icInt32Number CIccTagNamedColor2::FindCachedPCSColor ( icFloatNumber pPCS,
icFloatNumber  dMinDE = 1000.0 
) const
inherited

Name: CIccTagNamedColor2::FindPCSColor

Purpose: Find the PCS color within the specified deltaE

Args: pPCS = PCS co-ordinates, dMinDE = the minimum deltaE (tolerance)

Return: Index of the named color array where the PCS color was found, if the color was not found within the tolerance -1 is returned

3181{
3182 icFloatNumber dCalcDE, dLeastDE=0.0;
3183 icFloatNumber pLabIn[3];
3184 icFloatNumber *pXYZ, *pLab;
3185 icInt32Number leastDEindex = -1;
3186 if (m_csPCS != icSigLabData) {
3187 pXYZ = pPCS;
3188 icXyzFromPcs(pXYZ);
3189 icXYZtoLab(pLabIn,pXYZ);
3190 }
3191 else {
3192 Lab2ToLab4(pLabIn, pPCS);
3193 icLabFromPcs(pLabIn);
3194 }
3195
3196 if (!m_NamedLab)
3197 return -1;
3198
3199 for (icUInt32Number i=0; i<m_nSize; i++) {
3200 pLab = m_NamedLab[i].lab;
3201
3202 dCalcDE = icDeltaE(pLabIn, pLab);
3203
3204 if (i==0) {
3205 dLeastDE = dCalcDE;
3206 leastDEindex = i;
3207 }
3208
3209 if (dCalcDE<dMinDE) {
3210 if (dCalcDE<dLeastDE) {
3211 dLeastDE = dCalcDE;
3212 leastDEindex = i;
3213 }
3214 }
3215 }
3216
3217 return leastDEindex;
3218}
long icInt32Number
Definition icProfileHeader.h:291
icFloatNumber lab[3]
Definition IccTagBasic.h:571
ICCPROFLIB_API void icXYZtoLab(icFloatNumber *Lab, const icFloatNumber *XYZ=NULL, const icFloatNumber *WhiteXYZ=NULL)
Definition IccUtil.cpp:846
ICCPROFLIB_API void icXyzFromPcs(icFloatNumber *XYZ)
Here are some conversion routines to convert to regular XYZ encoding.
Definition IccUtil.cpp:934
ICCPROFLIB_API void icLabFromPcs(icFloatNumber *Lab)
Here are some conversion routines to convert to regular Lab encoding.
Definition IccUtil.cpp:919
ICCPROFLIB_API icFloatNumber icDeltaE(const icFloatNumber *Lab1, const icFloatNumber *Lab2)
Definition IccUtil.cpp:527
SIccNamedLabEntry * m_NamedLab
Definition IccTagBasic.h:649
void Lab2ToLab4(icFloatNumber *Dst, const icFloatNumber *Src) const
Definition IccTagBasic.cpp:3418

References icDeltaE(), icLabFromPcs(), icSigLabData, icXyzFromPcs(), icXYZtoLab(), SIccNamedLabEntry::lab, CIccTagNamedColor2::Lab2ToLab4(), CIccTagNamedColor2::m_csPCS, CIccTagNamedColor2::m_NamedLab, and CIccTagNamedColor2::m_nSize.

Referenced by CIccTagNamedColor2::FindPCSColor().

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

◆ FindColor()

icInt32Number CIccTagNamedColor2::FindColor ( const icChar szColor) const
inherited

Name: CIccTagNamedColor2::FindColor

Purpose: Find the color with given name

Args: szColor = the color name

Return: Index of the named color array where the color name was found, if the color was not found -1 is returned

3256{
3257 std::string sColorName;
3258 icInt32Number i, j;
3259
3260 j = (icInt32Number)strlen(m_szPrefix);
3261 if (j != 0) {
3262 if (strncmp(szColor, m_szPrefix, j))
3263 return -1;
3264 }
3265
3266 j = (icInt32Number)strlen(m_szSufix);
3267 i = (icInt32Number)strlen(szColor);
3268 if (j != 0) {
3269 if (strncmp(szColor+(i-j), m_szSufix, j))
3270 return -1;
3271 }
3272
3273
3274 for ( i=0; i<(icInt32Number)m_nSize; i++) {
3275 sColorName = m_szPrefix;
3276 sColorName += m_NamedColor[i].rootName;
3277 sColorName += m_szSufix;
3278
3279 if (strcmp(sColorName.c_str(),szColor) == 0)
3280 return i;
3281 }
3282
3283 return -1;
3284}

References CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nSize, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, and SIccNamedColorEntry::rootName.

◆ FindDeviceColor()

icInt32Number CIccTagNamedColor2::FindDeviceColor ( icFloatNumber pDevColor) const
inherited

Name: CIccTagNamedColor2::FindDeviceColor

Purpose: Find the device color

Args: pDevColor = device color co-ordinates

Return: Index of the named color array where the closest device color was found, if device representation is absent -1 is returned.

3300{
3301 if (!m_nDeviceCoords)
3302 return -1;
3303
3304 icFloatNumber dCalcDiff=0.0, dLeastDiff=0.0;
3305 icFloatNumber *pDevOut;
3306 icInt32Number leastDiffindex = -1;
3307
3308
3309 for (icUInt32Number i=0; i<m_nSize; i++) {
3310 pDevOut = m_NamedColor[i].deviceCoords;
3311
3312 for (icUInt32Number j=0; j<m_nDeviceCoords; j++) {
3313 dCalcDiff += (pDevColor[j]-pDevOut[j])*(pDevColor[j]-pDevOut[j]);
3314 }
3315 dCalcDiff = (icFloatNumber)sqrt(dCalcDiff);
3316
3317 if (i==0) {
3318 dLeastDiff = dCalcDiff;
3319 leastDiffindex = i;
3320 }
3321
3322 if (dCalcDiff<dLeastDiff) {
3323 dLeastDiff = dCalcDiff;
3324 leastDiffindex = i;
3325 }
3326
3327 dCalcDiff = 0.0;
3328 }
3329
3330 return leastDiffindex;
3331}

References SIccNamedColorEntry::deviceCoords, CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nDeviceCoords, and CIccTagNamedColor2::m_nSize.

◆ FindPCSColor()

icInt32Number CIccTagNamedColor2::FindPCSColor ( icFloatNumber pPCS,
icFloatNumber  dMinDE = 1000.0 
)
inherited

Name: CIccTagNamedColor2::FindPCSColor

Purpose: Find the PCS color within the specified deltaE

Args: pPCS = PCS co-ordinates, dMinDE = the minimum deltaE (tolerance)

Return: Index of the named color array where the PCS color was found, if the color was not found within the tolerance -1 is returned

3235{
3236 if (!m_NamedLab)
3238
3239 return FindCachedPCSColor(pPCS, dMinDE);
3240}
bool InitFindCachedPCSColor()
Definition IccTagBasic.cpp:3137
icInt32Number FindCachedPCSColor(icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0) const
Definition IccTagBasic.cpp:3180

References CIccTagNamedColor2::FindCachedPCSColor(), CIccTagNamedColor2::InitFindCachedPCSColor(), and CIccTagNamedColor2::m_NamedLab.

+ Here is the call graph for this function:

◆ FindRootColor()

icInt32Number CIccTagNamedColor2::FindRootColor ( const icChar szRootColor) const
inherited

Name: CIccTagNamedColor2::FindRootColor

Purpose: Find the root color name

Args: szRootColor = string containing the root color name to be found

Return: Index of the named color array where the root color name was found, if the color was not found -1 is returned

3101{
3102 for (icUInt32Number i=0; i<m_nSize; i++) {
3103 if (stricmp(m_NamedColor[i].rootName,szRootColor) == 0)
3104 return i;
3105 }
3106
3107 return -1;
3108}
#define stricmp
Definition IccProfLibConf.h:149

References CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nSize, and SIccNamedColorEntry::rootName.

◆ GetClassName()

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

Reimplemented from CIccTagNamedColor2.

221{return "CIccTagXmlNamedColor2"; }

◆ GetColorName()

bool CIccTagNamedColor2::GetColorName ( std::string &  sColorName,
icInt32Number  index 
) const
inherited

Name: CIccTagNamedColor2::GetColorName

Purpose: Extracts the color name from the named color array

Args: sColorName = string where color name will be stored, index = array index of the color name

Return: true = if the index is within range, false = index out of range

3349{
3350 if (index > (icInt32Number)m_nSize-1)
3351 return false;
3352
3353 sColorName += m_szPrefix;
3355 sColorName += pNamedColor->rootName;
3356 sColorName += m_szSufix;
3357
3358 return true;
3359}

References CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTagNamedColor2::m_nSize, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, and SIccNamedColorEntry::rootName.

◆ GetDeviceCoords()

icUInt32Number CIccTagNamedColor2::GetDeviceCoords ( ) const
inlineinherited

◆ GetDeviceSpace()

icColorSpaceSignature CIccTagNamedColor2::GetDeviceSpace ( ) const
inlineinherited
634{return m_csDevice;}

References CIccTagNamedColor2::m_csDevice.

◆ GetEntry()

SIccNamedColorEntry * CIccTagNamedColor2::GetEntry ( icUInt32Number  index) const
inlineinherited
unsigned char icUInt8Number
Definition icProfileHeader.h:250

References CIccTagNamedColor2::m_NamedColor, and CIccTagNamedColor2::m_nColorEntrySize.

Referenced by ToXml().

+ Here is the caller graph for this function:

◆ GetExtClassName()

virtual const char * CIccTagXml::GetExtClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

79{ return "CIccTagXml"; }

Referenced by icProfDescToXml(), and icXmlParseProfDesc().

+ Here is the caller graph for this function:

◆ GetExtDerivedClassName()

virtual const char * CIccTagXml::GetExtDerivedClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

Reimplemented in CIccCurveXml.

80{ return ""; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlNamedColor2::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

223{return this; }

◆ GetPCS()

icColorSpaceSignature CIccTagNamedColor2::GetPCS ( ) const
inlineinherited
633{return m_csPCS;}

References CIccTagNamedColor2::m_csPCS.

◆ GetPrefix()

const icChar * CIccTagNamedColor2::GetPrefix ( ) const
inlineinherited
600{ return m_szPrefix; }

References CIccTagNamedColor2::m_szPrefix.

◆ GetSize()

icUInt32Number CIccTagNamedColor2::GetSize ( ) const
inlineinherited
628{ return m_nSize; }

References CIccTagNamedColor2::m_nSize.

◆ GetSufix()

const icChar * CIccTagNamedColor2::GetSufix ( ) const
inlineinherited
603{ return m_szSufix; }

References CIccTagNamedColor2::m_szSufix.

◆ 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 CIccTagNamedColor2::GetType ( ) const
inlinevirtualinherited

Function: GetType()

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

Reimplemented from CIccTag.

590{ return icSigNamedColor2Type; }
@ icSigNamedColor2Type
Definition icProfileHeader.h:551

References icSigNamedColor2Type.

Referenced by CIccTagNamedColor2::Write().

+ Here is the caller graph for this function:

◆ GetVendorFlags()

icUInt32Number CIccTagNamedColor2::GetVendorFlags ( ) const
inlineinherited

◆ InitFindCachedPCSColor()

bool CIccTagNamedColor2::InitFindCachedPCSColor ( )
inherited

Name: CIccTagNamedColor2::InitFindPCSColor

Purpose: Initialization needed for using FindPCSColor

Return: true if successfull, false if failure

3138{
3139 icFloatNumber *pXYZ, *pLab;
3140
3141 if (!m_NamedLab) {
3143 if (!m_NamedLab)
3144 return false;
3145
3146 if (m_csPCS != icSigLabData) {
3147 for (icUInt32Number i=0; i<m_nSize; i++) {
3148 pLab = m_NamedLab[i].lab;
3149 pXYZ = m_NamedColor[i].pcsCoords;
3150 icXyzFromPcs(pXYZ);
3151 icXYZtoLab(pLab, pXYZ);
3152 }
3153 }
3154 else {
3155 for (icUInt32Number i=0; i<m_nSize; i++) {
3156 pLab = m_NamedLab[i].lab;
3157 Lab2ToLab4(pLab, m_NamedColor[i].pcsCoords);
3158 icLabFromPcs(pLab);
3159 }
3160 }
3161 }
3162
3163 return true;
3164}
Definition IccTagBasic.h:570

References icLabFromPcs(), icSigLabData, icXyzFromPcs(), icXYZtoLab(), SIccNamedLabEntry::lab, CIccTagNamedColor2::Lab2ToLab4(), CIccTagNamedColor2::m_csPCS, CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_NamedLab, CIccTagNamedColor2::m_nSize, and SIccNamedColorEntry::pcsCoords.

Referenced by CIccTagNamedColor2::FindPCSColor().

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

◆ Lab2ToLab4()

void CIccTagNamedColor2::Lab2ToLab4 ( icFloatNumber Dst,
const icFloatNumber Src 
) const
inherited

Name: CIccTagNamedColor2::Lab2ToLab4

Purpose: Convert version 2 Lab to version 4 Lab

Args: Dst = array to store version 4 Lab coordinates, Src = array containing version 2 Lab coordinates

3419{
3420 Dst[0] = UnitClip((icFloatNumber)(Src[0] * 65535.0 / 65280.0));
3421 Dst[1] = UnitClip((icFloatNumber)(Src[1] * 65535.0 / 65280.0));
3422 Dst[2] = UnitClip((icFloatNumber)(Src[2] * 65535.0 / 65280.0));
3423}
icFloatNumber UnitClip(icFloatNumber v) const
Definition IccTagBasic.cpp:3374

References CIccTagNamedColor2::UnitClip().

Referenced by CIccTagNamedColor2::FindCachedPCSColor(), CIccTagNamedColor2::InitFindCachedPCSColor(), and ToXml().

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

◆ Lab4ToLab2()

void CIccTagNamedColor2::Lab4ToLab2 ( icFloatNumber Dst,
const icFloatNumber Src 
) const
inherited

Name: CIccTagNamedColor2::Lab4ToLab2

Purpose: Convert version 4 Lab to version 2 Lab

Args: Dst = array to store version 2 Lab coordinates, Src = array containing version 4 Lab coordinates

3438{
3439 Dst[0] = (icFloatNumber)(Src[0] * 65280.0 / 65535.0);
3440 Dst[1] = (icFloatNumber)(Src[1] * 65280.0 / 65535.0);
3441 Dst[2] = (icFloatNumber)(Src[2] * 65280.0 / 65535.0);
3442}

Referenced by ParseXml().

+ Here is the caller graph for this function:

◆ NegClip()

icFloatNumber CIccTagNamedColor2::NegClip ( icFloatNumber  v) const
inherited

Name: CIccTagNamedColor2::NegClip

Purpose: Negative numbers are clipped to zero

Args: v = number to be clipped

Return: Clipped number

3398{
3399 if (v<0)
3400 v=0;
3401
3402 return v;
3403}

◆ NewCopy()

virtual CIccTag * CIccTagNamedColor2::NewCopy ( ) const
inlinevirtualinherited

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.

587{return new CIccTagNamedColor2(*this);}
Definition IccTagBasic.h:582

References CIccTagNamedColor2::CIccTagNamedColor2().

+ Here is the call graph for this function:

◆ operator[]()

SIccNamedColorEntry & CIccTagNamedColor2::operator[] ( icUInt32Number  index) const
inlineinherited

◆ ParseXml()

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

Implements CIccTagXml.

722{
723 pNode = icXmlFindNode(pNode, "NamedColors");
724
725 if (pNode) {
726 const icChar *szVendorFlags = icXmlAttrValue(pNode, "VendorFlag");
727 const icChar *szDeviceCoords = icXmlAttrValue(pNode, "CountOfDeviceCoords");
728 const icChar *szDeviceEncoding = icXmlAttrValue(pNode, "DeviceEncoding");
729 const icChar *szPrefix = icXmlAttrValue(pNode, "Prefix");
730 const icChar *szSufix = icXmlAttrValue(pNode, "Suffix");
731
732 if (szVendorFlags && *szVendorFlags &&
733 szDeviceCoords && *szDeviceCoords &&
734 szDeviceEncoding && *szDeviceEncoding &&
735 szPrefix && szSufix) {
736 std::string str;
737
738 sscanf(szVendorFlags, "%x", &m_nVendorFlags);
739
740 strncpy(m_szPrefix, icUtf8ToAnsi(str, szPrefix), sizeof(m_szPrefix));
741 m_szPrefix[sizeof(m_szPrefix)-1] = '\0';
742
743 strncpy(m_szSufix, icUtf8ToAnsi(str, szSufix), sizeof(m_szSufix));
744 m_szSufix[sizeof(m_szSufix)-1] = '\0';
745
746 m_nDeviceCoords = atoi(szDeviceCoords);
747 icUInt32Number n = icXmlNodeCount3(pNode->children, "NamedColor", "LabNamedColor", "XYZNamedColor");
749
751
752 SIccNamedColorEntry *pNamedColor = m_NamedColor;
753
754 for (i=0, pNode=pNode->children; pNode; pNode=pNode->next) {
755 const icChar *szName = NULL;
756 if (pNode->type == XML_ELEMENT_NODE &&
757 !icXmlStrCmp(pNode->name, "NamedColor") &&
758 i<n) {
759 szName = icXmlAttrValue(pNode, "Name");
760 xmlAttr *L = icXmlFindAttr(pNode, "L");
761 xmlAttr *a = icXmlFindAttr(pNode, "a");
762 xmlAttr *b = icXmlFindAttr(pNode, "b");
763
764 if (L && a && b) {
765 pNamedColor->pcsCoords[0] = (icFloatNumber)atof(icXmlAttrValue(L));
766 pNamedColor->pcsCoords[1] = (icFloatNumber)atof(icXmlAttrValue(a));
767 pNamedColor->pcsCoords[2] = (icFloatNumber)atof(icXmlAttrValue(b));
768
769 icLabToPcs(pNamedColor->pcsCoords);
770 Lab4ToLab2(pNamedColor->pcsCoords, pNamedColor->pcsCoords);
771 }
772 else {
773 xmlAttr *x = icXmlFindAttr(pNode, "X");
774 xmlAttr *y = icXmlFindAttr(pNode, "Y");
775 xmlAttr *z = icXmlFindAttr(pNode, "Z");
776
777 if (x && y && z) {
778 pNamedColor->pcsCoords[0] = (icFloatNumber)atof(icXmlAttrValue(x));
779 pNamedColor->pcsCoords[1] = (icFloatNumber)atof(icXmlAttrValue(y));
780 pNamedColor->pcsCoords[2] = (icFloatNumber)atof(icXmlAttrValue(z));
781
782 icXyzToPcs(pNamedColor->pcsCoords);
783 }
784 else
785 return false;
786 }
787 }
788 else if (pNode->type == XML_ELEMENT_NODE &&
789 !icXmlStrCmp(pNode->name, "LabNamedColor") &&
790 i < n) {
791 szName = icXmlAttrValue(pNode, "Name");
792 xmlAttr *L = icXmlFindAttr(pNode, "L");
793 xmlAttr *a = icXmlFindAttr(pNode, "a");
794 xmlAttr *b = icXmlFindAttr(pNode, "b");
795
796 if (L && a && b) {
797 pNamedColor->pcsCoords[0] = (icFloatNumber)atof(icXmlAttrValue(L));
798 pNamedColor->pcsCoords[1] = (icFloatNumber)atof(icXmlAttrValue(a));
799 pNamedColor->pcsCoords[2] = (icFloatNumber)atof(icXmlAttrValue(b));
800
801 icLabToPcs(pNamedColor->pcsCoords);
802 Lab4ToLab2(pNamedColor->pcsCoords, pNamedColor->pcsCoords);
803 }
804 else {
805 return false;
806 }
807 }
808 else if (pNode->type == XML_ELEMENT_NODE &&
809 !icXmlStrCmp(pNode->name, "XYZNamedColor") &&
810 i < n) {
811 szName = icXmlAttrValue(pNode, "Name");
812 xmlAttr *x = icXmlFindAttr(pNode, "X");
813 xmlAttr *y = icXmlFindAttr(pNode, "Y");
814 xmlAttr *z = icXmlFindAttr(pNode, "Z");
815
816 if (x && y && z) {
817 pNamedColor->pcsCoords[0] = (icFloatNumber)atof(icXmlAttrValue(x));
818 pNamedColor->pcsCoords[1] = (icFloatNumber)atof(icXmlAttrValue(y));
819 pNamedColor->pcsCoords[2] = (icFloatNumber)atof(icXmlAttrValue(z));
820
821 icXyzToPcs(pNamedColor->pcsCoords);
822 }
823 else
824 return false;
825 }
826
827 if (szName) {
828 strncpy(pNamedColor->rootName, icUtf8ToAnsi(str, szName), sizeof(pNamedColor->rootName));
829 pNamedColor->rootName[sizeof(pNamedColor->rootName) - 1] = 0;
830
831 if (m_nDeviceCoords && pNode->children) {
832 if (!strcmp(szDeviceEncoding, "int8")) {
833 CIccUInt8Array coords;
834
835 coords.ParseArray(pNode->children);
836 icUInt8Number *pBuf = coords.GetBuf();
837
839 for (j = 0; j < m_nDeviceCoords && j < coords.GetSize(); j++) {
840 pNamedColor->deviceCoords[j] = (icFloatNumber)pBuf[i] / 255.0f;
841 }
842 }
843 else if (!strcmp(szDeviceEncoding, "int16")) {
844 CIccUInt16Array coords;
845
846 coords.ParseArray(pNode->children);
847 icUInt16Number *pBuf = coords.GetBuf();
848
850 for (j = 0; j < m_nDeviceCoords && j < coords.GetSize(); j++) {
851 pNamedColor->deviceCoords[j] = (icFloatNumber)pBuf[i] / 65535.0f;
852 }
853 }
854 else if (!strcmp(szDeviceEncoding, "float")) {
855 CIccFloatArray coords;
856
857 coords.ParseArray(pNode->children);
858 icFloatNumber *pBuf = coords.GetBuf();
859
861 for (j = 0; j < m_nDeviceCoords && j < coords.GetSize(); j++) {
862 pNamedColor->deviceCoords[j] = (icFloatNumber)pBuf[i];
863 }
864 }
865 else
866 return false;
867 }
868
869 i++;
870 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
871 }
872 }
873 return i==n;
874 }
875 }
876 return false;
877}
unsigned short icUInt16Number
Definition icProfileHeader.h:256
ICCPROFLIB_API void icXyzToPcs(icFloatNumber *XYZ)
Definition IccUtil.cpp:941
ICCPROFLIB_API void icLabToPcs(icFloatNumber *Lab)
Definition IccUtil.cpp:927
const char * icUtf8ToAnsi(std::string &buf, const char *szSrc)
Definition IccUtilXml.cpp:397
icUInt32Number icXmlNodeCount3(xmlNode *pNode, const char *szNodeName1, const char *szNodeName2, const char *szNodeName3)
Definition IccUtilXml.cpp:727
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
Definition IccUtilXml.cpp:669
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
void Lab4ToLab2(icFloatNumber *Dst, const icFloatNumber *Src) const
Definition IccTagBasic.cpp:3437
bool SetSize(icUInt32Number nSize, icInt32Number nDeviceCoords=-1)
Definition IccTagBasic.cpp:2795
Definition IccUtilXml.h:145
static bool ParseArray(T *buf, icUInt32Number nBufSize, xmlNode *pNode)
Definition IccUtilXml.cpp:1034
T * GetBuf()
Definition IccUtilXml.h:165
icUInt32Number GetSize()
Definition IccUtilXml.h:166

References SIccNamedColorEntry::deviceCoords, CIccXmlArrayType< T, Tsig >::GetBuf(), CIccXmlArrayType< T, Tsig >::GetSize(), icLabToPcs(), icUtf8ToAnsi(), icXmlAttrValue(), icXmlAttrValue(), icXmlFindAttr(), icXmlFindNode(), icXmlNodeCount3(), icXyzToPcs(), CIccTagNamedColor2::Lab4ToLab2(), CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTagNamedColor2::m_nDeviceCoords, CIccTagNamedColor2::m_nVendorFlags, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, CIccXmlArrayType< T, Tsig >::ParseArray(), SIccNamedColorEntry::pcsCoords, SIccNamedColorEntry::rootName, and CIccTagNamedColor2::SetSize().

+ Here is the call graph for this function:

◆ Read() [1/2]

bool CIccTagNamedColor2::Read ( icUInt32Number  size,
CIccIO pIO 
)
virtualinherited

Name: CIccTagNamedColor2::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.

2892{
2894 icUInt32Number nNum, nCoords;
2895
2896 icUInt32Number nTagHdrSize = sizeof(icTagTypeSignature) +
2897 sizeof(icUInt32Number) + //m_nReserved=0
2898 sizeof(icUInt32Number) + //VendorFlags
2899 sizeof(icUInt32Number) + //Num Colors
2900 sizeof(icUInt32Number) + //Num Device Coords
2901 sizeof(m_szPrefix) +
2902 sizeof(m_szSufix);
2903 if (nTagHdrSize > size)
2904 return false;
2905
2906 if (!pIO) {
2907 return false;
2908 }
2909
2910 if (!pIO->Read32(&sig) ||
2911 !pIO->Read32(&m_nReserved) ||
2912 !pIO->Read32(&m_nVendorFlags) ||
2913 !pIO->Read32(&nNum) ||
2914 !pIO->Read32(&nCoords) ||
2915 pIO->Read8(m_szPrefix, sizeof(m_szPrefix))!=sizeof(m_szPrefix) ||
2916 pIO->Read8(m_szSufix, sizeof(m_szSufix))!=sizeof(m_szSufix)) {
2917 return false;
2918 }
2919
2920 size -= nTagHdrSize;
2921
2922 icUInt32Number nCount = size / (32+(3+nCoords)*sizeof(icUInt16Number));
2923
2924 if (nCount < nNum)
2925 return false;
2926
2927 if (!SetSize(nNum, nCoords))
2928 return false;
2929
2931 SIccNamedColorEntry *pNamedColor=m_NamedColor;
2932
2933 for (i=0; i<nNum; i++) {
2934 if (pIO->Read8(&pNamedColor->rootName, sizeof(pNamedColor->rootName))!=sizeof(pNamedColor->rootName) ||
2935 pIO->ReadUInt16Float(&pNamedColor->pcsCoords, 3)!=3)
2936 return false;
2937 if (nCoords) {
2938 if (pIO->ReadUInt16Float(&pNamedColor->deviceCoords, nCoords)!=(icInt32Number)nCoords)
2939 return false;
2940 }
2941 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
2942 }
2943
2944 return true;
2945}
icTagTypeSignature
Definition icProfileHeader.h:526
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
icInt32Number ReadUInt16Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:236
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235

References SIccNamedColorEntry::deviceCoords, CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTag::m_nReserved, CIccTagNamedColor2::m_nVendorFlags, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, SIccNamedColorEntry::pcsCoords, CIccIO::Read32(), CIccIO::Read8(), CIccIO::ReadUInt16Float(), SIccNamedColorEntry::rootName, and CIccTagNamedColor2::SetSize().

+ 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; }

◆ ResetPCSCache()

void CIccTagNamedColor2::ResetPCSCache ( )
inherited

Call ResetPCSCache() if entry values change between calls to FindPCSColor()

Name: CIccTagNamedColor2::ResetPCSCache

Purpose: This function is called if entry values change between calls to FindPCSColor()

3120{
3121 if (m_NamedLab) {
3122 delete [] m_NamedLab;
3123 m_NamedLab = NULL;
3124 }
3125}

References CIccTagNamedColor2::m_NamedLab.

Referenced by CIccTagNamedColor2::SetSize().

+ Here is the caller graph for this function:

◆ SetColorSpaces()

void CIccTagNamedColor2::SetColorSpaces ( icColorSpaceSignature  csPCS,
icColorSpaceSignature  csDevice 
)
virtualinherited

Name: CIccTagNamedColor2::SetColorSpaces

Purpose: Set the device and PCS color space of the tag

Args: csPCS = PCS color space signature, csDevice = Device color space signature

3082{
3083 m_csPCS = csPCS;
3084 m_csDevice = csDevice;
3085}

References CIccTagNamedColor2::m_csDevice, and CIccTagNamedColor2::m_csPCS.

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ SetPrefix()

void CIccTagNamedColor2::SetPrefix ( const icChar szPrefix)
inherited

Name: CIccTagNamedColor2::SetPrefix

Purpose: Set contents of suffix member field

Args: szPrefix - string to set prefix to

2854{
2855 strncpy(m_szPrefix, szPrefix, sizeof(m_szPrefix));
2856 m_szPrefix[sizeof(m_szPrefix)-1]='\0';
2857}

References CIccTagNamedColor2::m_szPrefix.

◆ SetSize()

bool CIccTagNamedColor2::SetSize ( icUInt32Number  nSize,
icInt32Number  nDeviceCoords = -1 
)
inherited

Name: CIccTagNamedColor2::SetSize

Purpose: Sets the size of the named color array.

Args: nSize - number of named color entries, nDeviceCoords - number of device channels

2796{
2797 if (nSize <1)
2798 nSize = 1;
2799 if (nDeviceCoords<0)
2800 nDeviceCoords = m_nDeviceCoords;
2801
2802 icInt32Number nNewCoords=nDeviceCoords;
2803
2804 if (nDeviceCoords>0)
2805 nDeviceCoords--;
2806
2807 icUInt32Number nColorEntrySize = 32/*rootName*/ + (3/*PCS*/ + 1/*iAny*/ + nDeviceCoords)*sizeof(icFloatNumber);
2808
2809 SIccNamedColorEntry* pNamedColor = (SIccNamedColorEntry*)calloc(nSize, nColorEntrySize);
2810
2811 if (!pNamedColor)
2812 return false;
2813
2814 icUInt32Number i, nCopy = __min(nSize, m_nSize);
2815 icUInt32Number j, nCoords = __min(nNewCoords, (icInt32Number)m_nDeviceCoords);
2816
2817 for (i=0; i<nCopy; i++) {
2819 SIccNamedColorEntry *pTo = (SIccNamedColorEntry*)((icChar*)pNamedColor + i*nColorEntrySize);
2820
2821 strcpy(pTo->rootName, pFrom->rootName);
2822 for (j=0; j<3; j++)
2823 pTo->pcsCoords[j] = pFrom->pcsCoords[j];
2824
2825 for (j=0; j<nCoords; j++) {
2826 pTo->deviceCoords[j] = pFrom->deviceCoords[j];
2827 }
2828 }
2829 free(m_NamedColor);
2830
2831 m_nColorEntrySize = nColorEntrySize;
2832
2833 m_NamedColor = pNamedColor;
2834 m_nSize = nSize;
2835 m_nDeviceCoords = nNewCoords;
2836
2837 ResetPCSCache();
2838
2839 return true;
2840}
#define __min
Definition IccArrayBasic.cpp:87
void ResetPCSCache()
Call ResetPCSCache() if entry values change between calls to FindPCSColor()
Definition IccTagBasic.cpp:3119

References SIccNamedColorEntry::deviceCoords, CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTagNamedColor2::m_nDeviceCoords, CIccTagNamedColor2::m_nSize, SIccNamedColorEntry::pcsCoords, CIccTagNamedColor2::ResetPCSCache(), and SIccNamedColorEntry::rootName.

Referenced by ParseXml(), and CIccTagNamedColor2::Read().

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

◆ SetSufix()

void CIccTagNamedColor2::SetSufix ( const icChar szSufix)
inherited

Name: CIccTagNamedColor2::SetSufix

Purpose: Set contents of suffix member field

Args: szPrefix - string to set prefix to

2871{
2872 strncpy(m_szSufix, szSufix, sizeof(m_szSufix));
2873 m_szSufix[sizeof(m_szSufix)-1]='\0';
2874}

References CIccTagNamedColor2::m_szSufix.

◆ SetVendorFlags()

void CIccTagNamedColor2::SetVendorFlags ( icUInt32Number  nVendorFlags)
inlineinherited
607{m_nVendorFlags = nVendorFlags;}

References CIccTagNamedColor2::m_nVendorFlags.

◆ ToXml()

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

Implements CIccTagXml.

656{
657 char fix[256];
658 char line[256];
659 char buf[256];
660 int i, j;
661 std::string str;
662
663 sprintf(line, "<NamedColors VendorFlag=\"%08x\" CountOfDeviceCoords=\"%d\" DeviceEncoding=\"int16\"", m_nVendorFlags, m_nDeviceCoords);
664 xml += blanks + line;
665
666 sprintf(line, " Prefix=\"%s\"", icFixXml(fix, icAnsiToUtf8(str, m_szPrefix)));
667 xml += line;
668
669 sprintf(line, " Suffix=\"%s\">\n", icFixXml(fix, icAnsiToUtf8(str, m_szSufix)));
670 xml += line;
671
672 for (i=0; i<(int)m_nSize; i++) {
673 SIccNamedColorEntry *pEntry= GetEntry(i);
674
675 const char *szNodeName = "";
676
677 if (pEntry) {
678 if (m_csPCS==icSigLabData) {
679 icFloatNumber lab[3];
680
681 Lab2ToLab4(lab, pEntry->pcsCoords);
682 icLabFromPcs(lab);
683 szNodeName = "LabNamedColor";
684 sprintf(line, " <%s Name=\"%s\" L=\"" icXmlFloatFmt "\" a=\"" icXmlFloatFmt "\" b=\"" icXmlFloatFmt "\"", szNodeName,
685 icFixXml(fix, icAnsiToUtf8(str, pEntry->rootName)), lab[0], lab[1], lab[2]);
686 xml += blanks + line;
687 }
688 else {
689 icFloatNumber xyz[3];
690
691 memcpy(xyz, pEntry->pcsCoords, 3*sizeof(icFloatNumber));
692 icXyzFromPcs(xyz);
693 szNodeName = "XYZNamedColor";
694 sprintf(line, " <%s Name=\"%s\" X=\"" icXmlFloatFmt "\" Y=\"" icXmlFloatFmt "\" Z=\"" icXmlFloatFmt "\"", szNodeName,
695 icFixXml(fix, icAnsiToUtf8(str, pEntry->rootName)), xyz[0], xyz[1], xyz[2]);
696 xml += blanks + line;
697 }
698
699 if (!m_nDeviceCoords) {
700 xml += "/>\n";
701 }
702 else {
703 xml += ">";
704 for (j=0; j<(int)m_nDeviceCoords; j++) {
705 if (j)
706 xml+=" ";
707 sprintf(buf, "%d", (int)(pEntry->deviceCoords[j] * 65535.0 + 0.5));
708 xml += buf;
709 }
710 xml += "\n";
711
712 xml += blanks + " </" + szNodeName + ">\n";
713 }
714 }
715 }
716 xml += blanks + " </NamedColors>\n";
717 return true;
718}
#define icXmlFloatFmt
Definition IccXmlConfig.h:75
const char * icFixXml(char *szDest, const char *szStr)
Definition IccUtilXml.cpp:305
const char * icAnsiToUtf8(std::string &buf, const char *szSrc)
Definition IccUtilXml.cpp:372
SIccNamedColorEntry * GetEntry(icUInt32Number index) const
Definition IccTagBasic.h:626

References SIccNamedColorEntry::deviceCoords, CIccTagNamedColor2::GetEntry(), icAnsiToUtf8(), icFixXml(), icLabFromPcs(), icSigLabData, icXyzFromPcs(), CIccTagNamedColor2::Lab2ToLab4(), CIccTagNamedColor2::m_csPCS, CIccTagNamedColor2::m_nDeviceCoords, CIccTagNamedColor2::m_nSize, CIccTagNamedColor2::m_nVendorFlags, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, SIccNamedColorEntry::pcsCoords, and SIccNamedColorEntry::rootName.

+ Here is the call graph for this function:

◆ UnitClip()

icFloatNumber CIccTagNamedColor2::UnitClip ( icFloatNumber  v) const
inherited

Name: CIccTagNamedColor2::UnitClip

Purpose: Clip number so that its between 0-1

Args: v = number to be clipped

Return: Clipped number

3375{
3376 if (v<0)
3377 v = 0;
3378 if (v>1.0)
3379 v = 1.0;
3380
3381 return v;
3382}

Referenced by CIccTagNamedColor2::Lab2ToLab4().

+ Here is the caller graph for this function:

◆ UseLegacyPCS()

virtual bool CIccTagNamedColor2::UseLegacyPCS ( ) const
inlinevirtualinherited
593{ return true; } //Treat Lab Encoding differently?

◆ Validate()

icValidateStatus CIccTagNamedColor2::Validate ( std::string  sigPath,
std::string &  sReport,
const CIccProfile pProfile = NULL 
) const
virtualinherited

Name: CIccTagNamedColor2::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.

3460{
3461 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
3462
3463 CIccInfo Info;
3464 std::string sSigPathName = Info.GetSigPathName(sigPath);
3465
3466 if (!m_nSize) {
3467 sReport += icMsgValidateWarning;
3468 sReport += sSigPathName;
3469 sReport += " - Empty tag!\n";
3471 }
3472
3473 if (m_nDeviceCoords) {
3474 if (pProfile) {
3475 icUInt32Number nCoords = icGetSpaceSamples(pProfile->m_Header.colorSpace);
3476 if (m_nDeviceCoords != nCoords) {
3477 sReport += icMsgValidateNonCompliant;
3478 sReport += sSigPathName;
3479 sReport += " - Incorrect number of device co-ordinates.\n";
3481 }
3482 }
3483 else {
3484 sReport += icMsgValidateWarning;
3485 sReport += sSigPathName;
3486 sReport += " - Tag validation incomplete: Pointer to profile unavailable.\n";
3488 }
3489 }
3490
3491
3492 return rv;
3493}
icValidateStatus
Definition IccDefs.h:119
@ icValidateWarning
Definition IccDefs.h:121
@ icValidateNonCompliant
Definition IccDefs.h:122
ICCPROFLIB_API icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
ICCPROFLIB_API const char * icMsgValidateWarning
Definition IccUtil.cpp:90
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
ICCPROFLIB_API const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
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
Definition IccTagBasic.cpp:164

References icHeader::colorSpace, CIccInfo::GetSigPathName(), icGetSpaceSamples(), icMaxStatus(), icMsgValidateNonCompliant, icMsgValidateWarning, icValidateNonCompliant, icValidateWarning, CIccTagNamedColor2::m_nDeviceCoords, CIccTagNamedColor2::m_nSize, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagNamedColor2::Write ( CIccIO pIO)
virtualinherited

Name: CIccTagNamedColor2::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.

2962{
2964
2965 if (!pIO)
2966 return false;
2967
2968 if (!pIO->Write32(&sig))
2969 return false;
2970
2971 if (!pIO->Write32(&m_nReserved))
2972 return false;
2973
2974 if (!pIO->Write32(&m_nVendorFlags))
2975 return false;
2976
2977 if (!pIO->Write32(&m_nSize))
2978 return false;
2979
2980 if (!pIO->Write32(&m_nDeviceCoords))
2981 return false;
2982
2983 if (!pIO->Write8(m_szPrefix, sizeof(m_szPrefix)))
2984 return false;
2985
2986 if (!pIO->Write8(m_szSufix, sizeof(m_szSufix)))
2987 return false;
2988
2990 SIccNamedColorEntry *pNamedColor=m_NamedColor;
2991
2992 for (i=0; i<m_nSize; i++) {
2993 if (pIO->Write8(&pNamedColor->rootName, sizeof(pNamedColor->rootName))!=sizeof(pNamedColor->rootName) ||
2994 pIO->WriteUInt16Float(&pNamedColor->pcsCoords, 3)!=3)
2995 return false;
2996 if (m_nDeviceCoords) {
2998 return false;
2999 }
3000 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
3001 }
3002
3003 return true;
3004}
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number WriteUInt16Float(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:252
virtual icTagTypeSignature GetType() const
Definition IccTagBasic.h:590

References SIccNamedColorEntry::deviceCoords, CIccTagNamedColor2::GetType(), CIccTagNamedColor2::m_NamedColor, CIccTagNamedColor2::m_nColorEntrySize, CIccTagNamedColor2::m_nDeviceCoords, CIccTag::m_nReserved, CIccTagNamedColor2::m_nSize, CIccTagNamedColor2::m_nVendorFlags, CIccTagNamedColor2::m_szPrefix, CIccTagNamedColor2::m_szSufix, SIccNamedColorEntry::pcsCoords, SIccNamedColorEntry::rootName, CIccIO::Write32(), CIccIO::Write8(), and CIccIO::WriteUInt16Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_csDevice

◆ m_csPCS

◆ m_NamedColor

◆ m_NamedLab

◆ m_nColorEntrySize

◆ m_nDeviceCoords

◆ 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(), CIccTagSpectralViewingConditions::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(), CIccTagSpectralViewingConditions::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_nSize

◆ m_nVendorFlags

◆ m_szPrefix

◆ m_szSufix


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