cameleps.h

Go to the documentation of this file.
00001 // $Id: cameleps.h 1398 2006-07-02 19:23:26Z 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 
00099 // Camelot Native EPS format filter
00100 
00101 #ifndef INC_CAMELEPS
00102 #define INC_CAMELEPS
00103 
00104 #include "aw_eps.h"
00105 //#include "epsfiltr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "saveeps.h"
00107 #include "nodemold.h"
00108 //#include "rrcaps.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 
00110 class KernelBitmap;
00111 class OILBitmap;
00112 class NodeRegularShape;
00113 class CCAttrMap;
00114 class ColourContext;
00115 
00116 typedef enum
00117 {
00118     PENDING_BITMAP_NONE,
00119     PENDING_BITMAP_FILL,
00120     PENDING_BITMAP_TRANSPFILL,
00121     PENDING_BITMAP_OBJECT,
00122     PENDING_BITMAP_POOLITEM,
00123     PENDING_BITMAP_OBJECT_FILL
00124 } PendingBitmap;
00125 
00126 typedef enum
00127 {
00128     CAMEPS_FILL_LINEAR = 1,
00129     CAMEPS_FILL_ELLIPTICAL,
00130     CAMEPS_FILL_CIRCULAR,
00131     CAMEPS_FILL_CONICAL,
00132     CAMEPS_FILL_BITMAP,
00133     CAMEPS_FILL_FRACTAL,
00134     CAMEPS_FILL_NEWLINEAR,
00135     CAMEPS_FILL_NEWBITMAP
00136 } CamelotEPSFillType;
00137 
00138 
00139 // cso/ceo enumerated tags
00140 enum
00141 {
00142     EOTAG_FONTFLAGS = 1,
00143     EOTAG_BITMAPFLAGS,
00144     EOTAG_TEXTWRAPPED,
00145     EOTAG_FONTTYPE,
00146     EOTAG_GUIDELAYER,
00147     EOTAG_GUIDELINE,
00148     EOTAG_MOULDTHRESHOLD
00149 };
00150 
00151 
00152 // All the commands used by Camelot EPS files.
00153 enum
00154 {
00155     // Chromatic fill geometries
00156     EPSC_caz = EPSC_aes + 1,
00157     EPSC_cax,
00158 
00159     // Transparent fill geometries
00160     EPSC_cxt,
00161 
00162     // Chromatic fill effects
00163     EPSC_cxe,
00164 
00165     // Chromatic fill mappings
00166     EPSC_cxm,
00167 
00168     // Transparent fill mappings
00169     EPSC_cxmt,
00170 
00171     // Bitmap objects/bitmap fills
00172     EPSC_cbm,
00173     EPSC_csbm,
00174     EPSC_cebm,
00175 
00176     // Line/Fill colours
00177     EPSC_cx,
00178     EPSC_cX,
00179     EPSC_ck,
00180     EPSC_cK,
00181 
00182     // Stroke transparency
00183     EPSC_cst,
00184 
00185     // Arrow heads
00186     EPSC_csah,
00187     EPSC_ceah,
00188 
00189     // Dash Patterns
00190     EPSC_cdp,
00191 
00192     // Blends
00193     EPSC_csbd,
00194     EPSC_cebd,
00195     EPSC_csbr,
00196     EPSC_cebr,
00197 
00198     // Regular shapes
00199     EPSC_csrs,
00200     EPSC_crsp,
00201     EPSC_crstm,
00202     EPSC_crsp1,
00203     EPSC_crsp2,
00204     EPSC_cers,
00205 
00206     // Mould commands
00207     EPSC_csev,
00208     EPSC_ceev,
00209     EPSC_cspr,
00210     EPSC_cepr,
00211     EPSC_csmp,
00212     EPSC_cemp,
00213     EPSC_csso,
00214     EPSC_ceso,
00215     EPSC_csdo,
00216     EPSC_cedo,
00217 
00218     // Text native commands
00219     EPSC_ctf,
00220     EPSC_ctb,
00221     EPSC_cti,
00222     EPSC_cts,
00223     EPSC_ctp,
00224     EPSC_ctls,
00225 
00226     EPSC_cso,
00227     EPSC_ceo,
00228     EPSC_cfft,  // font flags token
00229     EPSC_cftf,  // Type of font
00230     EPSC_cbot,  // Bitmap object token
00231 
00232     // Renderable bitmap tokens
00233     EPSC_cpal,  // Bitmap palette token
00234 
00235     // Guide layer & guidelines
00236     EPSC_glyr,
00237     EPSC_glne,
00238 
00239     EPSC_cmth,  // mould threshold token
00240 
00241     EPSC_cag,   // new grey level geometric fill operator
00242 
00243     // Another bitmap token
00244     EPSC_cbti,  // Bitmap transparency index
00245 
00246     // Sentinel - leave this one last
00247     EPSC_cameps_last
00248 };
00249 
00250 
00251 /********************************************************************************************
00252 
00253 >   class CamelotEPSFilter : public ArtWorksEPSFilter
00254 
00255     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00256     Created:    08/03/94
00257     Purpose:    A filter that imports EPS files in Camelot EPS format.
00258     SeeAlso:    EPSFilter; ArtWorksEPSFilter
00259 
00260 ********************************************************************************************/
00261 
00262 class CamelotEPSFilter : public ArtWorksEPSFilter
00263 {
00264     CC_DECLARE_DYNAMIC(CamelotEPSFilter);
00265     
00266 public:
00267     CamelotEPSFilter();
00268     BOOL Init();
00269     BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
00270     BOOL PrepareToExport(CCLexFile*, Spread* pSpread);
00271     TCHAR* GetEPSCommand(EPSCommand Cmd);
00272     BOOL ExportBitmap(KernelBitmap&);
00273     
00274     // This filter can include a Preview Bmp
00275     virtual BOOL CanIncludePreviewBmp();
00276 
00277 protected:
00278     virtual void LookUpToken();
00279     virtual BOOL ProcessToken();
00280     INT32 EPSHeaderIsOk(ADDR pFileHeader, UINT32 HeaderSize);
00281     BOOL PrepareToImport();
00282     void CleanUpAfterImport(BOOL Successful);
00283 
00284     virtual BOOL GetExportOptions( );
00285 
00286     PendingBitmap       m_PendingBitmap;
00287     INT32               BitmapTransparencyIndex;
00288     virtual BOOL ReadBitmap();
00289     virtual void BitmapPoolAttach(KernelBitmap* pBitmap);
00290     KernelBitmap *pBitmap;
00291 
00292     NodeRegularShape *pRegularShape;
00293     BOOL RegularShapeIsFilled;
00294     BOOL RegularShapeIsStroked;
00295 
00296     struct _BitmapAttrs
00297     {
00298         DocCoord Coords[3];
00299 
00300         DocColour StartCol;
00301         DocColour EndCol;
00302 
00303         UINT32   TranspType;    // Only needed for transparent bitmap fills
00304         UINT32   Transp;        // Only needed for transparent bitmap fills
00305         UINT32   EndTransp;     // Only needed for transparent bitmap fills
00306 
00307     } BitmapAttrs;
00308 
00309     // Blend and blender processing functions
00310     BOOL ProcessBlend();
00311     BOOL ProcessBlender();
00312     BOOL StartBlend();
00313     BOOL StartBlender();
00314     BOOL EndBlend();
00315     BOOL EndBlender();
00316 
00317     // Regular shape processing functions
00318     BOOL ProcessRegularShape();
00319     BOOL ProcessRegularShapeParams();
00320 
00321     // Mould processing functions
00322     BOOL ProcessEnvelope();
00323     BOOL ProcessPerspective();
00324     BOOL StartMould(MouldSpace mSpace);
00325     BOOL EndMould();
00326     BOOL RemoveUnwantedAttributes(NodeMould* pNodeMould);
00327     void BuildSubtreeAttrMap(CCAttrMap *pAttribMap, Node* pNode);
00328     BOOL ProcessMould();
00329     BOOL ProcessMouldTokens();
00330     BOOL ProcessMouldShape();
00331     BOOL ProcessMouldSourceObjs();
00332     BOOL ProcessMouldDestinObjs();
00333     BOOL ProcessMouldThreshold();
00334     BOOL ReadSimplePath(Path* TempPath);
00335 
00336     BOOL ProcessFontFlags();
00337     BOOL ProcessBitmapFlags();
00338     BOOL ProcessFontType();
00339     BOOL FindEndOfTag();
00340 
00341     // Guide layer && guideline processing
00342     BOOL ProcessGuideLayer();
00343     BOOL ProcessGuideline();
00344 
00345     // The array of keyword names
00346     static CommandMap CamelotCommands[];
00347 };
00348 
00349 class EPSFontCache
00350 {
00351 public:
00352     EPSFontCache();
00353 
00354 public:
00355     BOOL Valid;
00356     BOOL Complex;
00357     WORD Typeface;
00358     BOOL Bold;
00359     BOOL Italic;
00360     MILLIPOINT Size;
00361     FIXED16 a, b, c, d;
00362 };
00363 
00364 /********************************************************************************************
00365 
00366 >   class CamelotEPSRenderRegion : public ArtWorksEPSRenderRegion
00367 
00368     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00369     Created:    08/03/94
00370     Purpose:    A render region for exporting files in the native EPS format.
00371     SeeAlso:    EPSRenderRegion; ArtWorksEPSRenderRegion
00372 
00373 ********************************************************************************************/
00374 
00375 class CamelotEPSRenderRegion : public ArtWorksEPSRenderRegion
00376 {
00377     CC_DECLARE_DYNAMIC(CamelotEPSRenderRegion)
00378     
00379 public:
00380     CamelotEPSRenderRegion(DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale);
00381 
00382     virtual ~CamelotEPSRenderRegion();
00383 
00384     // This version handles grad fills.
00385     void GetValidPathAttributes();
00386     void GetRenderRegionCaps(RRCaps* pCaps);
00387 
00388     BOOL StartRender();
00389     BOOL StopRender();
00390 
00391     void DrawPathToOutputDevice(Path *DrawPath, PathShape shapePath=PATHSHAPE_PATH);
00392     BOOL DrawTransformedBitmap(NodeBitmap *pNodeBitmap);
00393 
00394     // Function to draw a bitmap into the render region using a mask
00395     virtual SlowJobResult DrawMaskedBitmap(const DocRect &Rect, KernelBitmap* pBitmap, 
00396                                            MaskedRenderRegion* pMask, ProgressDisplay *Progress);
00397 
00398     virtual BOOL RenderChar(WCHAR ch, Matrix* pMatrix);
00399 
00400     // Must it export the print componets?
00401     virtual BOOL NeedsPrintComponents ( void );
00402 
00403     // Commit suicide - used instead of if ( IS_A (...) )
00404     virtual void ConditionalSuicide ( void );
00405 
00406     // write out a return character (\r). Used in Wrap-around text, etc...
00407     virtual BOOL WriteNewLine ( void );
00408 
00409     // these two functions are used to call the base EPS Output commands.
00410     virtual void OutputStrokeColour ();
00411     virtual void OutputFillColour ();
00412 
00413     virtual BOOL DrawParallelogramBitmap(DocCoord *Coords, OILBitmap *pBitmap, EFFECTTYPE Effect = EFFECT_RGB,
00414                  DocColour *StartCol = NULL, DocColour *EndCol = NULL);
00415 
00416 protected:
00417     virtual BOOL WriteEPSBoundingBox ( void );
00418     virtual BOOL WriteProlog(KernelDC*);
00419     virtual BOOL WriteSetup(KernelDC*);
00420     virtual BOOL WriteEPSTrailerComments ( void );
00421 
00422     BOOL DrawClippedBitmap(Path *DrawPath);
00423 
00424     BOOL SelectNewFont(WORD Typeface, BOOL Bold, BOOL Italic, MILLIPOINT Size);
00425     BOOL SelectNewFont(WORD Typeface, BOOL Bold, BOOL Italic, FIXED16 *abcd);
00426 
00427     // (ChrisG - 30/01/01) Changed to virtual, so that the pre-1.5 export can use CMYK colours, instead
00428     //  of RGB ones (as used by the Xara X EPS export) .
00429     virtual BOOL OutputGradFillColours(DocColour* StartCol, DocColour* EndCol, ColourContext* pContext=NULL);
00430     BOOL GetCurrFillEffect(UINT32& EffectType);
00431 
00432     // Used for rendering text via PostScript fonts
00433     EPSFontCache FontInfo;
00434 
00435     // Colour separation - bitmap support stuff
00436     void ColourSeparateScanline24(BYTE *DestBuffer, BYTE *SrcBuffer, INT32 PixelWidth);
00437 
00438     // Separation look-up tables for bitmap output (or NULL if not separating) -  This references
00439     // a set of 5 256-byte lookup tables (C, M, Y, UCR, BlackGen), or is NULL if not separating
00440     BYTE *SepTables;
00441 };
00442 
00443 
00444 
00445 #endif  // INC_CAMELEPS
00446 
00447 

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