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

Class: CIccTagNamedColor2. More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagNamedColor2:
+ Collaboration diagram for CIccTagNamedColor2:

Public Member Functions

 CIccTagNamedColor2 (const CIccTagNamedColor2 &ITNC)
 Name: CIccTagNamedColor2::CIccTagNamedColor2.
 
 CIccTagNamedColor2 (int nSize=1, int nDeviceCoords=0)
 Name: CIccTagNamedColor2::CIccTagNamedColor2.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagNamedColor2::Describe.
 
icInt32Number FindCachedPCSColor (icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0) const
 Name: CIccTagNamedColor2::FindPCSColor.
 
icInt32Number FindColor (const icChar *szColor) const
 Name: CIccTagNamedColor2::FindColor.
 
icInt32Number FindDeviceColor (icFloatNumber *pDevColor) const
 Name: CIccTagNamedColor2::FindDeviceColor.
 
icInt32Number FindPCSColor (icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0)
 Name: CIccTagNamedColor2::FindPCSColor.
 
icInt32Number FindRootColor (const icChar *szRootColor) const
 Name: CIccTagNamedColor2::FindRootColor.
 
virtual const icCharGetClassName () const
 
bool GetColorName (std::string &sColorName, icInt32Number index) const
 Name: CIccTagNamedColor2::GetColorName.
 
icUInt32Number GetDeviceCoords () const
 
icColorSpaceSignature GetDeviceSpace () const
 
SIccNamedColorEntryGetEntry (icUInt32Number index) const
 
icColorSpaceSignature GetPCS () const
 
const icCharGetPrefix () const
 
icUInt32Number GetSize () const
 
const icCharGetSufix () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
icUInt32Number GetVendorFlags () const
 
bool InitFindCachedPCSColor ()
 Name: CIccTagNamedColor2::InitFindPCSColor.
 
void Lab2ToLab4 (icFloatNumber *Dst, const icFloatNumber *Src) const
 Name: CIccTagNamedColor2::Lab2ToLab4.
 
void Lab4ToLab2 (icFloatNumber *Dst, const icFloatNumber *Src) const
 Name: CIccTagNamedColor2::Lab4ToLab2.
 
icFloatNumber NegClip (icFloatNumber v) const
 Name: CIccTagNamedColor2::NegClip.
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagNamedColor2operator= (const CIccTagNamedColor2 &NamedColor2Tag)
 Name: CIccTagNamedColor2::operator=.
 
SIccNamedColorEntryoperator[] (icUInt32Number index) const
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagNamedColor2::Read.
 
void ResetPCSCache ()
 Call ResetPCSCache() if entry values change between calls to FindPCSColor()
 
virtual void SetColorSpaces (icColorSpaceSignature csPCS, icColorSpaceSignature csDevice)
 Name: CIccTagNamedColor2::SetColorSpaces.
 
void SetPrefix (const icChar *szPrefix)
 Name: CIccTagNamedColor2::SetPrefix.
 
bool SetSize (icUInt32Number nSize, icInt32Number nDeviceCoords=-1)
 Name: CIccTagNamedColor2::SetSize.
 
void SetSufix (const icChar *szSufix)
 Name: CIccTagNamedColor2::SetSufix.
 
void SetVendorFlags (icUInt32Number nVendorFlags)
 
icFloatNumber UnitClip (icFloatNumber v) const
 Name: CIccTagNamedColor2::UnitClip.
 
virtual bool UseLegacyPCS () const
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagNamedColor2::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagNamedColor2::Write.
 
virtual ~CIccTagNamedColor2 ()
 Name: CIccTagNamedColor2::~CIccTagNamedColor2.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual IIccExtensionTagGetExtension ()
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 

Protected Attributes

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]
 

Additional Inherited Members

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

Detailed Description

Class: CIccTagNamedColor2.

Purpose: the NamedColor2 tag - an array of Named Colors

Definition at line 581 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagNamedColor2() [1/2]

CIccTagNamedColor2::CIccTagNamedColor2 ( int nSize = 1,
int nDeviceCoords = 0 )

Name: CIccTagNamedColor2::CIccTagNamedColor2.

Purpose: Constructor

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

Definition at line 2660 of file IccTagBasic.cpp.

