73#if !defined(_ICCCMM_H)
84#if defined(__cpluplus) && defined(USEREFICCMAXNAMESPACE)
139#define icPerceptualRefBlackX 0.00336
140#define icPerceptualRefBlackY 0.0034731
141#define icPerceptualRefBlackZ 0.00287
143#define icPerceptualRefWhiteX 0.9642
144#define icPerceptualRefWhiteY 1.0000
145#define icPerceptualRefWhiteZ 0.8249
175 virtual ~IIccCreateXformHint() {}
176 virtual const char *GetHintType()
const=0;
190 CIccCreateXformHintManager() { m_pList = NULL; }
191 ~CIccCreateXformHintManager();
194 bool AddHint(IIccCreateXformHint* pHint);
197 bool DeleteHint(IIccCreateXformHint* pHint);
200 IIccCreateXformHint* GetHint(
const char* hintName);
204 class IIccCreateXformHintPtr {
206 IIccCreateXformHint* ptr;
208 typedef std::list<IIccCreateXformHintPtr> IIccCreateXformHintList;
211 IIccCreateXformHintList* m_pList;
222class ICCPROFLIB_API CIccCreateNamedColorXformHint :
public IIccCreateXformHint
225 CIccCreateNamedColorXformHint() {
227 memset(&spectralRange, 0,
sizeof(spectralRange));
228 memset(&biSpectralRange, 0,
sizeof(biSpectralRange));
231 virtual const char *GetHintType()
const {
return "CIccCreateNamedColorXformHint";}
248class ICCPROFLIB_API CIccCreateCmmEnvVarXformHint :
public IIccCreateXformHint
251 virtual ~CIccCreateCmmEnvVarXformHint() {}
253 virtual const char *GetHintType()
const {
return "CIccCreateCmmEnvVarXformHint";}
265class ICCPROFLIB_API CIccCreateCmmPccEnvVarXformHint :
public IIccCreateXformHint
268 virtual ~CIccCreateCmmPccEnvVarXformHint() {}
270 virtual const char* GetHintType()
const {
return "CIccCreateCmmPccEnvVarXformHint"; }
287 virtual ~IIccAdjustPCSXform() {}
289 virtual bool CalcFactors(
const CIccProfile* pProfile,
const CIccXform* pXfm,
icFloatNumber* Scale,
icFloatNumber* Offset)
const=0;
300class ICCPROFLIB_API CIccCreateAdjustPCSXformHint :
public IIccCreateXformHint
303 virtual ~CIccCreateAdjustPCSXformHint() {}
305 virtual const char *GetHintType()
const {
return "CIccCreateAdjustPCSXformHint";}
306 virtual const char *GetAdjustPCSType()
const=0;
307 virtual IIccAdjustPCSXform *GetNewAdjustPCSXform()
const=0;
318class ICCPROFLIB_API CIccLuminanceMatchingHint :
public IIccCreateXformHint
321 virtual const char *GetHintType()
const {
return "CIccLuminanceMatchingHint"; }
342 friend class CIccPcsXform;
345 virtual ~CIccXform();
350 static CIccXform *Create(CIccProfile *pProfile,
bool bInput=
true,
355 bool bUseD2BTags=
true,
356 CIccCreateXformHintManager *pHintManager=NULL);
360 static CIccXform *Create(CIccProfile &pProfile,
366 bool bUseD2BTags=
true,
367 CIccCreateXformHintManager *pHintManager=NULL);
370 static CIccXform *Create(CIccProfile *pProfile,
CIccTag *pXformTag,
bool bInput =
true,
374 bool bUseSpectralPCS =
false,
375 CIccCreateXformHintManager *pHintManager = NULL);
378 void ShareProfile() { m_bOwnsProfile =
false; }
379 void SetPcsAdjustXform() { m_bPcsAdjustXform =
true; }
383 virtual CIccApplyXform *GetNewApply(
icStatusCMM &status);
388 virtual bool RemoveIO() {
return m_pProfile ? m_pProfile->Detach() :
false; }
399 virtual bool UseLegacyPCS()
const {
return false; }
401 virtual bool IsVersion2()
const {
return !m_pProfile || m_pProfile->m_Header.version <
icVersionNumberV4; }
404 bool IsInput()
const {
return m_bInput; }
406 virtual bool IsLateBinding()
const {
return false; }
410 bool IsMCS()
const {
return m_nMCS!=
icNoMCS; }
412 bool IsExtendedPCS()
const {
return m_pProfile && (m_pProfile->m_Header.flags &
icExtendedRangePCS) != 0; }
414 bool IsAbstract()
const {
return m_bPcsAdjustXform || (m_pProfile && m_pProfile->m_Header.deviceClass==
icSigAbstractClass); }
418 bool bUseSpectralPCS,
icXformInterp nInterp, CIccCreateXformHintManager *pHintManager=NULL,
425 virtual bool NoClipPCS()
const {
return true; }
428 const CIccProfile* GetProfile()
const {
return m_pProfile; }
431 CIccProfile* GetProfilePtr()
const {
return m_pProfile; }
437 void SetSrcPCSConversion(
bool bPcsConvert) { m_bSrcPcsConversion = bPcsConvert; }
438 void SetDstPCSConversion(
bool bPcsConvert) { m_bDstPcsConversion = bPcsConvert; }
439 bool NeedAdjustPCS() {
return m_bAdjustPCS; }
440 bool LuminanceMatching() {
return m_bLuminanceMatching; }
446 void AttachCmmEnvVarLookup(
IIccCmmEnvVarLookup* pCmmEnvVarLookup) { m_pCmmEnvVarLookup = pCmmEnvVarLookup; m_bDeleteEnvLooup =
false; }
457 virtual bool HasPerceptualHandling() {
return true; }
459 CIccProfile *m_pProfile;
460 bool m_bOwnsProfile =
true;
461 bool m_bPcsAdjustXform =
false;
468 bool m_bUseSpectralPCS;
471 bool m_bLuminanceMatching;
474 bool m_bSrcPcsConversion;
475 bool m_bDstPcsConversion;
478 IIccAdjustPCSXform* m_pAdjustPCS;
485 bool m_bDeleteEnvLooup =
true;
510typedef std::list<CIccXformPtr> CIccXformList;
522 friend class CIccXform;
524 virtual ~CIccApplyXform();
529 const CIccXform *GetXform() {
return m_pXform; }
534 CIccApplyXform(CIccXform *pXform);
536 const CIccXform *m_pXform;
559typedef std::list<CIccApplyXformPtr> CIccApplyXformList;
562class CIccApplyPcsStep;
565 icPcsStepUnknown = 0,
577 icPcsStepSparseMatrix,
578 icPcsStepSrcSparseMatrix,
582class CIccApplyPcsStep;
587 virtual icPcsStepType GetType() {
return icPcsStepUnknown; }
589 virtual CIccApplyPcsStep *GetNewApply();
591 virtual ~CIccPcsStep() {}
596 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL;}
597 virtual bool isIdentity()
const {
return false; }
598 virtual CIccPcsStep *reduce()
const {
return (CIccPcsStep*)
this; }
600 virtual void dump(std::string &str)
const =0;
612 friend class CIccPcsStep;
614 virtual ~CIccApplyPcsStep() {}
615 virtual icPcsStepType GetXformType()
const {
return m_stepType; }
619 const CIccPcsStep *GetStep()
const {
return m_pStep; }
622 icPcsStepType m_stepType;
624 CIccApplyPcsStep(CIccPcsStep *pStep) { m_pStep = pStep; m_stepType = icPcsStepUnknown; }
626 const CIccPcsStep *m_pStep;
633 CIccPcsStepIdentity(
icUInt16Number nChannels) {m_nChannels=nChannels;}
634 virtual icPcsStepType GetType() {
return icPcsStepIdentity; }
636 virtual ~CIccPcsStepIdentity() {}
638 virtual icUInt16Number GetSrcChannels()
const {
return m_nChannels;}
639 virtual icUInt16Number GetDstChannels()
const {
return m_nChannels;}
641 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL;}
642 virtual bool isIdentity()
const {
return true; }
644 virtual void dump(std::string &str)
const;
656 virtual icPcsStepType GetType() {
return icPcsStepRouteMcs; }
658 virtual ~CIccPcsStepRouteMcs();
660 virtual icUInt16Number GetSrcChannels()
const {
return m_nSrcChannels;}
661 virtual icUInt16Number GetDstChannels()
const {
return m_nDstChannels;}
663 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL;}
664 virtual bool isIdentity()
const ;
666 virtual void dump(std::string &str)
const;
687 virtual icPcsStepType GetType() {
return icPcsStepLabToXYZ; }
693 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
695 virtual void dump(std::string &str)
const;
702 virtual icPcsStepType GetType() {
return icPcsStepXYZToLab; }
708 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
710 virtual void dump(std::string &str)
const;
717 virtual icPcsStepType GetType() {
return icPcsStepLab2ToXYZ; }
723 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
725 virtual void dump(std::string &str)
const;
732 virtual icPcsStepType GetType() {
return icPcsStepXYZToLab2; }
738 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
740 virtual void dump(std::string &str)
const;
747 virtual icPcsStepType GetType() {
return icPcsStepOffset; }
749 virtual ~CIccPcsStepOffset();
752 virtual icUInt16Number GetSrcChannels()
const {
return m_nChannels; }
753 virtual icUInt16Number GetDstChannels()
const {
return m_nChannels; }
755 CIccPcsStepOffset *Add(
const CIccPcsStepOffset *offset)
const;
760 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
761 virtual bool isIdentity()
const;
763 virtual void dump(std::string &str)
const;
770class CIccPcsStepMatrix;
777 virtual icPcsStepType GetType() {
return icPcsStepScale; }
779 virtual ~CIccPcsStepScale();
782 virtual icUInt16Number GetSrcChannels()
const {
return m_nChannels; }
783 virtual icUInt16Number GetDstChannels()
const {
return m_nChannels; }
788 CIccPcsStepScale *Mult(
const CIccPcsStepScale *scale)
const;
789 CIccPcsStepMatrix *Mult(
const CIccPcsStepMatrix *matrix)
const;
792 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
793 virtual bool isIdentity()
const;
795 virtual void dump(std::string &str)
const;
806 CIccPcsStepMatrix(
const CIccPcsStepMatrix &mat) :
CIccMatrixMath(mat) {}
808 virtual icPcsStepType GetType() {
return icPcsStepMatrix; }
810 virtual ~CIccPcsStepMatrix() {}
816 CIccPcsStepMatrix *Mult(
const CIccPcsStepScale *scale)
const;
817 CIccPcsStepMatrix *Mult(
const CIccPcsStepMatrix *matrix)
const;
819 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const;
820 virtual bool isIdentity()
const {
return isIdentityMtx();}
821 virtual CIccPcsStep *reduce()
const;
823 virtual void dump(std::string &str)
const;
832 virtual icPcsStepType GetType() {
return icPcsStepMpe; }
834 virtual ~CIccPcsStepMpe();
836 virtual CIccApplyPcsStep *GetNewApply();
842 virtual bool isIdentity()
const;
849 virtual void dump(std::string &str)
const;
859 friend class CIccPcsStepMpe;
860 virtual ~CIccApplyPcsStepMpe() {
delete m_pApply; }
862 CIccApplyPcsStepMpe(CIccPcsStep *pStep,
CIccApplyTagMpe *pApply) : CIccApplyPcsStep(pStep) { m_pApply = pApply; }
872 virtual icPcsStepType GetType() {
return icPcsStepSrcMatrix; }
874 virtual ~CIccPcsStepSrcMatrix();
883 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL; }
885 virtual void dump(std::string &str)
const;
897 virtual icPcsStepType GetType() {
return icPcsStepSparseMatrix; }
899 virtual ~CIccPcsStepSparseMatrix();
908 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL; }
910 virtual void dump(std::string &str)
const;
918class ICCPROFLIB_API CIccPcsStepSrcSparseMatrix :
public CIccPcsStep
922 virtual icPcsStepType GetType() {
return icPcsStepSrcSparseMatrix; }
924 virtual ~CIccPcsStepSrcSparseMatrix();
933 virtual CIccPcsStep *concat(CIccPcsStep *pNext)
const {
return NULL; }
935 virtual void dump(std::string &str)
const;
963typedef std::list<CIccPcsStepPtr> CIccPcsStepList;
977 virtual ~CIccPcsXform();
981 icStatusCMM Connect(CIccXform *pFromXform, CIccXform *pToXform);
985 virtual CIccApplyXform *GetNewApply(
icStatusCMM &status);
991 virtual icUInt16Number GetNumSrcSamples()
const {
return m_nSrcSamples; }
995 virtual icUInt16Number GetNumDstSamples()
const {
return m_nDstSamples; }
998 virtual bool UseLegacyPCS()
const {
return false; }
1000 virtual bool IsVersion2()
const {
return false; }
1003 virtual LPIccCurve* ExtractInputCurves() {
return NULL; }
1004 virtual LPIccCurve* ExtractOutputCurves() {
return NULL; }
1019 void pushXyzToXyzIn();
1020 void pushXyzInToXyz();
1035 icStatusCMM pushXYZConvert(CIccXform *pSrcXform, CIccXform *pDstXform);
1045 CIccPcsStepList *m_list;
1058 CIccApplyPcsStep *ptr;
1069typedef std::list<CIccApplyPcsStepPtr> CIccApplyPcsStepList;
1081 friend class CIccPcsXform;
1083 virtual ~CIccApplyPcsXform();
1087 void AppendApplyStep(CIccApplyPcsStep *pStep);
1090 CIccApplyPcsXform(CIccXform *pXform);
1093 CIccApplyPcsStepList *m_list;
1111 CIccXformMonochrome();
1112 virtual ~CIccXformMonochrome();
1124 virtual bool HasPerceptualHandling() {
return false; }
1146 CIccXformMatrixTRC();
1147 virtual ~CIccXformMatrixTRC();
1159 virtual bool HasPerceptualHandling() {
return false; }
1184 CIccXform3DLut(
CIccTag *pTag);
1185 virtual ~CIccXform3DLut();
1192 virtual bool UseLegacyPCS()
const {
return m_pTag->UseLegacyPCS(); }
1219 CIccXform4DLut(
CIccTag *pTag);
1220 virtual ~CIccXform4DLut();
1227 virtual bool UseLegacyPCS()
const {
return m_pTag->UseLegacyPCS(); }
1244 friend class CIccXformNDLut;
1246 CIccApplyNDLutXform(CIccXformNDLut* pXform,
CIccApplyCLUT* pApply);
1247 virtual ~CIccApplyNDLutXform();
1264 CIccXformNDLut(
CIccTag *pTag);
1265 virtual ~CIccXformNDLut();
1271 virtual CIccApplyXform* GetNewApply(
icStatusCMM& status);
1275 virtual bool UseLegacyPCS()
const {
return m_pTag->UseLegacyPCS(); }
1302 icApplyPixel2Pixel = 0,
1303 icApplyNamed2Pixel = 1,
1304 icApplyPixel2Named = 2,
1305 icApplyNamed2Named = 3,
1326 virtual ~CIccXformNamedColor();
1333 icApplyInterface GetInterface()
const {
return m_nApplyInterface;}
1340 virtual bool UseLegacyPCS()
const {
return m_pTag ? m_pTag->UseLegacyPCS() :
false; }
1351 bool IsSrcPCS()
const;
1353 bool IsDestPCS()
const;
1356 virtual LPIccCurve* ExtractInputCurves() {
return NULL;}
1357 virtual LPIccCurve* ExtractOutputCurves() {
return NULL;}
1361 virtual bool HasPerceptualHandling() {
return false; }
1365 icApplyInterface m_nApplyInterface;
1383 virtual ~CIccXformMpe();
1393 virtual CIccApplyXform *GetNewApply(
icStatusCMM &status);
1396 virtual bool UseLegacyPCS()
const {
return false; }
1397 virtual LPIccCurve* ExtractInputCurves() {
return NULL;}
1398 virtual LPIccCurve* ExtractOutputCurves() {
return NULL;}
1400 virtual bool NoClipPCS()
const {
return true; }
1402 virtual bool IsLateBinding()
const;
1403 virtual bool IsLateBindingReflectance()
const;
1412 bool m_bDeleteAppliedPCC;
1424 friend class CIccXformMpe;
1426 virtual ~CIccApplyXformMpe();
1430 CIccApplyXformMpe(CIccXformMpe *pXform);
1449 virtual ~CIccPCS() {}
1468 bool m_bLastPcsXform;
1523} icFloatColorEncoding;
1540 friend class CIccCmm;
1542 virtual ~CIccApplyCmm();
1549 void AppendApplyXform(CIccApplyXform *pApplyXform);
1551 CIccCmm *GetCmm() {
return m_pCmm; }
1556 CIccApplyCmm(CIccCmm *pCmm);
1558 CIccApplyXformList *m_Xforms;
1571 virtual ~IXformIterator() {}
1573 virtual void iterate(
const CIccXform* pxform) = 0;
1587 friend class CIccApplyCmm;
1591 bool bFirstInput=
true);
1594 virtual CIccPCS *GetPCS() {
return new CIccPCS(); }
1602 bool bUseD2BxB2DxTags=
true,
1603 CIccCreateXformHintManager *pHintManager=NULL,
1604 bool bUseSubProfile=
false);
1610 CIccCreateXformHintManager *pHintManager=NULL,
1611 bool bUseSubProfile=
false);
1612 virtual icStatusCMM AddXform(CIccProfile *pProfile,
1617 bool bUseD2BxB2DxTags =
true,
1618 CIccCreateXformHintManager *pHintManager=NULL);
1619 virtual icStatusCMM AddXform(CIccProfile &Profile,
1624 bool bUseD2BxB2DxTags =
true,
1625 CIccCreateXformHintManager *pHintManager=NULL);
1626 virtual icStatusCMM AddXform(CIccProfile *pProfile,
1631 bool bUseD2BxB2DxTags =
false,
1632 CIccCreateXformHintManager *pHintManager = NULL);
1635 virtual icStatusCMM Begin(
bool bAllocNewApply=
true,
bool bUsePcsConversion=
false);
1638 virtual CIccApplyCmm *GetNewApplyCmm(
icStatusCMM &status);
1640 virtual CIccApplyCmm *GetApply() {
return m_pApply; }
1652 virtual void IterateXforms(IXformIterator* pIterater)
const;
1663 bool IsLastOutPut()
const {
return !m_bLastInput; }
1671 bool Valid()
const {
return m_bValid; }
1697 static const icChar *GetFloatColorEncoding(icFloatColorEncoding val);
1698 static icFloatColorEncoding GetFloatColorEncoding(
const icChar* val);
1706 void SetLateBindingCC();
1709 icStatusCMM CheckPCSConnections(
bool bUsePCSConversions=
false);
1711 CIccApplyCmm *m_pApply;
1722 CIccXformList *m_Xforms;
1726class CIccNamedColorCmm;
1739 friend class CIccNamedColorCmm;
1741 virtual ~CIccApplyNamedColorCmm();
1754 CIccApplyNamedColorCmm(CIccNamedColorCmm *pCmm);
1767 friend class CIccApplyNamedColorCmm;
1772 bool bFirstInput=
true);
1773 virtual ~CIccNamedColorCmm();
1781 bool bUseD2BxB2DxTags=
true,
1782 CIccCreateXformHintManager *pHintManager=NULL,
1783 bool bUseSubProfile=
false);
1784 virtual icStatusCMM AddXform(CIccProfile *pProfile,
1789 bool bUseD2BxB2DxTags =
true,
1790 CIccCreateXformHintManager *pHintManager=NULL);
1794 virtual icStatusCMM Begin(
bool bAllocNewApply=
true,
bool bUsePcsConversion=
false);
1796 virtual CIccApplyCmm *GetNewApplyCmm(
icStatusCMM &status);
1807 icApplyInterface GetInterface()
const {
return m_nApplyInterface;}
1812 icApplyInterface m_nApplyInterface;
1819 CIccMruPixel() { pPixelData = NULL; pNext = NULL; }
1822 CIccMruPixel *pNext;
1825typedef CIccMruPixel<icFloatNumber> CIccMruPixelFloat;
1826typedef CIccMruPixel<icUInt8Number> CIccMruPixel8;
1827typedef CIccMruPixel<icUInt16Number> CIccMruPixel16;
1844 virtual ~CIccMruCache();
1846 virtual bool Apply(T *DstPixel,
const T *SrcPixel);
1847 virtual void Update(T *DstPixel);
1857 CIccMruPixel<T> *m_pFirst;
1858 CIccMruPixel<T> *m_cache;
1869typedef CIccMruCache<icFloatNumber> CIccMruCacheFloat;
1870typedef CIccMruCache<icUInt8Number> CIccMruCache8;
1871typedef CIccMruCache<icUInt16Number> CIccMruCache16;
1887 friend class CIccMruCmm;
1889 virtual ~CIccApplyMruCmm();
1897 CIccApplyMruCmm(CIccMruCmm *pCmm);
1901 CIccCmm *m_pCachedCmm;
1902 CIccMruCacheFloat *m_pCache;
1915 friend class CIccApplyMruCmm;
1919 virtual ~CIccMruCmm();
1922 static CIccMruCmm* Attach(CIccCmm *pCmm,
icUInt8Number nCacheSize=6,
bool bDeleteCmm=
true);
1927 bool bUseMpeTags=
true, CIccCreateXformHintManager *pHintManager=NULL) {
return icCmmStatBad; }
1933 bool bUseMpeTags=
true, CIccCreateXformHintManager *pHintManager=NULL) {
return icCmmStatBad; }
1936 bool bUseMpeTags=
true, CIccCreateXformHintManager *pHintManager=NULL) {
return icCmmStatBad; }
1938 virtual CIccApplyCmm *GetNewApplyCmm(
icStatusCMM &status);
1941 virtual icStatusCMM RemoveAllIO() {
return m_pCmm->RemoveAllIO(); }
1942 virtual CIccPCS *GetPCS() {
return m_pCmm->GetPCS(); }
1943 virtual icUInt32Number GetNumXforms()
const {
return m_pCmm->GetNumXforms(); }
1957#if defined(__cplusplus) && defined(USEREFICCMAXNAMESPACE)
icXformLutType
CMM Xform LUT types.
icXformInterp
CMM Interpolation types.
icStatusCMM
CMM return status values.
@ icCmmStatInvalidProfile
@ icCmmStatTooManySamples
@ icCmmStatProfileMissingTag
@ icCmmStatIncorrectApply
@ icCmmStatUnsupportedPcsLink
@ icCmmStatBadColorEncoding
@ icCmmStatCantOpenProfile
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
unsigned int icUInt32Number
Class: CIccTagMultiProcessElement.
Class: CIccArrayNamedColor.
Class: CIccTagMultiProcessElement.
Class: CIccTagNamedColor2.
static icFloatNumber UnitClip(icFloatNumber v)