#include <aw_eps.h>
Inheritance diagram for ArtWorksEPSRenderRegion:
Public Member Functions | |
ArtWorksEPSRenderRegion (DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale) | |
Initialise a render region for exporting ArtWorks EPS. Sets up the string to put in the %Creator comment. | |
virtual BOOL | StartRender () |
Over-rides normal EPS StartRender() function - this is because we want to have a different default winding rule when exporting as ArtWorks EPS. | |
virtual void | OutputFillColour () |
Writes out the fill colour. Since AW can't cope with our new Xa/XA and Xx/XX.RGB colour tokens, this function is overridden to use only the old CMYK tokens (k/K and x/X). | |
virtual void | OutputStrokeColour () |
Writes out the stroke colour. Since AW can't cope with our new Xa/XA and Xx/XX.RGB colour tokens, this function is overridden to use only the old CMYK tokens (k/K and x/X). | |
Protected Member Functions | |
void | GetValidPathAttributes () |
See EPSRenderRegion::GetValidPathAttributes. This version checks and handles grad fill colours before calling the base class version. | |
virtual BOOL | WriteEPSBoundingBox (void) |
Writes an EPS bounding box. | |
virtual BOOL | WriteEPSTrailerComments (void) |
Writes out an EPS trailer. |
Definition at line 268 of file aw_eps.h.
|
Initialise a render region for exporting ArtWorks EPS. Sets up the string to put in the %Creator comment.
Definition at line 2258 of file aw_eps.cpp. 02261 : EPSRenderRegion(ClipRect, ConvertMatrix, ViewScale) 02262 { 02263 CreatorString = _T("ArtWorks"); 02264 }
|
|
See EPSRenderRegion::GetValidPathAttributes. This version checks and handles grad fill colours before calling the base class version.
Reimplemented from EPSRenderRegion. Reimplemented in CamelotEPSRenderRegion, and NativeRenderRegion. Definition at line 2313 of file aw_eps.cpp. 02314 { 02315 #ifdef DO_EXPORT 02316 KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC); 02317 02318 FillGeometryAttribute *pFillAttr = (FillGeometryAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr; 02319 02320 if ((pFillAttr->IsKindOf(CC_RUNTIME_CLASS(GradFillAttribute))) && 02321 SetLastOutputAttribute(ATTR_FILLGEOMETRY)) 02322 { 02323 // Output a grad fill command... 02324 02325 // Output the fill type 02326 if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(LinearFillAttribute))) 02327 { 02328 pDC->OutputToken(_T("1")); 02329 } 02330 else if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(RadialFillAttribute))) 02331 { 02332 pDC->OutputToken(_T("2")); 02333 } 02334 else 02335 { 02336 // Bodge: ought to handle this more gracefully soon...i.e. get the 02337 // fill provider to render the fill using normal path rendering code. 02338 ENSURE(FALSE, "Unsupported grad fill encountered while exporting"); 02339 EPSRenderRegion::GetValidPathAttributes(); 02340 return; 02341 } 02342 02343 // Get the start colour and end colour in CMYK, and output them. 02344 GradFillAttribute *pGradFillAttr = (GradFillAttribute *) pFillAttr; 02345 pDC->OutputNamedColour(&pGradFillAttr->Colour); 02346 pDC->OutputNamedColour(&pGradFillAttr->EndColour); 02347 02348 // Output the start and end points of the grad fill 02349 pDC->OutputCoord(pGradFillAttr->StartPoint); 02350 pDC->OutputCoord(pGradFillAttr->EndPoint); 02351 02352 // Output the grad fill token 02353 pDC->OutputToken(_T("ax")); 02354 pDC->OutputNewLine(); 02355 } 02356 02357 if (SetLastOutputAttribute(ATTR_WINDINGRULE)) 02358 { 02359 WindingRuleAttribute *pWindingRuleAttr = 02360 (WindingRuleAttribute *) CurrentAttrs[ATTR_WINDINGRULE].pAttr; 02361 02362 switch (pWindingRuleAttr->WindingRule) 02363 { 02364 case NonZeroWinding: 02365 // Change winding rule to 0, which means non-zero in ArtWorks EPS. 02366 pDC->OutputToken(_T("0")); 02367 pDC->OutputToken(_T("awr")); 02368 pDC->OutputNewLine(); 02369 break; 02370 02371 case EvenOddWinding: 02372 // Change winding rule to 1, which means even-odd in ArtWorks EPS. 02373 pDC->OutputToken(_T("1")); 02374 pDC->OutputToken(_T("awr")); 02375 pDC->OutputNewLine(); 02376 break; 02377 02378 case NegativeWinding: 02379 case PositiveWinding: 02380 // Not supported in ArtWorks EPS - ignore. 02381 break; 02382 02383 default: 02384 ERROR3("Unknown winding rule encountered while exporting."); 02385 break; 02386 02387 } 02388 } 02389 02390 // Handle usual pens/brushes 02391 EPSRenderRegion::GetValidPathAttributes(); 02392 #endif 02393 }
|
|
Writes out the fill colour. Since AW can't cope with our new Xa/XA and Xx/XX.RGB colour tokens, this function is overridden to use only the old CMYK tokens (k/K and x/X).
Reimplemented from EPSRenderRegion. Reimplemented in CamelotEPSRenderRegion, and NativeRenderRegion. Definition at line 2508 of file aw_eps.cpp. 02509 { 02510 EPSRenderRegion::OutputFillCMYKColour (); 02511 }
|
|
Writes out the stroke colour. Since AW can't cope with our new Xa/XA and Xx/XX.RGB colour tokens, this function is overridden to use only the old CMYK tokens (k/K and x/X).
Reimplemented from EPSRenderRegion. Reimplemented in CamelotEPSRenderRegion, and NativeRenderRegion. Definition at line 2487 of file aw_eps.cpp. 02488 { 02489 EPSRenderRegion::OutputStrokeCMYKColour (); 02490 }
|
|
Over-rides normal EPS StartRender() function - this is because we want to have a different default winding rule when exporting as ArtWorks EPS.
Reimplemented from VectorFileRenderRegion. Reimplemented in CamelotEPSRenderRegion, and PrintPSRenderRegion. Definition at line 2279 of file aw_eps.cpp. 02280 { 02281 #ifdef DO_EXPORT 02282 // Check the base class is working ok. 02283 if (!EPSRenderRegion::StartRender()) 02284 return FALSE; 02285 02286 // Set up normal ArtWorks default rendering - basic difference is that ArtWorks 02287 // uses even-odd winding rule. 02288 // NB. it only does it for 'proper' ArtWorks render regions, not any derived 02289 // from this class. 02290 if (IS_A(this, ArtWorksEPSRenderRegion)) 02291 SetWindingRule(EvenOddWinding); 02292 02293 // All ok 02294 return TRUE; 02295 #else 02296 return FALSE; 02297 #endif 02298 }
|
|
Writes an EPS bounding box.
Reimplemented from EPSRenderRegion. Reimplemented in CamelotEPSRenderRegion. Definition at line 2409 of file aw_eps.cpp. 02410 { 02411 // Scale conversion between millipoints and millimetres. 02412 const double Scale = 25.4 / 72000.0; 02413 02414 // Cast a pointer to the appropriate DC. 02415 KernelDC *pDC = static_cast<KernelDC*> ( CCDC::ConvertFromNativeDC(RenderDC) ); 02416 DocRect PageBounds = RenderSpread->GetPageBounds (); 02417 DocRect DrawingBounds = RenderSpread->GetDrawingSize (); 02418 TCHAR Buffer [256]; 02419 02420 // Set up the output buffer. 02421 camSnprintf( Buffer, 256, _T("%gmm %gmm"), 02422 static_cast<double> ( PageBounds.Width () ) * Scale, 02423 static_cast<double> ( PageBounds.Height () ) * Scale ); 02424 02425 // Output the page size data. 02426 pDC->OutputToken (_T("%%DocumentPageSize:")); 02427 pDC->OutputToken ( Buffer ); 02428 pDC->OutputNewLine (); 02429 02430 // Write the AW bounding box out. I'm doing this manually because ArtWorks runs at a 02431 // higher resolution than standard EPS files. This way I get an extra two decimal 02432 // places of accuracy. 02433 pDC->OutputToken ( _T("%%BoundingBox:") ); 02434 pDC->OutputCoord ( DrawingBounds.lo, ACCURACY_NORMAL ); 02435 pDC->OutputCoord ( DrawingBounds.hi, ACCURACY_NORMAL ); 02436 pDC->OutputNewLine (); 02437 02438 // Success. 02439 return TRUE; 02440 }
|
|
Writes out an EPS trailer.
Reimplemented from EPSRenderRegion. Reimplemented in CamelotEPSRenderRegion. Definition at line 2456 of file aw_eps.cpp. 02457 { 02458 // Get a pointer to the kernel DC. 02459 KernelDC *pDC = static_cast<KernelDC*> ( CCDC::ConvertFromNativeDC(RenderDC) ); 02460 02461 // Write out the trailer comments. 02462 pDC->OutputToken ( _T("%%Trailer") ); 02463 pDC->OutputNewLine (); 02464 pDC->OutputToken ( _T("showpage") ); 02465 pDC->OutputNewLine (); 02466 02467 // Success. 02468 return TRUE; 02469 }
|