2661{
2662 m_nSize = nSize <1 ? 1 : nSize;
2663 m_nVendorFlags = 0;
2664 m_nDeviceCoords = nDeviceCoords;
2665 if (nDeviceCoords<0)
2666 m_nDeviceCoords = nDeviceCoords = 0;
2667
2668 if (nDeviceCoords>0)
2669 nDeviceCoords--;
2670
2671 m_szPrefix[0] = '\0';
2672 m_szSufix[0] = '\0';
2675
2676 m_nColorEntrySize = 32/*rootName*/ + (3/*PCS*/ + 1/*iAny*/ + nDeviceCoords)*sizeof(icFloatNumber);
2677
2679
2680 m_NamedLab = NULL;
2681}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
SIccNamedColorEntry * m_NamedColor
icColorSpaceSignature m_csPCS
icUInt32Number m_nVendorFlags
icUInt32Number m_nSize
SIccNamedLabEntry * m_NamedLab
icChar m_szSufix[32]
icUInt32Number m_nColorEntrySize
For quick response of repeated FindPCSColor.
icUInt32Number m_nDeviceCoords
icChar m_szPrefix[32]
icColorSpaceSignature m_csDevice
#define icSigUnknownData

References icSigUnknownData.

◆ CIccTagNamedColor2() [2/2]

CIccTagNamedColor2::CIccTagNamedColor2 ( const CIccTagNamedColor2 & ITNC)

Name: CIccTagNamedColor2::CIccTagNamedColor2.

Purpose: Copy Constructor

Args: ITNC = The CIccTagNamedColor2 object to be copied

Definition at line 2694 of file IccTagBasic.cpp.

2695{
2699 m_nSize = ITNC.m_nSize;
2700
2701 m_csPCS = ITNC.m_csPCS;
2702 m_csDevice = ITNC.m_csDevice;
2703
2704 memcpy(m_szPrefix, ITNC.m_szPrefix, sizeof(m_szPrefix));
2705 memcpy(m_szSufix, ITNC.m_szSufix, sizeof(m_szSufix));
2706
2709
2710 m_NamedLab = NULL;
2711}

References m_csDevice, m_csPCS, m_NamedColor, m_nColorEntrySize, m_nDeviceCoords, m_nSize, m_nVendorFlags, m_szPrefix, and m_szSufix.

◆ ~CIccTagNamedColor2()

CIccTagNamedColor2::~CIccTagNamedColor2 ( )
virtual

Name: CIccTagNamedColor2::~CIccTagNamedColor2.

Purpose: Destructor

Definition at line 2759 of file IccTagBasic.cpp.

2760{
2761 if (m_NamedColor)
2762 free(m_NamedColor);
2763
2764 if (m_NamedLab)
2765 delete [] m_NamedLab;
2766}

Member Function Documentation

◆ Describe()

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

Name: CIccTagNamedColor2::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 3001 of file IccTagBasic.cpp.

3002{
3003 icChar buf[128], szColorVal[40], szColor[40];
3004
3005 icUInt32Number i, j;
3006 SIccNamedColorEntry *pNamedColor=m_NamedColor;
3007
3008 sDescription.reserve(sDescription.size() + m_nSize*79);
3009
3010 sprintf(buf, "BEGIN_NAMED_COLORS flags=%08x %u %u\n", m_nVendorFlags, m_nSize, m_nDeviceCoords);
3011 sDescription += buf;
3012
3013 sprintf(buf, "Prefix=\"%s\"\n", m_szPrefix);
3014 sDescription += buf;
3015
3016 sprintf(buf, "Sufix= \"%s\"\n", m_szSufix);
3017 sDescription += buf;
3018
3019 for (i=0; i<m_nSize; i++) {
3020 sprintf(buf, "Color[%u]: %s :", i, pNamedColor->rootName);
3021 sDescription += buf;
3022
3023 icFloatNumber pcsCoord[3] ={0};
3024 for (j=0; j<3; j++)
3025 pcsCoord[j] = pNamedColor->pcsCoords[j];
3026
3027 if (m_csPCS==icSigLabData) {
3028 for (j=0; j<3; j++)
3029 pcsCoord[j] = (icFloatNumber)(pcsCoord[j] * 65535.0 / 65280.0);
3030 }
3031
3032 for (j=0; j<3; j++) {
3033 icColorIndexName(szColor, m_csPCS, j, 3, "P");
3034 icColorValue(szColorVal, pcsCoord[j], m_csPCS, j);
3035 sprintf(buf, " %s=%s", szColor, szColorVal);
3036 sDescription += buf;
3037 }
3038 if (m_nDeviceCoords) {
3039 sDescription += " :";
3040 for (j=0; j<m_nDeviceCoords; j++) {
3041 icColorIndexName(szColor, m_csDevice, j, m_nDeviceCoords, "D");
3042 icColorValue(szColorVal, pNamedColor->deviceCoords[j], m_csDevice, j);
3043 sprintf(buf, " %s=%s", szColor, szColorVal);
3044 sDescription += buf;
3045 }
3046 }
3047 sDescription += "\n";
3048
3049 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
3050 }
3051}
char icChar
Definition IccDefs.h:109
void icColorValue(icChar *szValue, icFloatNumber nValue, icColorSpaceSignature csSig, int nIndex, bool bUseLegacy)
Definition IccUtil.cpp:330
void icColorIndexName(icChar *szName, icColorSpaceSignature csSig, int nIndex, int nColors, const icChar *szUnknown)
Definition IccUtil.cpp:295
unsigned int icUInt32Number
@ icSigLabData
icChar rootName[32]
icFloatNumber deviceCoords[1]
icFloatNumber pcsCoords[3]

