00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_AI_EPS_RENDER_REGION
00101 #define INC_AI_EPS_RENDER_REGION
00102
00103 #include "saveeps.h"
00104
00105 class NodeBevel;
00106
00107
00108 const TCHAR LinearGradient [] = _T("Linear Gradient");
00109 const TCHAR RadialGradient [] = _T("Radial Gradient");
00110 const INT32 LinearFill = 0;
00111 const INT32 RadialFill = 1;
00112
00113
00114
00115
00116 const INT32 NumFillEmulationSteps = 5;
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 class AIEPSGradientScanRenderRegion : public VectorFileRenderRegion
00130 {
00131 CC_DECLARE_DYNAMIC (AIEPSGradientScanRenderRegion)
00132
00133 protected:
00134
00135 RenderRegion * m_pController;
00136
00137 public:
00138
00139 AIEPSGradientScanRenderRegion (RenderRegion * pControllingRegion);
00140
00141 RenderRegion * GetControllingRegion () {return m_pController;}
00142 void SetControllingRegion (RenderRegion * pControllingRegion);
00143
00144 virtual void DrawPathToOutputDevice(Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH);
00145
00146 virtual BOOL StopRender() {return FALSE;};
00147 virtual void DrawRect(DocRect *RectToRender) {};
00148 virtual void DrawDragRect(DocRect *RectToRender) {};
00149 virtual void DrawLine(const DocCoord &StartPoint, const DocCoord &EndPoint) {};
00150 virtual void DrawPixel(const DocCoord &Point) {};
00151 virtual void DrawBlob(DocCoord p, BlobType type) {};
00152 virtual void DrawCross(const DocCoord &Point, const UINT32 Size) {};
00153
00154 virtual void DrawBitmap(const DocCoord &Point, KernelBitmap* pBitmap) {};
00155 virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = NULL) {};
00156 virtual void DrawBitmapBlob(const DocCoord &Point, KernelBitmap* BlobShape) {};
00157 virtual void DrawBitmapBlob(const DocCoord &Point, ResourceID resID ) {};
00158
00159 virtual void InitClipping() {};
00160 virtual void InitAttributes() {};
00161
00162 virtual void SetOSDrawingMode() {};
00163 virtual MILLIPOINT CalcPixelWidth() {return MILLIPOINT (1);};
00164 virtual MILLIPOINT CalcScaledPixelWidth() {return MILLIPOINT (1);};
00165 };
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 class ListFill : public CCObject
00181 {
00182 CC_DECLARE_DYNAMIC (ListFill);
00183
00184 public:
00185
00186 ListFill ();
00187 ListFill (FillGeometryAttribute * pNewFill);
00188 ListFill (FillGeometryAttribute * pNewFill, EFFECTTYPE eff, ListFill * pNewNext);
00189 ~ListFill ();
00190
00191 FillGeometryAttribute * pFill;
00192 EFFECTTYPE effect;
00193 ListFill * pNext;
00194 INT32 id;
00195 };
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 class AIEPSRenderRegion : public EPSRenderRegion
00208 {
00209 friend class AIEPSGradientScanRenderRegion;
00210
00211 CC_DECLARE_DYNAMIC (AIEPSRenderRegion)
00212
00213 public:
00214 AIEPSRenderRegion (DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale);
00215 ~AIEPSRenderRegion ();
00216
00217
00218 BOOL ExportBitmap ( NodeBitmap *pNodeBMP );
00219 BOOL ExportBevel ( NodeBevel *pBevel );
00220 BOOL ExportShadow ( OILBitmap *pBitmap,
00221 UINT32 Darkness,
00222 DocRect &Bounds );
00223 BOOL ExportLayer ( Layer *pLayer );
00224 BOOL StartLayer ( Layer *pLayer );
00225
00226 virtual BOOL RenderChar (WCHAR ch, Matrix* pMatrix);
00227
00228 BOOL ExportingOnPath ();
00229
00230 virtual void OverflowTextStart ();
00231 virtual void OverflowTextFinish ();
00232
00233
00234 BOOL WriteMask ( Path *MaskPath, BOOL OutputGroupToken = FALSE );
00235
00237
00238
00239 virtual void SetClipRegion (ClipRegionAttribute * pClipAttr, BOOL Temp);
00240 virtual void RestoreClipRegion (ClipRegionAttribute * pClipAttr, BOOL Temp);
00242
00243
00244 virtual void SetTextAsShapes (BOOL shapes);
00245 virtual BOOL GetTextAsShapes ();
00246
00247 virtual BOOL IsGradientFillValidForExport (FillGeometryAttribute * pFill);
00248 virtual void IncludeGradientFill (FillGeometryAttribute * pFill, EFFECTTYPE effect);
00249
00250 protected:
00251
00252 virtual void Initialise ();
00253
00254
00255 virtual BOOL WriteEPSVersion ();
00256 virtual BOOL WriteEPSProcessColours ();
00257 virtual BOOL WriteEPSResources ( EPSFilter *pFilter,
00258 Document *pDocument );
00259 virtual BOOL WriteEPSProlog ( EPSFilter *pFilter,
00260 Document *pDocument );
00261
00262 virtual void OutputFillColour ( void );
00263
00264
00265 virtual BOOL WriteGradientFills ( Document *pDocument );
00266
00267
00268 virtual BOOL WriteDocumentSetup ( Document *pDocument,
00269 EPSFilter *pFilter );
00270
00271 virtual BOOL EndLayer ( void );
00272
00273
00274
00275 virtual void OutputWindingRule ();
00276
00277 virtual void OutputStrokeColour ();
00278 virtual void OutputLineWidth ();
00279 virtual void OutputJoinType ();
00280 virtual void OutputDashPattern ();
00281 virtual void OutputStartCap ();
00282 virtual void OutputMitreLimit ();
00283
00284 virtual void OutputFontName ();
00285
00286 virtual void OutputTextRenderMode ();
00287 virtual void OutputTextAspectRatio ();
00288 virtual void OutputTextTracking ();
00289 virtual void OutputTextJustification ();
00290 virtual void OutputTextLineSpacing ();
00291 virtual void OutputTextBaselineShift ();
00292 virtual void OutputTextSubSuperScript ();
00293
00294 virtual void OutputFillRGBColour ();
00295 virtual void OutputFillCMYKColour ();
00296 virtual void OutputStrokeRGBColour ();
00297 virtual void OutputStrokeCMYKColour ();
00298
00299
00300
00301
00302 virtual void OverflowTextStartGap ();
00303 virtual void OverflowTextFinishGap ();
00304 virtual void OverflowTextWrite (TCHAR * text);
00305 virtual void OverflowTextWriteSingleColour (UINT32 n);
00306 virtual void OverflowTextWriteColour (PColourCMYK*);
00307 virtual void OverflowTextWriteNamedColour (DocColour*, ColourContext* pContext=NULL);
00308 virtual void OverflowTextWriteColourName (DocColour* pCol);
00309
00310
00311 virtual BOOL RenderCharAsShape (WCHAR ch, Matrix* pMatrix);
00312
00313
00314
00315 virtual BOOL WriteNewLine ( void );
00316
00317 private:
00318
00319 virtual void BuildGradientCache (Node * pStartNode);
00320 virtual void BuildGradientCacheUsingScanner (Node * pNode, AIEPSGradientScanRenderRegion * pScan);
00321 virtual void WriteGradientCount ();
00322 virtual void WriteGradientDefinitions ();
00323 virtual void ClearGradientCache ();
00324 virtual INT32 FindGradientInCache (FillGeometryAttribute * pFill, EFFECTTYPE effect);
00325
00326 BOOL WriteLinearFill ( FillGeometryAttribute * pFill, EFFECTTYPE effect, INT32 id);
00327 BOOL WriteRadialFill ( FillGeometryAttribute * pFill, EFFECTTYPE effect, INT32 id);
00328 virtual void WriteGradientFillInstance ();
00329 BOOL WriteGradientEntry ( DocColour *pColour,
00330 INT32 Position,
00331 INT32 Midpoint );
00332 BOOL WriteFillEffectSteps ( DocColour *pColour1,
00333 INT32 pos1,
00334 DocColour *pColour2,
00335 INT32 pos2,
00336 INT32 bias,
00337 EFFECTTYPE effect);
00338
00339
00340 BOOL LoadBitmapMatrix ( NodeBitmap *pNodeBMP );
00341 BOOL LoadTranslationMatrix ( DocCoord &Translation );
00342 BOOL WriteLoadedMatrix ( void );
00343
00344 BOOL WriteMaskTags ( void );
00345
00346
00347 BOOL WriteBitmapRecord ( OILBitmap *pBitmap );
00348 BOOL WriteBitmapHeader ( INT32 Width,
00349 INT32 Height );
00350 BOOL WriteBitmapBody ( OILBitmap *pBitmap,
00351 INT32 Width,
00352 INT32 Height );
00353 BOOL WriteContoneBody ( OILBitmap *pBitmap );
00354 BOOL WriteBitmapTail ( void );
00355
00356
00357 ListFill * m_pLinearGradList;
00358 ListFill * m_pRadialGradList;
00359
00360 double m_a;
00361 double m_b;
00362 double m_c;
00363 double m_d;
00364 DocCoord m_T;
00365
00366 BOOL m_ActiveLayer;
00367 UINT32 m_LayerColour;
00368
00369 FILE * m_fpOverflowText;
00370 BOOL m_bInTextGap;
00371 BOOL m_bTextAsShapes;
00372
00373 };
00374
00375 #endif