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

IccMpeBasic.h

Go to the documentation of this file.
00001 
00012 /*
00013 * The ICC Software License, Version 0.1
00014 *
00015 *
00016 * Copyright (c) 2005 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 // -Jan 30, 2005 
00076 //  Initial CIccMpe prototype development
00077 //
00078 // -Nov 6, 2006
00079 //  Prototype Merged into release
00080 //
00082 
00083 #ifndef _ICCELEMBASIC_H
00084 #define _ICCELEMBASIC_H
00085 
00086 #include "IccTagMPE.h"
00087 
00088 
00089 //CIccFloatTag support
00090 #ifdef USESAMPLEICCNAMESPACE
00091 namespace sampleICC {
00092 #endif
00093 
00101 class CIccCurveSegment
00102 {
00103 public:
00104   virtual ~CIccCurveSegment() {}
00105 
00106   static CIccCurveSegment* Create(icCurveSegSignature sig, icFloatNumber start, icFloatNumber end);
00107   virtual CIccCurveSegment* NewCopy() const = 0;
00108 
00109   virtual icCurveSegSignature GetType() const = 0;
00110   virtual const icChar *GetClassName() const = 0;
00111 
00112   virtual void Describe(std::string &sDescription)=0;
00113 
00114   virtual bool Read(icUInt32Number size, CIccIO *pIO)=0;
00115   virtual bool Write(CIccIO *pIO)=0;
00116 
00117   virtual bool Begin() = 0;
00118   virtual icFloatNumber Apply(icFloatNumber v)=0;
00119 
00120   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const = 0;
00121 
00122   icFloatNumber StartPoint() { return m_startPoint; }
00123   icFloatNumber EndPoint() { return m_endPoint;}
00124 
00125 protected:
00126   icFloatNumber m_startPoint;
00127   icFloatNumber m_endPoint;
00128   icUInt32Number m_nReserved;
00129 };
00130 
00131 
00139 class CIccFormulaCurveSegment : public CIccCurveSegment
00140 {
00141 public:
00142   CIccFormulaCurveSegment(icFloatNumber start, icFloatNumber end);
00143   CIccFormulaCurveSegment(const CIccFormulaCurveSegment &seg);
00144   CIccFormulaCurveSegment &operator=(const CIccFormulaCurveSegment &seg);
00145   virtual CIccCurveSegment *NewCopy() const { return new CIccFormulaCurveSegment(*this);}
00146   virtual ~CIccFormulaCurveSegment();
00147 
00148   virtual icCurveSegSignature GetType() const { return icSigFormulaCurveSeg; }
00149   virtual const icChar *GetClassName() const { return "CIccFormulaCurveSegment"; }
00150 
00151   virtual void Describe(std::string &sDescription);
00152 
00153   void SetFunction(icUInt16Number functionType, icUInt8Number num_parameters, icFloatNumber *parameters);
00154 
00155   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00156   virtual bool Write(CIccIO *pIO);
00157 
00158   virtual bool Begin();
00159   virtual icFloatNumber Apply(icFloatNumber v);
00160   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const;
00161 
00162 protected:
00163   icUInt8Number m_nParameters;
00164   icUInt16Number m_nFunctionType;
00165   icFloatNumber *m_params;
00166 };
00167 
00168 
00176 class CIccSampledCurveSegment : public CIccCurveSegment
00177 {
00178 public:
00179   CIccSampledCurveSegment(icFloatNumber start, icFloatNumber end);
00180   CIccSampledCurveSegment(const CIccSampledCurveSegment &ITPC);
00181   CIccSampledCurveSegment &operator=(const CIccSampledCurveSegment &ParamCurveTag);
00182   virtual CIccCurveSegment *NewCopy() const { return new CIccSampledCurveSegment(*this);}
00183   virtual ~CIccSampledCurveSegment();
00184 
00185   virtual icCurveSegSignature GetType() const { return icSigSampledCurveSeg; }
00186   virtual const icChar *GetClassName() const { return "CIccSampledCurveSegment"; }
00187 
00188   virtual bool SetSize(icUInt32Number nSize, bool bZeroAlloc=true);
00189   virtual icUInt32Number GetSize() { return m_nCount; }
00190 
00191   virtual icFloatNumber *GetSamples() { return m_pSamples; }
00192 
00193   virtual void Describe(std::string &sDescription);
00194 
00195   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00196   virtual bool Write(CIccIO *pIO);
00197 
00198   virtual bool Begin();
00199   virtual icFloatNumber Apply(icFloatNumber v);
00200   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const ;
00201 
00202 protected:
00203   icUInt32Number m_nCount;
00204   icFloatNumber *m_pSamples;
00205 
00206   icFloatNumber m_range;
00207   icFloatNumber m_last;
00208 };
00209 
00210 
00218 class CIccCurveSetCurve
00219 {
00220 public:
00221   virtual ~CIccCurveSetCurve() {}
00222   
00223   static CIccCurveSetCurve *Create(icCurveElemSignature sig);
00224   virtual CIccCurveSetCurve *NewCopy() const = 0;
00225 
00226   virtual icCurveElemSignature GetType() const = 0;
00227   virtual const icChar *GetClassName() const = 0;
00228 
00229   virtual void Describe(std::string &sDescription) = 0;
00230 
00231   virtual bool Read(icUInt32Number size, CIccIO *pIO) = 0;
00232   virtual bool Write(CIccIO *pIO) = 0;
00233 
00234   virtual bool Begin() = 0;
00235   virtual icFloatNumber Apply(icFloatNumber v) = 0; 
00236   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const = 0;
00237 
00238 protected:
00239 };
00240 
00241 typedef std::list<CIccCurveSegment*> CIccCurveSegmentList;
00242 
00250 class CIccSegmentedCurve : public CIccCurveSetCurve
00251 {
00252 public:
00253   CIccSegmentedCurve();
00254   CIccSegmentedCurve(const CIccSegmentedCurve &ITPC);
00255   CIccSegmentedCurve &operator=(const CIccSegmentedCurve &ParamCurveTag);
00256   virtual CIccCurveSetCurve *NewCopy() const { return new CIccSegmentedCurve(*this);}
00257   virtual ~CIccSegmentedCurve();
00258 
00259   virtual icCurveElemSignature GetType() const { return icSigSementedCurve; }
00260   virtual const icChar *GetClassName() const { return "CIccSegmentedCurve"; }
00261 
00262   virtual void Describe(std::string &sDescription);
00263 
00264   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00265   virtual bool Write(CIccIO *pIO);
00266 
00267   void Reset();
00268   bool Insert(CIccCurveSegment *pCurveSegment);
00269 
00270   virtual bool Begin();
00271   virtual icFloatNumber Apply(icFloatNumber v);
00272   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const;
00273 
00274 protected:
00275   CIccCurveSegmentList *m_list;
00276   icUInt32Number m_nReserved1;
00277   icUInt32Number m_nReserved2;
00278 };
00279 
00280 typedef CIccCurveSetCurve* icCurveSetCurvePtr;
00281 
00289 class CIccMpeCurveSet : public CIccMultiProcessElement
00290 {
00291 public:
00292   CIccMpeCurveSet(int nSize=0);
00293   CIccMpeCurveSet(const CIccMpeCurveSet &curveSet);
00294   CIccMpeCurveSet &operator=(const CIccMpeCurveSet &curveSet);
00295   virtual CIccMultiProcessElement *NewCopy() const { return new CIccMpeCurveSet(*this);}
00296   virtual ~CIccMpeCurveSet();
00297 
00298   void SetSize(int nNewSize);
00299 
00300   bool SetCurve(int nIndex, icCurveSetCurvePtr newCurve);
00301 
00302   virtual icElemTypeSignature GetType() const { return icSigCurveSetElemType; }
00303   virtual const icChar *GetClassName() const { return "CIccMpeCurveSet"; }
00304 
00305   virtual void Describe(std::string &sDescription);
00306 
00307   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00308   virtual bool Write(CIccIO *pIO);
00309 
00310   virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE);
00311   virtual void Apply(icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel);
00312   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const;
00313 
00314 protected:
00315   icCurveSetCurvePtr *m_curve;
00316 
00317   icPositionNumber *m_position;
00318 };
00319 
00320 
00321 typedef enum {
00322   ic3x3Matrix,
00323   ic3x4Matrix,
00324   ic4x3Matrix,
00325   ic4x4Matrix,
00326   icOtherMatrix
00327 } icMatrixElemType;
00328 
00336 class CIccMpeMatrix : public CIccMultiProcessElement
00337 {
00338 public:
00339   CIccMpeMatrix();
00340   CIccMpeMatrix(const CIccMpeMatrix &ITPC);
00341   CIccMpeMatrix &operator=(const CIccMpeMatrix &ParamCurveTag);
00342   virtual CIccMultiProcessElement *NewCopy() const { return new CIccMpeMatrix(*this);}
00343   virtual ~CIccMpeMatrix();
00344 
00345   virtual icElemTypeSignature GetType() const { return icSigMatrixElemType; }
00346   virtual const icChar *GetClassName() const { return "CIccMpeMatrix"; }
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   void SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels);
00354 
00355   icFloatNumber *GetMatrix() {return m_pMatrix;}
00356   icFloatNumber *GetConstants() {return m_pConstants;}
00357 
00358   virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE);
00359   virtual void Apply(icFloatNumber *dstPixel, const icFloatNumber *srcPixel);
00360   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const;
00361 
00362 protected:
00363   icFloatNumber *m_pMatrix;
00364   icFloatNumber *m_pConstants;
00365   icUInt32Number m_size;
00366   icMatrixElemType m_type;
00367 };
00368 
00369 typedef enum {
00370   ic3dInterpTetra,
00371   ic3dInterp,
00372   ic4dInterp,
00373   ic5dInterp,
00374   ic6dInterp,
00375   icNdInterp,
00376 } icCLUTElemType;
00377 
00385 class CIccMpeCLUT : public CIccMultiProcessElement
00386 {
00387 public:
00388   CIccMpeCLUT();
00389   CIccMpeCLUT(const CIccMpeCLUT &clut);
00390   CIccMpeCLUT &operator=(const CIccMpeCLUT &clut);
00391   virtual CIccMultiProcessElement *NewCopy() const { return new CIccMpeCLUT(*this);}
00392   virtual ~CIccMpeCLUT();
00393 
00394   virtual icElemTypeSignature GetType() const { return icSigCLutElemType; }
00395   virtual const icChar *GetClassName() const { return "CIccMpeCLUT"; }
00396 
00397   virtual void Describe(std::string &sDescription);
00398 
00399   virtual bool Read(icUInt32Number size, CIccIO *pIO);
00400   virtual bool Write(CIccIO *pIO);
00401 
00402   virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE);
00403   virtual void Apply(icFloatNumber *dstPixel, const icFloatNumber *srcPixel);
00404   virtual icValidateStatus Validate(icTagSignature sig, std::string &sReport, const CIccTagMultiProcessElement* pMPE=NULL) const;
00405 
00406   CIccCLUT *GetCLUT() { return m_pCLUT; }
00407   void SetCLUT(CIccCLUT *pCLUT);
00408 
00409 protected:
00410   CIccCLUT *m_pCLUT;
00411   icCLUTElemType m_interpType;
00412 };
00413 
00414 
00415 //CIccMPElements support
00416 #ifdef USESAMPLEICCNAMESPACE
00417 }
00418 #endif
00419 
00420 #endif //_ICCELEMBASIC_H

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