coplfilr.h

Go to the documentation of this file.
00001 // $Id: coplfilr.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Corel Palette file filter
00099 
00100 #ifndef INC_COPLFILR
00101 #define INC_COPLFILR
00102 
00103 //#include "filters.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "colcomp.h"
00105 #include "impcol.h"
00106 //#include "colmodel.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "vector3d.h"
00108 
00109 class String_64;
00110 class SGDisplayLibColGroup;
00111 
00112 
00113 // Palette file colour name prefixes. These are stored in the gallery as 
00114 // a prefix ID and a suffix string - for thousands of entries this saves
00115 // heaps of memory.
00116 typedef enum
00117 {
00118     PalettePrefix_None = 0,
00119     PalettePrefix_Pantone,
00120     PalettePrefix_PantoneSpot,
00121     PalettePrefix_Focoltone,
00122     PalettePrefix_Trumatch,
00123     PalettePrefix_RGB,
00124 } PalettePrefix;
00125 
00126 
00127 /********************************************************************************************
00128 >   class PaletteFilter : public Filter
00129 
00130     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00131     Created:    30/4/96
00132     Purpose:    Base class for all palette filters
00133 ********************************************************************************************/
00134 
00135 class PaletteFilter : public Filter
00136 {
00137     CC_DECLARE_DYNAMIC(PaletteFilter);
00138 
00139 public:
00140     PaletteFilter();
00141     ~PaletteFilter();
00142     
00143 // Standard filter overrides
00144 public:
00145     virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
00146 
00147     virtual BOOL DoImport(SelOperation*, CCLexFile*, Document*, BOOL AutoChosen = FALSE,
00148                             ImportPosition *Pos = NULL,
00149                             KernelBitmap** ppImportedBitmap = NULL,
00150                             DocCoord* pPosTranslate = NULL, String_256* = NULL);
00151     BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*, BOOL);
00152 
00153     inline static double ClampZeroToOne(const double input) { return (input < 0 ? 0 : (input > 1 ? 1 : input)); }
00154 
00155 // Lab to CIE helpers from Mike
00156 public:
00157     static void ConvertLABToRGB(const Vector3D& icol, Vector3D* ocol);
00158 protected:
00159     static void ConvertCIEtoXYZ(const Vector3D& icol, Vector3D& ocol);
00160     static void ConvertLABtoXYZ(const Vector3D& white, const Vector3D& icol, Vector3D& ocol);
00161     static void ConvertXYZToRGB(const Vector3D& icol, Vector3D& ocol);
00162 
00163 // Processing functions
00164 protected:
00165     virtual BOOL PreImport() = 0;
00166     virtual BOOL ImportPalette() = 0;
00167     virtual BOOL PostImport() = 0;
00168 
00169     BOOL StartPercentage(INT32 UpTo = -1);
00170     BOOL SetPercentage(INT32 GotTo = -1);
00171     BOOL ProcessRGBColour(double Red, double Green, double Blue, const StringBase* pColName = NULL);
00172     BOOL ProcessCMYKColour(double Cyan, double Magenta, double Yellow, double Key, const StringBase* pColName = NULL);
00173     BOOL ProcessHSVColour(double Hue, double Sat, double Value, const StringBase* pColName = NULL);
00174     BOOL ProcessLabColour(double Luminance, double A, double B, const StringBase* pColName = NULL);
00175     BOOL ProcessGreyColour(double Intensity, const StringBase* pColName = NULL);
00176     BOOL NameRGBColour(ColourRGBT* pColour, StringBase* pName);
00177     BOOL NameCMYKColour(ColourCMYK* pColour, StringBase* pName);
00178     BOOL NameHSVColour(ColourHSVT* pColour, StringBase* pName);
00179     BOOL NameGreyColour(ColourGreyT* pColour, StringBase* pName);
00180     BOOL UsePercentageColour();
00181 
00182 protected:
00183     BOOL AddColourToGallery(PalettePrefix Prefix, String_64 *Name,
00184                             ColourGeneric *Definition, ColourModel Model,
00185                             BOOL NewlineAfter = FALSE, BOOL IsSpotColour = FALSE);
00186 
00187 // Base class functionality hidden from derived classes
00188 private:
00189     BOOL PrepareForImport();
00190     BOOL FinishImport(BOOL Success);
00191 
00192 protected:
00193     ImportedColours* m_pNewColours;
00194     SelOperation* m_pImportOp;
00195     CCLexFile* m_pImportFile;
00196     Document* m_pImportDoc;
00197 
00198     BOOL ImportIntoGallery;         // TRUE if we import directly into the colour gallery
00199     SGDisplayLibColGroup *CurrentGalleryGroup;
00200 };
00201 
00202 
00203 /********************************************************************************************
00204 >   class MSPaletteFilter : public PaletteFilter
00205 
00206     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00207     Created:    30/4/96
00208     Purpose:    Microsoft Windows palette filter
00209 ********************************************************************************************/
00210 class MSPaletteFilter : public PaletteFilter
00211 {
00212     CC_DECLARE_DYNAMIC(MSPaletteFilter);
00213 
00214 public:
00215     MSPaletteFilter();
00216     ~MSPaletteFilter();
00217 
00218 // Virtual overrides
00219     BOOL Init();
00220     INT32 HowCompatible(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00221     
00222 // Processing functions
00223 public:
00224     virtual BOOL PreImport();
00225     virtual BOOL ImportPalette();
00226     virtual BOOL PostImport();
00227 
00228 protected:
00229     UINT32 m_NumToImport;
00230 };
00231 
00232 
00233 /********************************************************************************************
00234 >   class PaintShopProPaletteFilter : public PaletteFilter
00235 
00236     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00237     Created:    30/4/96
00238     Purpose:    Microsoft Windows palette filter
00239 ********************************************************************************************/
00240 class PaintShopProPaletteFilter : public PaletteFilter
00241 {
00242     CC_DECLARE_DYNAMIC(PaintShopProPaletteFilter);
00243 
00244 public:
00245     PaintShopProPaletteFilter();
00246     ~PaintShopProPaletteFilter();
00247 
00248 // Virtual overrides
00249     BOOL Init();
00250     INT32 HowCompatible(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00251     
00252 // Processing functions
00253 public:
00254     virtual BOOL PreImport();
00255     virtual BOOL ImportPalette();
00256     virtual BOOL PostImport();
00257 
00258 protected:
00259     UINT32 m_NumToImport;
00260 };
00261 
00262 
00263 /********************************************************************************************
00264 >   class AdobeColourTableFilter : public PaletteFilter
00265 
00266     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00267     Created:    1/5/96
00268     Purpose:    Adobe Colour Table palette filter
00269 ********************************************************************************************/
00270 class AdobeColourTableFilter : public PaletteFilter
00271 {
00272     CC_DECLARE_DYNAMIC(AdobeColourTableFilter);
00273 
00274 public:
00275     AdobeColourTableFilter();
00276     ~AdobeColourTableFilter();
00277 
00278 // Virtual overrides
00279     BOOL Init();
00280     INT32 HowCompatible(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00281     
00282 // Processing functions
00283 public:
00284     virtual BOOL PreImport();
00285     virtual BOOL ImportPalette();
00286     virtual BOOL PostImport();
00287 };
00288 
00289 
00290 
00291 /********************************************************************************************
00292 >   class AdobeColourSwatchFilter : public PaletteFilter
00293 
00294     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00295     Created:    2/5/96
00296     Purpose:    Adobe Colour Swatch palette filter
00297 ********************************************************************************************/
00298 class AdobeColourSwatchFilter : public PaletteFilter
00299 {
00300     CC_DECLARE_DYNAMIC(AdobeColourSwatchFilter);
00301 
00302 public:
00303     AdobeColourSwatchFilter();
00304     ~AdobeColourSwatchFilter();
00305 
00306 // Virtual overrides
00307     BOOL Init();
00308     INT32 HowCompatible(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00309     
00310 // Processing functions
00311 public:
00312     virtual BOOL PreImport();
00313     virtual BOOL ImportPalette();
00314     virtual BOOL PostImport();
00315 
00316 protected:
00317     WORD ReverseWord(WORD Orig);
00318 
00319 protected:
00320     UINT32 m_NumToImport;
00321     BOOL m_MetUnknownModel;
00322 };
00323 
00324 
00325 
00326 
00327 /********************************************************************************************
00328 >   class CorelPaletteFilter : public PaletteFilter
00329 
00330     Author:     Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>      
00331     Created:    15 03 95    
00332     Purpose:    Corel Palette file importing class  
00333 ********************************************************************************************/
00334 class CorelPaletteFilter : public PaletteFilter
00335 {
00336     CC_DECLARE_DYNAMIC(CorelPaletteFilter);
00337 
00338 public:
00339     CorelPaletteFilter();
00340 
00341 //  Virtual overrides
00342 public:
00343     BOOL Init();
00344     INT32 HowCompatible(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00345 
00346 // Processing functions
00347 public:
00348     virtual BOOL PreImport();
00349     virtual BOOL ImportPalette();
00350     virtual BOOL PostImport();
00351 
00352 protected:
00353     INT32 HowCompatible4(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize,  UINT32 FileSize);
00354     INT32 HowCompatible5(PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize,  UINT32 FileSize);
00355     BOOL DoImport4();
00356     BOOL DoImport5();
00357 
00358 // Member variables
00359 protected:
00360     INT32 m_FileVersion;
00361 };
00362 
00363 
00364 /********************************************************************************************
00365 
00366 >   class JCWColourFilter : public PaletteFilter
00367 
00368     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00369     Created:    30/8/96
00370 
00371     Purpose:    Load's Jason's private palette file format
00372 
00373 ********************************************************************************************/
00374 
00375 class JCWColourFilter : public PaletteFilter
00376 {
00377     CC_DECLARE_DYNAMIC(JCWColourFilter);
00378 
00379 public:
00380     JCWColourFilter();
00381     ~JCWColourFilter();
00382 
00383 // Virtual overrides
00384     BOOL Init();
00385     INT32 HowCompatible(PathName& Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00386     
00387 // Processing functions
00388 public:
00389     virtual BOOL PreImport();
00390     virtual BOOL ImportPalette();
00391     virtual BOOL PostImport();
00392 
00393 protected:
00394     UINT32 m_NumToImport;
00395     BOOL m_ColoursAreSpots;
00396 };
00397 
00398 #endif  // INC_COPLFILR

Generated on Sat Nov 10 03:44:54 2007 for Camelot by  doxygen 1.4.4