References SIccNamedColorEntry::deviceCoords, icColorIndexName(), icColorValue(), icSigLabData, SIccNamedColorEntry::pcsCoords, and SIccNamedColorEntry::rootName.

+ Here is the call graph for this function:

◆ FindCachedPCSColor()

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

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

Definition at line 3164 of file IccTagBasic.cpp.

3165{
3166 icFloatNumber dCalcDE, dLeastDE=0.0;
3167 icFloatNumber pLabIn[3];
3168 icFloatNumber *pXYZ, *pLab;
3169 icInt32Number leastDEindex = -1;
3170 if (m_csPCS != icSigLabData) {
3171 pXYZ = pPCS;
3172 icXyzFromPcs(pXYZ);
3173 icXYZtoLab(pLabIn,pXYZ);
3174 }
3175 else {
3176 Lab2ToLab4(pLabIn, pPCS);
3177 icLabFromPcs(pLabIn);
3178 }
3179
3180 if (!m_NamedLab)
3181 return -1;
3182
3183 for (icUInt32Number i=0; i<m_nSize; i++) {
3184 pLab = m_NamedLab[i].lab;
3185
3186 dCalcDE = icDeltaE(pLabIn, pLab);
3187
3188 if (i==0) {
3189 dLeastDE = dCalcDE;
3190 leastDEindex = i;
3191 }
3192
3193 if (dCalcDE<dMinDE) {
3194 if (dCalcDE<dLeastDE) {
3195 dLeastDE = dCalcDE;
3196 leastDEindex = i;
3197 }
3198 }
3199 }
3200
3201 return leastDEindex;
3202}
void icXyzFromPcs(icFloatNumber *XYZ)
Floating point encoding of XYZ in PCS is in range 0.0 to 1.0 (Note: X=1.0 is encoded as about 0....
Definition IccUtil.cpp:934
void icLabFromPcs(icFloatNumber *Lab)
Floating point encoding of Lab in PCS is in range 0.0 to 1.0.
Definition IccUtil.cpp:919
icFloatNumber icDeltaE(const icFloatNumber *lab1, const icFloatNumber *lab2)
Definition IccUtil.cpp:527
void icXYZtoLab(icFloatNumber *Lab, const icFloatNumber *XYZ, const icFloatNumber *WhiteXYZ)
Definition IccUtil.cpp:846
void Lab2ToLab4(icFloatNumber *Dst, const icFloatNumber *Src) const
Name: CIccTagNamedColor2::Lab2ToLab4.
long icInt32Number
icFloatNumber lab[3]

References icDeltaE(), icLabFromPcs(), icSigLabData, icXyzFromPcs(), and icXYZtoLab().

+ Here is the call graph for this function:

◆ FindColor()

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

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

Definition at line 3239 of file IccTagBasic.cpp.

3240{
3241 std::string sColorName;
3242 icInt32Number i, j;
3243
3244 j = (icInt32Number)strlen(m_szPrefix);
3245 if (j != 0) {
3246 if (strncmp(szColor, m_szPrefix, j))
3247 return -1;
3248 }
3249
3250 j = (icInt32Number)strlen(m_szSufix);
3251 i = (icInt32Number)strlen(szColor);
3252 if (j != 0) {
3253 if (strncmp(szColor+(i-j), m_szSufix, j))
3254 return -1;
3255 }
3256
3257
3258 for ( i=0; i<(icInt32Number)m_nSize; i++) {
3259 sColorName = m_szPrefix;
3260 sColorName += m_NamedColor[i].rootName;
3261 sColorName += m_szSufix;
3262
3263 if (strcmp(sColorName.c_str(),szColor) == 0)
3264 return i;
3265 }
3266
3267 return -1;
3268}

◆ FindDeviceColor()

icInt32Number CIccTagNamedColor2::FindDeviceColor ( icFloatNumber * pDevColor) const

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.

Definition at line 3283 of file IccTagBasic.cpp.

3284{
3285 if (!m_nDeviceCoords)
3286 return -1;
3287
3288 icFloatNumber dCalcDiff=0.0, dLeastDiff=0.0;
3289 icFloatNumber *pDevOut;
3290 icInt32Number leastDiffindex = -1;
3291
3292
3293 for (icUInt32Number i=0; i<m_nSize; i++) {
3294 pDevOut = m_NamedColor[i].deviceCoords;
3295
3296 for (icUInt32Number j=0; j<m_nDeviceCoords; j++) {
3297 dCalcDiff += (pDevColor[j]-pDevOut[j])*(pDevColor[j]-pDevOut[j]);
3298 }
3299 dCalcDiff = (icFloatNumber)sqrt(dCalcDiff);
3300
3301 if (i==0) {
3302 dLeastDiff = dCalcDiff;
3303 leastDiffindex = i;
3304 }
3305
3306 if (dCalcDiff<dLeastDiff) {
3307 dLeastDiff = dCalcDiff;
3308 leastDiffindex = i;
3309 }
3310
3311 dCalcDiff = 0.0;
3312 }
3313
3314 return leastDiffindex;
3315}

◆ FindPCSColor()

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

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

Definition at line 3218 of file IccTagBasic.cpp.

3219{
3220 if (!m_NamedLab)
3222
3223 return FindCachedPCSColor(pPCS, dMinDE);
3224}
bool InitFindCachedPCSColor()
Name: CIccTagNamedColor2::InitFindPCSColor.
icInt32Number FindCachedPCSColor(icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0) const
Name: CIccTagNamedColor2::FindPCSColor.

◆ FindRootColor()

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

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

Definition at line 3084 of file IccTagBasic.cpp.

3085{
3086 for (icUInt32Number i=0; i<m_nSize; i++) {
3087 if (stricmp(m_NamedColor[i].rootName,szRootColor) == 0)
3088 return i;
3089 }
3090
3091 return -1;
3092}
#define stricmp

References stricmp.

Referenced by CMConvertColorNameToIndex().

+ Here is the caller graph for this function:

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlNamedColor2.

Definition at line 591 of file IccTagBasic.h.

591{ return "CIccTagNamedColor2"; }

◆ GetColorName()

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

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

Definition at line 3332 of file IccTagBasic.cpp.

3333{
3334 if (index > (icInt32Number)m_nSize-1)
3335 return false;
3336
3337 sColorName += m_szPrefix;
3339 sColorName += pNamedColor->rootName;
3340 sColorName += m_szSufix;
3341
3342 return true;
3343}

References SIccNamedColorEntry::rootName.

◆ GetDeviceCoords()

icUInt32Number CIccTagNamedColor2::GetDeviceCoords ( ) const
inline

Definition at line 629 of file IccTagBasic.h.

629{return m_nDeviceCoords;}

Referenced by CMGetNamedProfileInfo().

+ Here is the caller graph for this function:

◆ GetDeviceSpace()

icColorSpaceSignature CIccTagNamedColor2::GetDeviceSpace ( ) const
inline

Definition at line 634 of file IccTagBasic.h.

634{return m_csDevice;}

◆ GetEntry()

SIccNamedColorEntry * CIccTagNamedColor2::GetEntry ( icUInt32Number index) const
inline

Definition at line 626 of file IccTagBasic.h.

unsigned char icUInt8Number
Number definitions.

Referenced by CMConvertIndexToColorName().

+ Here is the caller graph for this function:

◆ GetPCS()

icColorSpaceSignature CIccTagNamedColor2::GetPCS ( ) const
inline

Definition at line 633 of file IccTagBasic.h.

633{return m_csPCS;}

◆ GetPrefix()

const icChar * CIccTagNamedColor2::GetPrefix ( ) const
inline

Definition at line 600 of file IccTagBasic.h.

600{ return m_szPrefix; }

Referenced by CMGetNamedProfileInfo().

+ Here is the caller graph for this function:

◆ GetSize()

icUInt32Number CIccTagNamedColor2::GetSize ( ) const
inline

Definition at line 628 of file IccTagBasic.h.

628{ return m_nSize; }

Referenced by CMConvertIndexToColorName(), and CMGetNamedProfileInfo().

+ Here is the caller graph for this function:

◆ GetSufix()

const icChar * CIccTagNamedColor2::GetSufix ( ) const
inline

Definition at line 603 of file IccTagBasic.h.

603{ return m_szSufix; }

Referenced by CMGetNamedProfileInfo().

+ Here is the caller graph for this function:

◆ GetType()

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

590{ return icSigNamedColor2Type; }
@ icSigNamedColor2Type

References icSigNamedColor2Type.

◆ GetVendorFlags()

icUInt32Number CIccTagNamedColor2::GetVendorFlags ( ) const
inline

Definition at line 606 of file IccTagBasic.h.

606{ return m_nVendorFlags; }

Referenced by CMGetNamedProfileInfo().

+ Here is the caller graph for this function:

◆ InitFindCachedPCSColor()

bool CIccTagNamedColor2::InitFindCachedPCSColor ( )

Name: CIccTagNamedColor2::InitFindPCSColor.

Purpose: Initialization needed for using FindPCSColor

Return: true if successfull, false if failure

Definition at line 3121 of file IccTagBasic.cpp.

3122{
3123 icFloatNumber *pXYZ, *pLab;
3124
3125 if (!m_NamedLab) {
3127 if (!m_NamedLab)
3128 return false;
3129
3130 if (m_csPCS != icSigLabData) {
3131 for (icUInt32Number i=0; i<m_nSize; i++) {
3132 pLab = m_NamedLab[i].lab;
3133 pXYZ = m_NamedColor[i].pcsCoords;
3134 icXyzFromPcs(pXYZ);
3135 icXYZtoLab(pLab, pXYZ);
3136 }
3137 }
3138 else {
3139 for (icUInt32Number i=0; i<m_nSize; i++) {
3140 pLab = m_NamedLab[i].lab;
3141 Lab2ToLab4(pLab, m_NamedColor[i].pcsCoords);
3142 icLabFromPcs(pLab);
3143 }
3144 }
3145 }
3146
3147 return true;
3148}

References icLabFromPcs(), icSigLabData, icXyzFromPcs(), icXYZtoLab(), and SIccNamedLabEntry::lab.

+ Here is the call graph for this function:

◆ Lab2ToLab4()

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

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

Definition at line 3402 of file IccTagBasic.cpp.

3403{
3404 Dst[0] = UnitClip((icFloatNumber)(Src[0] * 65535.0 / 65280.0));
3405 Dst[1] = UnitClip((icFloatNumber)(Src[1] * 65535.0 / 65280.0));
3406 Dst[2] = UnitClip((icFloatNumber)(Src[2] * 65535.0 / 65280.0));
3407}
icFloatNumber UnitClip(icFloatNumber v) const
Name: CIccTagNamedColor2::UnitClip.

References UnitClip().

+ Here is the call graph for this function:

◆ Lab4ToLab2()

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

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

Definition at line 3421 of file IccTagBasic.cpp.

3422{
3423 Dst[0] = (icFloatNumber)(Src[0] * 65280.0 / 65535.0);
3424 Dst[1] = (icFloatNumber)(Src[1] * 65280.0 / 65535.0);
3425 Dst[2] = (icFloatNumber)(Src[2] * 65280.0 / 65535.0);
3426}

◆ NegClip()

icFloatNumber CIccTagNamedColor2::NegClip ( icFloatNumber v) const

Name: CIccTagNamedColor2::NegClip.

Purpose: Negative numbers are clipped to zero

Args: v = number to be clipped

Return: Clipped number

Definition at line 3381 of file IccTagBasic.cpp.

3382{
3383 if (v<0)
3384 v=0;
3385
3386 return v;
3387}

◆ NewCopy()

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

587{return new CIccTagNamedColor2(*this);}
CIccTagNamedColor2(int nSize=1, int nDeviceCoords=0)
Name: CIccTagNamedColor2::CIccTagNamedColor2.

◆ operator=()

CIccTagNamedColor2 & CIccTagNamedColor2::operator= ( const CIccTagNamedColor2 & NamedColor2Tag)

Name: CIccTagNamedColor2::operator=.

Purpose: Copy Operator

Args: NamedColor2Tag = The CIccTagNamedColor2 object to be copied

Definition at line 2724 of file IccTagBasic.cpp.

2725{
2726 if (&NamedColor2Tag == this)
2727 return *this;
2728
2729 m_nColorEntrySize = NamedColor2Tag.m_nColorEntrySize;
2730 m_nVendorFlags = NamedColor2Tag.m_nVendorFlags;
2731 m_nDeviceCoords = NamedColor2Tag.m_nDeviceCoords;
2732 m_nSize = NamedColor2Tag.m_nSize;
2733
2734 m_csPCS = NamedColor2Tag.m_csPCS;
2735 m_csDevice = NamedColor2Tag.m_csDevice;
2736
2737 memcpy(m_szPrefix, NamedColor2Tag.m_szPrefix, sizeof(m_szPrefix));
2738 memcpy(m_szSufix, NamedColor2Tag.m_szSufix, sizeof(m_szSufix));
2739
2740 if (m_NamedColor)
2741 free(m_NamedColor);
2743 memcpy(m_NamedColor, NamedColor2Tag.m_NamedColor, m_nColorEntrySize*m_nSize);
2744
2745 m_NamedLab = NULL;
2746
2747 return *this;
2748}

References m_csDevice, m_csPCS, m_NamedColor, m_nColorEntrySize, m_nDeviceCoords, m_nSize, m_nVendorFlags, m_szPrefix, and m_szSufix.

◆ operator[]()

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

Definition at line 625 of file IccTagBasic.h.

◆ Read()

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

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.

Definition at line 2875 of file IccTagBasic.cpp.

2876{
2878 icUInt32Number nNum, nCoords;
2879
2880 icUInt32Number nTagHdrSize = sizeof(icTagTypeSignature) +
2881 sizeof(icUInt32Number) + //m_nReserved=0
2882 sizeof(icUInt32Number) + //VendorFlags
2883 sizeof(icUInt32Number) + //Num Colors
2884 sizeof(icUInt32Number) + //Num Device Coords
2885 sizeof(m_szPrefix) +
2886 sizeof(m_szSufix);
2887 if (nTagHdrSize > size)
2888 return false;
2889
2890 if (!pIO) {
2891 return false;
2892 }
2893
2894 if (!pIO->Read32(&sig) ||
2895 !pIO->Read32(&m_nReserved) ||
2896 !pIO->Read32(&m_nVendorFlags) ||
2897 !pIO->Read32(&nNum) ||
2898 !pIO->Read32(&nCoords) ||
2899 pIO->Read8(m_szPrefix, sizeof(m_szPrefix))!=sizeof(m_szPrefix) ||
2900 pIO->Read8(m_szSufix, sizeof(m_szSufix))!=sizeof(m_szSufix)) {
2901 return false;
2902 }
2903
2904 size -= nTagHdrSize;
2905
2906 icUInt32Number nCount = size / (32+(3+nCoords)*sizeof(icUInt16Number));
2907
2908 if (nCount < nNum)
2909 return false;
2910
2911 if (!SetSize(nNum, nCoords))
2912 return false;
2913
2915 SIccNamedColorEntry *pNamedColor=m_NamedColor;
2916
2917 for (i=0; i<nNum; i++) {
2918 if (pIO->Read8(&pNamedColor->rootName, sizeof(pNamedColor->rootName))!=sizeof(pNamedColor->rootName) ||
2919 pIO->ReadUInt16Float(&pNamedColor->pcsCoords, 3)!=3)
2920 return false;
2921 if (nCoords) {
2922 if (pIO->ReadUInt16Float(&pNamedColor->deviceCoords, nCoords)!=(icInt32Number)nCoords)
2923 return false;
2924 }
2925 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
2926 }
2927
2928 return true;
2929}
icArraySignature sig
icTagTypeSignature
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
bool SetSize(icUInt32Number nSize, icInt32Number nDeviceCoords=-1)
Name: CIccTagNamedColor2::SetSize.
unsigned short icUInt16Number

References SIccNamedColorEntry::deviceCoords, SIccNamedColorEntry::pcsCoords, CIccIO::Read32(), CIccIO::Read8(), CIccIO::ReadUInt16Float(), SIccNamedColorEntry::rootName, and sig.

+ Here is the call graph for this function:

◆ ResetPCSCache()

void CIccTagNamedColor2::ResetPCSCache ( )

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()

Definition at line 3103 of file IccTagBasic.cpp.

3104{
3105 if (m_NamedLab) {
3106 delete [] m_NamedLab;
3107 m_NamedLab = NULL;
3108 }
3109}

◆ SetColorSpaces()

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

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

Definition at line 3065 of file IccTagBasic.cpp.

3066{
3067 m_csPCS = csPCS;
3068 m_csDevice = csDevice;
3069}

◆ SetPrefix()

void CIccTagNamedColor2::SetPrefix ( const icChar * szPrefix)

Name: CIccTagNamedColor2::SetPrefix.

Purpose: Set contents of suffix member field

Args: szPrefix - string to set prefix to

Definition at line 2837 of file IccTagBasic.cpp.

2838{
2839 strncpy(m_szPrefix, szPrefix, sizeof(m_szPrefix));
2840 m_szPrefix[sizeof(m_szPrefix)-1]='\0';
2841}

◆ SetSize()

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

Name: CIccTagNamedColor2::SetSize.

Purpose: Sets the size of the named color array.

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

Definition at line 2779 of file IccTagBasic.cpp.

2780{
2781 if (nSize <1)
2782 nSize = 1;
2783 if (nDeviceCoords<0)
2784 nDeviceCoords = m_nDeviceCoords;
2785
2786 icInt32Number nNewCoords=nDeviceCoords;
2787
2788 if (nDeviceCoords>0)
2789 nDeviceCoords--;
2790
2791 icUInt32Number nColorEntrySize = 32/*rootName*/ + (3/*PCS*/ + 1/*iAny*/ + nDeviceCoords)*sizeof(icFloatNumber);
2792
2793 SIccNamedColorEntry* pNamedColor = (SIccNamedColorEntry*)calloc(nSize, nColorEntrySize);
2794
2795 if (!pNamedColor)
2796 return false;
2797
2798 icUInt32Number i, nCopy = __min(nSize, m_nSize);
2799 icUInt32Number j, nCoords = __min(nNewCoords, (icInt32Number)m_nDeviceCoords);
2800
2801 for (i=0; i<nCopy; i++) {
2803 SIccNamedColorEntry *pTo = (SIccNamedColorEntry*)((icChar*)pNamedColor + i*nColorEntrySize);
2804
2805 strcpy(pTo->rootName, pFrom->rootName);
2806 for (j=0; j<3; j++)
2807 pTo->pcsCoords[j] = pFrom->pcsCoords[j];
2808
2809 for (j=0; j<nCoords; j++) {
2810 pTo->deviceCoords[j] = pFrom->deviceCoords[j];
2811 }
2812 }
2813 free(m_NamedColor);
2814
2815 m_nColorEntrySize = nColorEntrySize;
2816
2817 m_NamedColor = pNamedColor;
2818 m_nSize = nSize;
2819 m_nDeviceCoords = nNewCoords;
2820
2821 ResetPCSCache();
2822
2823 return true;
2824}
#define __min
void ResetPCSCache()
Call ResetPCSCache() if entry values change between calls to FindPCSColor()

References __min, SIccNamedColorEntry::deviceCoords, SIccNamedColorEntry::pcsCoords, and SIccNamedColorEntry::rootName.

◆ SetSufix()

void CIccTagNamedColor2::SetSufix ( const icChar * szSufix)

Name: CIccTagNamedColor2::SetSufix.

Purpose: Set contents of suffix member field

Args: szPrefix - string to set prefix to

Definition at line 2854 of file IccTagBasic.cpp.

2855{
2856 strncpy(m_szSufix, szSufix, sizeof(m_szSufix));
2857 m_szSufix[sizeof(m_szSufix)-1]='\0';
2858}

◆ SetVendorFlags()

void CIccTagNamedColor2::SetVendorFlags ( icUInt32Number nVendorFlags)
inline

Definition at line 607 of file IccTagBasic.h.

607{m_nVendorFlags = nVendorFlags;}

◆ UnitClip()

icFloatNumber CIccTagNamedColor2::UnitClip ( icFloatNumber v) const

Name: CIccTagNamedColor2::UnitClip.

Purpose: Clip number so that its between 0-1

Args: v = number to be clipped

Return: Clipped number

Definition at line 3358 of file IccTagBasic.cpp.

3359{
3360 if (v<0)
3361 v = 0;
3362 if (v>1.0)
3363 v = 1.0;
3364
3365 return v;
3366}

◆ UseLegacyPCS()

virtual bool CIccTagNamedColor2::UseLegacyPCS ( ) const
inlinevirtual

Definition at line 593 of file IccTagBasic.h.

593{ return true; } //Treat Lab Encoding differently?

◆ Validate()

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

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.

Definition at line 3443 of file IccTagBasic.cpp.

3444{
3445 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
3446
3447 CIccInfo Info;
3448 std::string sSigPathName = Info.GetSigPathName(sigPath);
3449
3450 if (!m_nSize) {
3451 sReport += icMsgValidateWarning;
3452 sReport += sSigPathName;
3453 sReport += " - Empty tag!\n";
3455 }
3456
3457 if (m_nDeviceCoords) {
3458 if (pProfile) {
3459 icUInt32Number nCoords = icGetSpaceSamples(pProfile->m_Header.colorSpace);
3460 if (m_nDeviceCoords != nCoords) {
3461 sReport += icMsgValidateNonCompliant;
3462 sReport += sSigPathName;
3463 sReport += " - Incorrect number of device co-ordinates.\n";
3465 }
3466 }
3467 else {
3468 sReport += icMsgValidateWarning;
3469 sReport += sSigPathName;
3470 sReport += " - Tag validation incomplete: Pointer to profile unavailable.\n";
3472 }
3473 }
3474
3475
3476 return rv;
3477}
icValidateStatus
Definition IccDefs.h:118
@ icValidateWarning
Definition IccDefs.h:120
@ icValidateNonCompliant
Definition IccDefs.h:121
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
const char * icMsgValidateWarning
Definition IccUtil.cpp:90
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
Type: Class.
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Function: Validate Each derived tag will implement it's own IsValid() function.

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

+ Here is the call graph for this function:

◆ Write()

bool CIccTagNamedColor2::Write ( CIccIO * pIO)
virtual

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.

Definition at line 2945 of file IccTagBasic.cpp.

2946{
2948
2949 if (!pIO)
2950 return false;
2951
2952 if (!pIO->Write32(&sig))
2953 return false;
2954
2955 if (!pIO->Write32(&m_nReserved))
2956 return false;
2957
2958 if (!pIO->Write32(&m_nVendorFlags))
2959 return false;
2960
2961 if (!pIO->Write32(&m_nSize))
2962 return false;
2963
2964 if (!pIO->Write32(&m_nDeviceCoords))
2965 return false;
2966
2967 if (!pIO->Write8(m_szPrefix, sizeof(m_szPrefix)))
2968 return false;
2969
2970 if (!pIO->Write8(m_szSufix, sizeof(m_szSufix)))
2971 return false;
2972
2974 SIccNamedColorEntry *pNamedColor=m_NamedColor;
2975
2976 for (i=0; i<m_nSize; i++) {
2977 if (pIO->Write8(&pNamedColor->rootName, sizeof(pNamedColor->rootName))!=sizeof(pNamedColor->rootName) ||
2978 pIO->WriteUInt16Float(&pNamedColor->pcsCoords, 3)!=3)
2979 return false;
2980 if (m_nDeviceCoords) {
2982 return false;
2983 }
2984 pNamedColor = (SIccNamedColorEntry*)((icChar*)pNamedColor + m_nColorEntrySize);
2985 }
2986
2987 return true;
2988}
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
Function: GetType()

References SIccNamedColorEntry::deviceCoords, SIccNamedColorEntry::pcsCoords, SIccNamedColorEntry::rootName, sig, CIccIO::Write32(), CIccIO::Write8(), and CIccIO::WriteUInt16Float().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_csDevice

icColorSpaceSignature CIccTagNamedColor2::m_csDevice
protected

Definition at line 657 of file IccTagBasic.h.

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

◆ m_csPCS

icColorSpaceSignature CIccTagNamedColor2::m_csPCS
protected

Definition at line 656 of file IccTagBasic.h.

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

◆ m_NamedColor

SIccNamedColorEntry* CIccTagNamedColor2::m_NamedColor
protected

Definition at line 648 of file IccTagBasic.h.

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

◆ m_NamedLab

SIccNamedLabEntry* CIccTagNamedColor2::m_NamedLab
protected

Definition at line 649 of file IccTagBasic.h.

◆ m_nColorEntrySize

icUInt32Number CIccTagNamedColor2::m_nColorEntrySize
protected

For quick response of repeated FindPCSColor.

Definition at line 650 of file IccTagBasic.h.

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

◆ m_nDeviceCoords

icUInt32Number CIccTagNamedColor2::m_nDeviceCoords
protected

Definition at line 653 of file IccTagBasic.h.

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

◆ m_nSize

icUInt32Number CIccTagNamedColor2::m_nSize
protected

Definition at line 654 of file IccTagBasic.h.

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

◆ m_nVendorFlags

icUInt32Number CIccTagNamedColor2::m_nVendorFlags
protected

Definition at line 652 of file IccTagBasic.h.

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

◆ m_szPrefix

icChar CIccTagNamedColor2::m_szPrefix[32]
protected

Definition at line 645 of file IccTagBasic.h.

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

◆ m_szSufix

icChar CIccTagNamedColor2::m_szSufix[32]
protected

Definition at line 646 of file IccTagBasic.h.

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


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