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

IccProfile.h

Go to the documentation of this file.
00001 
00011 /*
00012  * The ICC Software License, Version 0.1
00013  *
00014  *
00015  * Copyright (c) 2003-2006 The International Color Consortium. All rights 
00016  * reserved.
00017  *
00018  * Redistribution and use in source and binary forms, with or without
00019  * modification, are permitted provided that the following conditions
00020  * are met:
00021  *
00022  * 1. Redistributions of source code must retain the above copyright
00023  *    notice, this list of conditions and the following disclaimer. 
00024  *
00025  * 2. Redistributions in binary form must reproduce the above copyright
00026  *    notice, this list of conditions and the following disclaimer in
00027  *    the documentation and/or other materials provided with the
00028  *    distribution.
00029  *
00030  * 3. The end-user documentation included with the redistribution,
00031  *    if any, must include the following acknowledgment:  
00032  *       "This product includes software developed by the
00033  *        The International Color Consortium (www.color.org)"
00034  *    Alternately, this acknowledgment may appear in the software itself,
00035  *    if and wherever such third-party acknowledgments normally appear.
00036  *
00037  * 4. In the absence of prior written permission, the names "ICC" and "The
00038  *    International Color Consortium" must not be used to imply that the
00039  *    ICC organization endorses or promotes products derived from this
00040  *    software.
00041  *
00042  *
00043  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00044  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00045  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00046  * DISCLAIMED.  IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
00047  * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00048  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00049  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00050  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00051  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00052  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00053  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00054  * SUCH DAMAGE.
00055  * ====================================================================
00056  *
00057  * This software consists of voluntary contributions made by many
00058  * individuals on behalf of the The International Color Consortium. 
00059  *
00060  *
00061  * Membership in the ICC is encouraged when this software is used for
00062  * commercial purposes. 
00063  *
00064  *  
00065  * For more information on The International Color Consortium, please
00066  * see <http://www.color.org/>.
00067  *  
00068  * 
00069  */
00070 
00072 // HISTORY:
00073 //
00074 // -Initial implementation by Max Derhak 5-15-2003
00075 //
00077 
00078 #if !defined(_ICCPROFILE_H)
00079 #define _ICCPROFILE_H
00080 
00081 #include "IccDefs.h"
00082 #include <list>
00083 #include <string>
00084 
00085 #ifdef USESAMPLEICCNAMESPACE
00086 namespace sampleICC {
00087 #endif
00088 
00089 class ICCPROFLIB_API CIccTag;
00090 class ICCPROFLIB_API CIccIO;
00091 
00101 struct IccTagEntry
00102 {
00103 
00104   icTag TagInfo;
00105   CIccTag* pTag;
00106 };
00107 
00116 typedef std::list<IccTagEntry> TagEntryList;
00117 
00125 typedef struct {CIccTag *ptr;} IccTagPtr;
00126 
00135 typedef std::list<IccTagPtr> TagPtrList;
00136 
00146 class ICCPROFLIB_API CIccProfile  
00147 {
00148 public:
00149   CIccProfile();
00150   CIccProfile(const CIccProfile &Profile);
00151   CIccProfile &operator=(const CIccProfile &Profile);
00152   virtual ~CIccProfile();
00153 
00154   icHeader m_Header;
00155 
00156   TagEntryList *m_Tags;
00157 
00158   CIccTag* FindTag(icSignature sig);
00159   bool AttachTag(icSignature sig, CIccTag *pTag);
00160   bool DeleteTag(icSignature sig);
00161 
00162   bool Attach(CIccIO *pIO);
00163   bool Detach();
00164   bool Read(CIccIO *pIO);
00165   icValidateStatus ReadValidate(CIccIO *pIO, std::string &sReport);
00166   bool Write(CIccIO *pIO);
00167 
00168   void InitHeader();
00169   icValidateStatus Validate(std::string &sReport) const;
00170 
00171   icUInt16Number GetSpaceSamples() const;
00172 
00173   bool AreTagsUnique() const;
00174 
00175 protected:
00176 
00177   void Cleanup();
00178   IccTagEntry* GetTag(icSignature sig) const;
00179   IccTagEntry* GetTag(CIccTag *pTag) const;
00180   bool ReadBasic(CIccIO *pIO);
00181   bool LoadTag(IccTagEntry *pTagEntry, CIccIO *pIO);
00182   bool DetachTag(CIccTag *pTag);
00183 
00184   // Profile Validation functions
00185   icValidateStatus CheckRequiredTags(std::string &sReport) const;
00186   bool CheckTagExclusion(std::string &sReport) const;
00187   icValidateStatus CheckHeader(std::string &sReport) const;
00188   icValidateStatus CheckTagTypes(std::string &sReport) const;
00189   bool IsTypeValid(icTagSignature tagSig, icTagTypeSignature typeSig) const;
00190   bool CheckFileSize(CIccIO *pIO) const;
00191 
00192   CIccIO *m_pAttachIO;
00193 
00194   TagPtrList *m_TagVals;
00195 };
00196 
00197 CIccProfile ICCPROFLIB_API *ReadIccProfile(const icChar *szFilename);
00198 CIccProfile ICCPROFLIB_API *ReadIccProfile(const icUInt8Number *pMem, icUInt32Number nSize);
00199 CIccProfile ICCPROFLIB_API *OpenIccProfile(const icChar *szFilename);
00200 CIccProfile ICCPROFLIB_API *OpenIccProfile(const icUInt8Number *pMem, icUInt32Number nSize);  //pMem must be available for entire life of returned CIccProfile Object
00201 CIccProfile ICCPROFLIB_API *ValidateIccProfile(const icChar *szFilename, std::string &sReport, icValidateStatus &nStatus);
00202 
00203 bool ICCPROFLIB_API SaveIccProfile(const icChar *szFilename, CIccProfile *pIcc);
00204 
00205 void ICCPROFLIB_API CalcProfileID(CIccIO *pIO, icProfileID *profileID);
00206 bool ICCPROFLIB_API CalcProfileID(const icChar *szFilename, icProfileID *profileID);
00207 
00208 #ifdef USESAMPLEICCNAMESPACE
00209 } //namespace sampleICC
00210 #endif
00211 
00212 #endif // !defined(_ICCPROFILE_H)

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