SampleICC Main srcforge
Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

IccTagBasic.h

Go to the documentation of this file.
00001 
00012 /*
00013  * The ICC Software License, Version 0.1
00014  *
00015  *
00016  * Copyright (c) 2003-2006 The International Color Consortium. All rights 
00017  * reserved.
00018  *
00019  * Redistribution and use in source and binary forms, with or without
00020  * modification, are permitted provided that the following conditions
00021  * are met:
00022  *
00023  * 1. Redistributions of source code must retain the above copyright
00024  *    notice, this list of conditions and the following disclaimer. 
00025  *
00026  * 2. Redistributions in binary form must reproduce the above copyright
00027  *    notice, this list of conditions and the following disclaimer in
00028  *    the documentation and/or other materials provided with the
00029  *    distribution.
00030  *
00031  * 3. The end-user documentation included with the redistribution,
00032  *    if any, must include the following acknowledgment:  
00033  *       "This product includes software developed by the
00034  *        The International Color Consortium (www.color.org)"
00035  *    Alternately, this acknowledgment may appear in the software itself,
00036  *    if and wherever such third-party acknowledgments normally appear.
00037  *
00038  * 4. In the absence of prior written permission, the names "ICC" and "The
00039  *    International Color Consortium" must not be used to imply that the
00040  *    ICC organization endorses or promotes products derived from this
00041  *    software.
00042  *
00043  *
00044  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00045  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00046  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00047  * DISCLAIMED.  IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
00048  * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00049  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00050  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00051  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00052  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00053  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00054  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00055  * SUCH DAMAGE.
00056  * ====================================================================
00057  *
00058  * This software consists of voluntary contributions made by many
00059  * individuals on behalf of the The International Color Consortium. 
00060  *
00061  *
00062  * Membership in the ICC is encouraged when this software is used for
00063  * commercial purposes. 
00064  *
00065  *  
00066  * For more information on The International Color Consortium, please
00067  * see <http://www.color.org/>.
00068  *  
00069  * 
00070  */
00071 
00073 // HISTORY:
00074 //
00075 // -Initial implementation by Max Derhak 5-15-2003
00076 //
00078 
00079 #if !defined(_ICCTAGBASIC_H)
00080 #define _ICCTAGBASIC_H
00081 
00082 #include <list>
00083 #include <string>
00084 #include "IccDefs.h"
00085 #ifdef USESAMPLEICCNAMESPACE
00086 namespace sampleICC {
00087 #endif
00088 
00089 class CIccIO;
00090 
00091 class ICCPROFLIB_API CIccProfile;
00092 
00093 class IIccExtensionTag
00094 {
00095 public:
00096   virtual const char *GetExtClassName()=0;
00097 };
00098 
00110 class ICCPROFLIB_API CIccTag  
00111 {
00112 public:
00113   CIccTag();
00114 
00124   virtual CIccTag* NewCopy() const {return new CIccTag;}
00125 
00126   virtual ~CIccTag();
00127 
00134   virtual icTagTypeSignature GetType() { return icMaxEnumType; }
00135   virtual bool IsArrayType() { return false; }
00136   virtual bool IsMBBType() { return false; }
00137 
00138   virtual const icChar *GetClassName() { return "CIccTag"; }
00139 
00140   static CIccTag* Create(icTagTypeSignature sig);
00141 
00142   virtual IIccExtensionTag* GetExtension() {return NULL;}
00143 
00152   virtual bool IsSupported() { return true; }
00153 
00166   virtual bool Read(icUInt32Number size, CIccIO *pIO) { return false; }
00167 
00179   virtual bool Write(CIccIO *pIO) { return false; }
00180 
00188   virtual void Describe(std::string &sDescription) { sDescription.empty(); }
00189 
00199   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00200 
00201   //All tags start with a reserved value.  Allocate a place to put it.
00202   icUInt32Number m_nReserved;
00203 };
00204 
00205 
00213 class ICCPROFLIB_API CIccTagUnknown : public CIccTag
00214 {
00215 public:
00216   CIccTagUnknown();
00217   CIccTagUnknown(const CIccTagUnknown &ITU);
00218   CIccTagUnknown &operator=(const CIccTagUnknown &UnknownTag);
00219   virtual CIccTag* NewCopy() const {return new CIccTagUnknown(*this);}
00220   virtual ~CIccTagUnknown();
00221 
00222   virtual bool IsSuppoted() { return false; }
00223 
00224   virtual icTagTypeSignature GetType() { return m_nType; }
00225   virtual const icChar *GetClassName() { return "CIccTagUnknown"; }
00226 
00227   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00228   virtual bool Write(CIccIO *pIO);
00229 
00230   virtual void Describe(std::string &sDescription);
00231 
00232 
00233 protected:
00234   icTagTypeSignature m_nType;
00235   icUInt8Number *m_pData;
00236   icUInt32Number m_nSize;
00237 };
00238 
00239 
00247 class ICCPROFLIB_API CIccTagText : public CIccTag
00248 {
00249 public:
00250   CIccTagText();
00251   CIccTagText(const CIccTagText &ITT);
00252   CIccTagText &operator=(const CIccTagText &TextTag);
00253   virtual CIccTag* NewCopy() const {return new CIccTagText(*this);}
00254   virtual ~CIccTagText();
00255 
00256   virtual icTagTypeSignature GetType() { return icSigTextType; }
00257   virtual const icChar *GetClassName() { return "CIccTagText"; }
00258 
00259   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00260   virtual bool Write(CIccIO *pIO);
00261 
00262   virtual void Describe(std::string &sDescription);
00263 
00264   const icChar *GetText() const { return m_szText; }
00265   void SetText(const icChar *szText);
00266   const icChar *operator=(const icChar *szText);
00267 
00268   icChar *GetBuffer(icUInt32Number nSize);
00269   void Release();
00270   icUInt32Number Capacity() const { return m_nBufSize; }
00271   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00272 
00273 protected:
00274   icChar *m_szText;
00275   icUInt32Number m_nBufSize;
00276 };
00277 
00285 class ICCPROFLIB_API CIccTagTextDescription : public CIccTag
00286 {
00287 public:
00288   CIccTagTextDescription();
00289   CIccTagTextDescription(const CIccTagTextDescription &ITTD);
00290   CIccTagTextDescription &operator=(const CIccTagTextDescription &TextDescTag);
00291   virtual CIccTag* NewCopy() const {return new CIccTagTextDescription(*this);}
00292   virtual ~CIccTagTextDescription();
00293 
00294   virtual icTagTypeSignature GetType() { return icSigTextDescriptionType; }
00295   virtual const icChar *GetClassName() { return "CIccTagTextDescription"; }
00296 
00297   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00298   virtual bool Write(CIccIO *pIO);
00299 
00300   virtual void Describe(std::string &sDescription);
00301 
00302   const icChar *GetText() const { return m_szText; }
00303   void SetText(const icChar *szText);
00304   const icChar *operator=(const icChar *szText);
00305 
00306   icChar *GetBuffer(icUInt32Number nSize);
00307   void Release();
00308   icUInt32Number Capacity() const { return m_nASCIISize; }
00309 
00310   icUInt16Number *GetUnicodeBuffer(icUInt32Number nSize);
00311   void ReleaseUnicode();
00312   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00313 
00314 
00315 protected:
00316   icChar *m_szText;
00317   icUInt32Number m_nASCIISize;
00318 
00319   icUInt16Number *m_uzUnicodeText;
00320   icUInt32Number m_nUnicodeSize;
00321   icUInt32Number m_nUnicodeLanguageCode;
00322 
00323   icUInt8Number m_szScriptText[67];
00324   icUInt8Number m_nScriptSize;
00325   icUInt16Number m_nScriptCode;
00326 };
00327 
00328 
00336 class ICCPROFLIB_API CIccTagSignature : public CIccTag
00337 {
00338 public:
00339   CIccTagSignature();
00340   CIccTagSignature(const CIccTagSignature &ITS);
00341   CIccTagSignature &operator=(const CIccTagSignature &SignatureTag);
00342   virtual CIccTag* NewCopy() const {return new CIccTagSignature(*this);}
00343   virtual ~CIccTagSignature();
00344 
00345   virtual icTagTypeSignature GetType() { return icSigSignatureType; }
00346   virtual const icChar *GetClassName() { return "CIccTagSignature"; }
00347 
00348   virtual void Describe(std::string &sDescription);
00349 
00350   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00351   virtual bool Write(CIccIO *pIO);
00352 
00353   icUInt32Number GetValue() const { return m_nSig; }
00354   void SetValue(icUInt32Number sig) { m_nSig = sig; }
00355   icUInt32Number operator=(icUInt32Number sig) { SetValue(sig); return m_nSig; }
00356   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00357 
00358 protected:
00359   icUInt32Number m_nSig;
00360 };
00361 
00362 typedef struct
00363 {
00364   icChar rootName[32];
00365   icFloatNumber pcsCoords[3];
00366   icFloatNumber deviceCoords[icAny];
00367 } SIccNamedColorEntry;
00368 
00369 typedef struct {
00370   icFloatNumber lab[3];
00371 } SIccNamedLabEntry;
00372 
00380 class ICCPROFLIB_API CIccTagNamedColor2 : public CIccTag
00381 {
00382 public:
00383   CIccTagNamedColor2(int nSize=1, int nDeviceCoords=0);
00384   CIccTagNamedColor2(const CIccTagNamedColor2 &ITNC);
00385   CIccTagNamedColor2 &operator=(const CIccTagNamedColor2 &NamedColor2Tag);
00386   virtual CIccTag* NewCopy() const {return new CIccTagNamedColor2(*this);}
00387   virtual ~CIccTagNamedColor2();
00388 
00389   virtual icTagTypeSignature GetType() { return icSigNamedColor2Type; }
00390   virtual const icChar *GetClassName() { return "CIccTagNamedColor2"; }
00391 
00392   virtual bool UseLegacyPCS() { return true; } //Treat Lab Encoding differently?
00393 
00394   virtual void Describe(std::string &sDescription);
00395 
00396   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00397   virtual bool Write(CIccIO *pIO);
00398 
00399   const icChar *GetPrefix() const { return m_szPrefix; }
00400   void SetPrefix(const icChar *szPrefix);
00401 
00402   const icChar *GetSufix() const { return m_szSufix; }
00403   void SetSufix(const icChar *szSufix);
00404 
00405   icUInt32Number GetVendorFlags() const { return m_nVendorFlags; }
00406   void SetVendorFlags(icUInt32Number nVendorFlags) {m_nVendorFlags = nVendorFlags;}
00407 
00408   //The following Find functions return the zero based index of the color
00409   //or -1 to indicate that the color was not found.
00410   icInt32Number FindColor(const icChar *szColor);
00411   icInt32Number FindRootColor(const icChar *szRootColor);
00412   icInt32Number FindPCSColor(icFloatNumber *pPCS, icFloatNumber dMinDE=1000.0);
00413   icInt32Number FindDeviceColor(icFloatNumber *pDevColor);
00414 
00416   void ResetPCSCache();
00417 
00418   bool GetColorName(std::string &sColorName, icInt32Number index);
00419   SIccNamedColorEntry &operator[](icUInt32Number index) {return m_NamedColor[index];}
00420   SIccNamedColorEntry *GetEntry(icUInt32Number index) {return &m_NamedColor[index];}
00421 
00422   icUInt32Number GetSize() const { return m_nSize; }
00423   icUInt32Number GetDeviceCoords() const {return m_nDeviceCoords;}
00424   void SetSize(icUInt32Number nSize, icInt32Number nDeviceCoords=-1);
00425 
00426   virtual void SetColorSpaces(icColorSpaceSignature csPCS, icColorSpaceSignature csDevice);
00427   icColorSpaceSignature GetPCS() const {return m_csPCS;}
00428   icColorSpaceSignature GetDeviceSpace() const {return m_csDevice;}
00429 
00430   icFloatNumber NegClip(icFloatNumber v);
00431   icFloatNumber UnitClip(icFloatNumber v);
00432 
00433   void Lab2ToLab4(icFloatNumber *Dst, const icFloatNumber *Src);
00434   void Lab4ToLab2(icFloatNumber *Dst, const icFloatNumber *Src);
00435 
00436   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00437 
00438 protected:
00439   icChar m_szPrefix[32];
00440   icChar m_szSufix[32];
00441   
00442   SIccNamedColorEntry *m_NamedColor;
00443   SIccNamedLabEntry *m_NamedLab; 
00444   icUInt32Number m_nColorEntrySize;
00445 
00446   icUInt32Number m_nVendorFlags;
00447   icUInt32Number m_nDeviceCoords;
00448   icUInt32Number m_nSize;
00449 
00450   icColorSpaceSignature m_csPCS;
00451   icColorSpaceSignature m_csDevice;
00452 };
00453 
00461 class ICCPROFLIB_API CIccTagXYZ : public CIccTag
00462 {
00463 public:
00464   CIccTagXYZ(int nSize=1);
00465   CIccTagXYZ(const CIccTagXYZ &ITXYZ);
00466   CIccTagXYZ &operator=(const CIccTagXYZ &XYZTag);
00467   virtual CIccTag* NewCopy() const {return new CIccTagXYZ(*this);}
00468   virtual ~CIccTagXYZ();
00469 
00470   virtual bool IsArrayType() { return m_nSize > 1; }
00471 
00472   virtual icTagTypeSignature GetType() { return icSigXYZType; }
00473   virtual const icChar *GetClassName() { return "CIccTagXYZ"; }
00474 
00475   virtual void Describe(std::string &sDescription);
00476 
00477   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00478   virtual bool Write(CIccIO *pIO);
00479 
00480   icXYZNumber &operator[](icUInt32Number index) {return m_XYZ[index];}
00481   icXYZNumber *GetXYZ(icUInt32Number index) {return &m_XYZ[index];}
00482   icUInt32Number GetSize() const { return m_nSize; }
00483   void SetSize(icUInt32Number nSize, bool bZeroNew=true);
00484   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00485 
00486 protected:
00487   icXYZNumber *m_XYZ;
00488   icUInt32Number m_nSize;
00489 };
00490 
00498 class ICCPROFLIB_API CIccTagChromaticity : public CIccTag
00499 {
00500 public:
00501   CIccTagChromaticity(int nSize=3);
00502   CIccTagChromaticity(const CIccTagChromaticity &ITCh);
00503   CIccTagChromaticity &operator=(const CIccTagChromaticity &ChromTag);
00504   virtual CIccTag* NewCopy() const {return new CIccTagChromaticity(*this);}
00505   virtual ~CIccTagChromaticity();
00506 
00507   virtual bool IsArrayType() { return m_nChannels > 1; }
00508 
00509   virtual icTagTypeSignature GetType() { return icSigChromaticityType; }
00510   virtual const icChar *GetClassName() { return "CIccTagChromaticity"; }
00511 
00512   virtual void Describe(std::string &sDescription);
00513 
00514   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00515   virtual bool Write(CIccIO *pIO);
00516 
00517   icChromaticityNumber &operator[](icUInt32Number index) {return m_xy[index];}
00518   icChromaticityNumber *Getxy(icUInt32Number index) {return &m_xy[index];}
00519   icUInt32Number GetSize() const { return m_nChannels; }
00520   void SetSize(icUInt16Number nSize, bool bZeroNew=true);
00521 
00522   icUInt16Number m_nColorantType;
00523 
00524   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00525 
00526 protected:
00527   icUInt16Number m_nChannels;
00528   icChromaticityNumber *m_xy;
00529 };
00530 
00540 template <class T, icTagTypeSignature Tsig>
00541 class ICCPROFLIB_API CIccTagFixedNum : public CIccTag
00542 {
00543 public:
00544   CIccTagFixedNum(int nSize=1);
00545   CIccTagFixedNum(const CIccTagFixedNum &ITFN);
00546   CIccTagFixedNum &operator=(const CIccTagFixedNum &FixedNumTag);
00547   virtual CIccTag* NewCopy() { return new CIccTagFixedNum(*this); }
00548   virtual ~CIccTagFixedNum();
00549 
00550   virtual bool IsArrayType() { return m_nSize > 1; }
00551 
00552   virtual icTagTypeSignature GetType() { return Tsig; }
00553   virtual const icChar *GetClassName();
00554 
00555   virtual void Describe(std::string &sDescription);
00556 
00557   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00558   virtual bool Write(CIccIO *pIO);
00559 
00560   T &operator[](icUInt32Number index) {return m_Num[index];}
00561 
00563   icUInt32Number GetSize() const { return m_nSize; }
00564   void SetSize(icUInt32Number nSize, bool bZeroNew=true);
00565 
00566 protected:
00567   T *m_Num;
00568   icUInt32Number m_nSize;
00569 };
00570 
00578 typedef CIccTagFixedNum<icS15Fixed16Number, icSigS15Fixed16ArrayType> CIccTagS15Fixed16;
00579 
00587 typedef CIccTagFixedNum<icU16Fixed16Number, icSigU16Fixed16ArrayType> CIccTagU16Fixed16;
00588 
00598 template <class T, icTagTypeSignature Tsig>
00599 class ICCPROFLIB_API CIccTagNum : public CIccTag
00600 {
00601 public:
00602   CIccTagNum(int nSize=1);
00603   CIccTagNum(const CIccTagNum &ITNum);
00604   CIccTagNum &operator=(const CIccTagNum &NumTag);
00605   virtual CIccTag* NewCopy() { return new CIccTagNum(*this); }
00606   virtual ~CIccTagNum();
00607 
00608   virtual bool IsArrayType() { return m_nSize > 1; }
00609 
00610   virtual icTagTypeSignature GetType() { return Tsig; }
00611   virtual const icChar *GetClassName();
00612 
00613   virtual void Describe(std::string &sDescription);
00614 
00615   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00616   virtual bool Write(CIccIO *pIO);
00617 
00618   T &operator[](icUInt32Number index) {return m_Num[index];}
00619 
00621   icUInt32Number GetSize() const { return m_nSize; }
00622   void SetSize(icUInt32Number nSize, bool bZeroNew=true);
00623 
00624 protected:
00625   T *m_Num;
00626   icUInt32Number m_nSize;
00627 };
00628 
00636 typedef CIccTagNum<icUInt8Number, icSigUInt8ArrayType> CIccTagUInt8;
00637 
00645 typedef CIccTagNum<icUInt16Number, icSigUInt16ArrayType> CIccTagUInt16;
00646 
00654 typedef CIccTagNum<icUInt32Number, icSigUInt32ArrayType> CIccTagUInt32;
00655 
00663 typedef CIccTagNum<icUInt64Number, icSigUInt64ArrayType> CIccTagUInt64;
00664 
00665 
00666 
00674 class ICCPROFLIB_API CIccTagMeasurement : public CIccTag
00675 {
00676 public:
00677   CIccTagMeasurement();
00678   CIccTagMeasurement(const CIccTagMeasurement &ITM);
00679   CIccTagMeasurement &operator=(const CIccTagMeasurement &MeasTag);
00680   virtual CIccTag* NewCopy() const {return new CIccTagMeasurement(*this);}
00681   virtual ~CIccTagMeasurement();
00682 
00683   virtual icTagTypeSignature GetType() { return icSigMeasurementType; }
00684   virtual const icChar *GetClassName() { return "CIccTagMeasurement"; }
00685 
00686   virtual void Describe(std::string &sDescription);
00687 
00688   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00689   virtual bool Write(CIccIO *pIO);
00690   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00691 
00692 
00693   icMeasurement m_Data;
00694 };
00695 
00704 class ICCPROFLIB_API CIccLocalizedUnicode
00705 {
00706 public: //member functions
00707   CIccLocalizedUnicode();
00708   CIccLocalizedUnicode(const CIccLocalizedUnicode& ILU);
00709   CIccLocalizedUnicode &operator=(const CIccLocalizedUnicode &UnicodeText);
00710   virtual ~CIccLocalizedUnicode();
00711 
00712   icUInt32Number GetLength() const { return m_nLength; }
00713   icUInt16Number *GetBuf() const { return m_pBuf; }
00714 
00715   icUInt32Number GetAnsiSize();
00716   const icChar *GetAnsi(icChar *szBuf, icUInt32Number nBufSize);
00717   
00718   void SetSize(icUInt32Number);
00719 
00720   void SetText(const icChar *szText,
00721                icLanguageCode nLanguageCode = icLanguageCodeEnglish,
00722                icCountryCode nRegionCode = icCountryCodeUSA);
00723   void SetText(const icUInt16Number *sszUnicodeText,
00724                icLanguageCode nLanguageCode = icLanguageCodeEnglish,
00725                icCountryCode nRegionCode = icCountryCodeUSA);
00726 
00727   const icChar *operator=(const icChar *szText) { SetText(szText); return szText; }
00728   const icUInt16Number *operator=(const icUInt16Number *sszText) { SetText(sszText); return sszText; }
00729 
00730   //Data
00731   icLanguageCode m_nLanguageCode;
00732   icCountryCode m_nCountryCode;
00733 
00734 protected:
00735   icUInt32Number m_nLength;
00736 
00737   icUInt16Number *m_pBuf;
00738 
00739 };
00740 
00748 typedef std::list<CIccLocalizedUnicode> CIccMultiLocalizedUnicode;
00749 
00750 
00758 class ICCPROFLIB_API CIccTagMultiLocalizedUnicode : public CIccTag
00759 {
00760 public:
00761   CIccTagMultiLocalizedUnicode();
00762   CIccTagMultiLocalizedUnicode(const CIccTagMultiLocalizedUnicode& ITMLU);
00763   CIccTagMultiLocalizedUnicode &operator=(const CIccTagMultiLocalizedUnicode &MultiLocalizedTag);
00764   virtual CIccTag* NewCopy() const {return new CIccTagMultiLocalizedUnicode(*this);}
00765   virtual ~CIccTagMultiLocalizedUnicode();
00766 
00767   virtual icTagTypeSignature GetType() { return icSigMultiLocalizedUnicodeType; }
00768   virtual const icChar *GetClassName() { return "CIcciSigMultiLocalizedUnicode"; }
00769 
00770   virtual void Describe(std::string &sDescription);
00771 
00772   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00773   virtual bool Write(CIccIO *pIO);
00774   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00775 
00776   CIccLocalizedUnicode *Find(icLanguageCode nLanguageCode = icLanguageCodeEnglish,
00777                              icCountryCode nRegionCode = icCountryCodeUSA);
00778 
00779   void SetText(const icChar *szText,
00780                icLanguageCode nLanguageCode = icLanguageCodeEnglish,
00781                icCountryCode nRegionCode = icCountryCodeUSA);
00782   void SetText(const icUInt16Number *sszUnicodeText,
00783                icLanguageCode nLanguageCode = icLanguageCodeEnglish,
00784                icCountryCode nRegionCode = icCountryCodeUSA);
00785 
00786 
00787   CIccMultiLocalizedUnicode *m_Strings;
00788 };
00789 
00790 
00791 //
00792 // MD: Moved Curve & LUT Tags to IccTagLut.h (4-30-05)
00793 //
00794 
00802 class ICCPROFLIB_API CIccTagData : public CIccTag
00803 {
00804 public:
00805   CIccTagData(int nSize=1);
00806   CIccTagData(const CIccTagData &ITD);
00807   CIccTagData &operator=(const CIccTagData &DataTag);
00808   virtual CIccTag* NewCopy() const {return new CIccTagData(*this);}
00809   virtual ~CIccTagData();
00810 
00811   virtual icTagTypeSignature GetType() { return icSigDataType; }
00812   virtual const icChar *GetClassName() { return "CIccTagData"; }
00813 
00814   virtual bool IsArrayType() { return m_nSize > 1; }
00815 
00816   virtual void Describe(std::string &sDescription);
00817 
00818   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00819   virtual bool Write(CIccIO *pIO);
00820 
00821   icUInt32Number GetSize() const { return m_nSize; }
00822   void SetSize(icUInt32Number nSize, bool bZeroNew=true);
00823   icUInt8Number &operator[] (icUInt32Number index) { return m_pData[index]; }
00824   icUInt8Number *GetData(icUInt32Number index) { return &m_pData[index];}
00825 
00826   void SetTypeAscii(bool bIsAscii=true) { m_nDataFlag = bIsAscii ? icAsciiData : icBinaryData; }
00827   bool IsTypeAscii() { return m_nDataFlag == icAsciiData; }
00828   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00829 
00830 protected:
00831   icUInt32Number m_nDataFlag;
00832   icUInt8Number *m_pData;
00833   icUInt32Number m_nSize;
00834 };
00835 
00843 class ICCPROFLIB_API CIccTagDateTime : public CIccTag
00844 {
00845 public:
00846   CIccTagDateTime();
00847   CIccTagDateTime(const CIccTagDateTime &ITDT);
00848   CIccTagDateTime &operator=(const CIccTagDateTime &DateTimeTag);
00849   virtual CIccTag* NewCopy() const {return new CIccTagDateTime(*this);}
00850   virtual ~CIccTagDateTime();
00851 
00852   virtual icTagTypeSignature GetType() { return icSigDateTimeType; }
00853   virtual const icChar *GetClassName() { return "CIccTagDateTime"; }
00854 
00855   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00856   virtual bool Write(CIccIO *pIO);
00857 
00858   virtual void Describe(std::string &sDescription);
00859 
00860   void SetDateTime(icDateTimeNumber nDateTime) { m_DateTime = nDateTime;}
00861   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00862 
00863 protected:
00864   icDateTimeNumber m_DateTime;
00865 };
00866 
00874 class ICCPROFLIB_API CIccTagColorantOrder : public CIccTag
00875 {
00876 public:
00877   CIccTagColorantOrder(int nsize=1);
00878   CIccTagColorantOrder(const CIccTagColorantOrder &ITCO);
00879   CIccTagColorantOrder &operator=(const CIccTagColorantOrder &ColorantOrderTag);
00880   virtual CIccTag* NewCopy() const {return new CIccTagColorantOrder(*this);}
00881   virtual ~CIccTagColorantOrder();
00882 
00883   virtual icTagTypeSignature GetType() { return icSigColorantOrderType; }
00884   virtual const icChar *GetClassName() { return "CIccTagColorantOrder"; }
00885 
00886   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00887   virtual bool Write(CIccIO *pIO);
00888 
00889   virtual void Describe(std::string &sDescription);
00890   icUInt8Number& operator[](int index) { return m_pData[index]; }
00891   icUInt8Number *GetData(int index) { return &m_pData[index]; }
00892   void SetSize(icUInt16Number nsize, bool bZeronew=true);
00893   icUInt32Number GetSize() const {return m_nCount;}
00894   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00895 
00896 protected:
00897   icUInt32Number m_nCount;
00898   icUInt8Number *m_pData;
00899 };
00900 
00908 class ICCPROFLIB_API CIccTagColorantTable : public CIccTag
00909 {
00910 public:
00911   CIccTagColorantTable(int nsize=1);
00912   CIccTagColorantTable(const CIccTagColorantTable &ITCT);
00913   CIccTagColorantTable &operator=(const CIccTagColorantTable &ColorantTableTag);
00914   virtual CIccTag* NewCopy() const {return new CIccTagColorantTable(*this);}
00915   virtual ~CIccTagColorantTable();
00916 
00917   virtual icTagTypeSignature GetType() { return icSigColorantTableType; }
00918   virtual const icChar *GetClassName() { return "CIccTagColorantTable"; }
00919 
00920   virtual void Describe(std::string &sDescription);
00921 
00922   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00923   virtual bool Write(CIccIO *pIO);
00924 
00925   icColorantTableEntry &operator[](icUInt32Number index) {return m_pData[index];}
00926   icColorantTableEntry *GetEntry(icUInt32Number index) {return &m_pData[index];}
00927   icUInt32Number GetSize() const { return m_nCount; }
00928   void SetSize(icUInt16Number nSize, bool bZeroNew=true);
00929 
00930   void SetPCS(icColorSpaceSignature sig) {m_PCS = sig;}
00931   icColorSpaceSignature GetPCS() const {return m_PCS;};
00932   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00933 
00934 protected:
00935   icUInt32Number m_nCount;
00936   icColorantTableEntry *m_pData;
00937   icColorSpaceSignature m_PCS;
00938 };
00939 
00947 class ICCPROFLIB_API CIccTagViewingConditions : public CIccTag
00948 {
00949 public:
00950   CIccTagViewingConditions();
00951   CIccTagViewingConditions(const CIccTagViewingConditions &ITVC);
00952   CIccTagViewingConditions &operator=(const CIccTagViewingConditions &ViewCondTag);
00953   virtual CIccTag* NewCopy() const {return new CIccTagViewingConditions(*this);}
00954   virtual ~CIccTagViewingConditions();
00955 
00956   virtual icTagTypeSignature GetType() { return icSigViewingConditionsType; }
00957   virtual const icChar *GetClassName() { return "CIccTagViewingConditions"; }
00958 
00959   virtual void Describe(std::string &sDescription);
00960 
00961   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00962   virtual bool Write(CIccIO *pIO);
00963   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
00964 
00965   icXYZNumber m_XYZIllum;
00966   icXYZNumber m_XYZSurround;
00967   icIlluminant m_illumType;
00968 };
00969 
00979 class ICCPROFLIB_API CIccProfileDescText
00980 {
00981 public:
00982   CIccProfileDescText();
00983   CIccProfileDescText(const CIccProfileDescText& IPDC);
00984   CIccProfileDescText &operator=(const CIccProfileDescText &ProfDescText);
00985   virtual ~CIccProfileDescText();
00986 
00987   bool SetType(icTagTypeSignature nType);
00988   virtual icTagTypeSignature GetType() const;
00989 
00990   CIccTag* GetTag() const { return m_pTag; }
00991 
00992   virtual void Describe(std::string &sDescription);
00993 
00994   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00995   virtual bool Write(CIccIO *pIO);
00996 
00997   bool m_bNeedsPading;
00998 
00999 protected:
01000   CIccTag *m_pTag;  //either a CIccTagTextDescription or a CIccTagMultiLocalizedUnicode  
01001 };
01002 
01003 
01004 
01012 class ICCPROFLIB_API CIccProfileDescStruct
01013 {  
01014 public:
01015   CIccProfileDescStruct();
01016   CIccProfileDescStruct(const CIccProfileDescStruct& IPDS);
01017   CIccProfileDescStruct &operator=(const CIccProfileDescStruct& ProfDescStruct);
01018 
01019 
01020   icSignature                 m_deviceMfg;      /* Device Manufacturer */
01021   icSignature                 m_deviceModel;    /* Device Model */
01022   icUInt64Number              m_attributes;     /* Device attributes */
01023   icTechnologySignature       m_technology;     /* Technology signature */
01024   CIccProfileDescText         m_deviceMfgDesc;
01025   CIccProfileDescText         m_deviceModelDesc;
01026 };
01027 
01035 typedef std::list<CIccProfileDescStruct> CIccProfileSeqDesc;
01036 
01037 
01045 class ICCPROFLIB_API CIccTagProfileSeqDesc : public CIccTag
01046 {
01047 public:
01048   CIccTagProfileSeqDesc();
01049   CIccTagProfileSeqDesc(const CIccTagProfileSeqDesc &ITPSD);
01050   CIccTagProfileSeqDesc &operator=(const CIccTagProfileSeqDesc &ProfSeqDescTag);
01051   virtual CIccTag* NewCopy() const {return new CIccTagProfileSeqDesc(*this);}
01052   virtual ~CIccTagProfileSeqDesc();
01053 
01054   virtual icTagTypeSignature GetType() { return icSigProfileSequenceDescType; }
01055   virtual const icChar *GetClassName() { return "CIccTagProfileSeqDesc"; }
01056 
01057   virtual void Describe(std::string &sDescription);
01058 
01059   virtual bool Read(icUInt32Number size, CIccIO *pIO);
01060   virtual bool Write(CIccIO *pIO);
01061   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
01062 
01063   CIccProfileSeqDesc *m_Descriptions;
01064 };
01065 
01066 
01074 typedef std::list<icResponse16Number> CIccResponse16List;
01075 
01083 class ICCPROFLIB_API CIccResponseCurveStruct
01084 {
01085   friend class ICCPROFLIB_API CIccTagResponseCurveSet16;
01086 public: //member functions
01087   CIccResponseCurveStruct(const CIccResponseCurveStruct& IRCS);
01088   CIccResponseCurveStruct &operator=(const CIccResponseCurveStruct& RespCurveStruct);
01089   virtual ~CIccResponseCurveStruct();
01090 
01091   bool Read(icUInt32Number size, CIccIO *pIO);
01092   bool Write(CIccIO *pIO);
01093   void Describe(std::string &sDescription);
01094 
01095   icMeasurementUnitSig GetMeasurementType() const {return m_measurementUnitSig;}
01096   icUInt16Number GetNumChannels() const {return m_nChannels;}
01097 
01098   icXYZNumber *GetXYZ(icUInt32Number index) {return &m_maxColorantXYZ[index];}
01099   CIccResponse16List *GetResponseList(icUInt16Number nChannel) {return &m_Response16ListArray[nChannel];}
01100   CIccResponseCurveStruct* GetThis() {return this;}
01101   icValidateStatus Validate(std::string &sReport);
01102 
01103 protected:
01104   CIccResponseCurveStruct(icMeasurementUnitSig sig, icUInt16Number nChannels=0);
01105   CIccResponseCurveStruct(icUInt16Number nChannels=0);
01106 
01107   icUInt16Number m_nChannels;
01108   icMeasurementUnitSig m_measurementUnitSig;
01109   icXYZNumber *m_maxColorantXYZ;
01110   CIccResponse16List *m_Response16ListArray;
01111 };
01112 
01113 
01122 typedef std::list<CIccResponseCurveStruct> CIccResponseCurveSet;
01123 
01124 class CIccResponseCurveSetIter
01125 {
01126 public:
01127   bool inited;
01128   CIccResponseCurveSet::iterator item;
01129 };
01130 
01131 
01139 class ICCPROFLIB_API CIccTagResponseCurveSet16 : public CIccTag
01140 {
01141 public:
01142   CIccTagResponseCurveSet16();
01143   CIccTagResponseCurveSet16(const CIccTagResponseCurveSet16 &ITRCS);
01144   CIccTagResponseCurveSet16 &operator=(const CIccTagResponseCurveSet16 &RespCurveSet16Tag);
01145   virtual CIccTag* NewCopy() const {return new CIccTagResponseCurveSet16(*this);}
01146   virtual ~CIccTagResponseCurveSet16();
01147 
01148   virtual icTagTypeSignature GetType() { return icSigResponseCurveSet16Type; }
01149   virtual const icChar *GetClassName() { return "CIccTagResponseCurveSet16"; }
01150 
01151   virtual bool Read(icUInt32Number size, CIccIO *pIO);
01152   virtual bool Write(CIccIO *pIO);
01153   virtual void Describe(std::string &sDescription);
01154 
01155   void SetNumChannels(icUInt16Number nChannels);
01156   icUInt16Number GetNumChannels() const {return m_nChannels;}
01157 
01158   CIccResponseCurveStruct  *NewResponseCurves(icMeasurementUnitSig sig);
01159   CIccResponseCurveStruct *GetResponseCurves(icMeasurementUnitSig sig);
01160 
01161   CIccResponseCurveStruct *GetFirstCurves();
01162   CIccResponseCurveStruct *GetNextCurves();
01163 
01164   icUInt16Number GetNumResponseCurveTypes() const;
01165   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccProfile* pProfile=NULL) const;
01166  
01167 protected:
01168   CIccResponseCurveSet *m_ResponseCurves;
01169   icUInt16Number m_nChannels;
01170   CIccResponseCurveSetIter *m_Curve;
01171 };
01172 
01173 
01174 #ifdef USESAMPLEICCNAMESPACE
01175 } //namespace sampleICC
01176 #endif
01177 
01178 #endif // !defined(_ICCTAGBASIC_H)

Generated on Tue Jun 26 17:51:43 2007 for IccProfLib by  doxygen 1.3.9.1