#include <saveeps.h>
Inheritance diagram for EPSRenderRegion:

Public Member Functions | |
| EPSRenderRegion (DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale) | |
| Constructor for an EPSOutputFilter object. The object should be initialised before use. | |
| BOOL | Init () |
| Initialise an EPSOutputFilter object. | |
| BOOL | AttachDevice (View *ViewToAttach, CNativeDC *DCToAttach, Spread *SpreadToAttach, bool fOwned=false) |
| Attach the EPS render region to a device context and a spread to export. | |
| BOOL | InitDevice () |
| Initialise the device specific mechanisms for this render region. | |
| virtual BOOL | RenderChar (WCHAR ch, Matrix *pMatrix) |
| virtual BOOL | SaveAttribute (UINT32 Index, AttributeValue *pAttr, BOOL Temp) |
| Saves the current attribute on the attribute context stack, and installs the given attribute as the new attribute. If the attribute object is temporary, then it is deleted when the attribute is popped off the stack. See RenderRegion::RestoreAttribute. | |
| virtual BOOL | CloseDown () |
| Tells the EPS render region that all rendering is finished and the region is about to be shut down, so it should output any trailer etc that is required. | |
| virtual void | DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath) |
| Output all the commands required to render this path to the EPS file. | |
| void | ExportPath (Path *DrawPath, BOOL DataOnly, BOOL PureDataOnly=FALSE) |
| Output all the commands required to render this path to the EPS file. If this is a compound path, the stroke/fill operators will always be output, regardless of the value of the DataOnly parameter. | |
| virtual void | GetValidPathAttributes () |
| Ensure the EPS context has the correct attributes for drawing paths. This required because when the path attributes change, we don't output the EPS commands to reflect this straight away - we set a flag to indicate that the attributes have changed, and then when this function is called, it notices that the attributes have changed, and outputs the EPS commands to select these attributes. This avoids redundant and copious attribute code in our EPS files. (The flags used are ValidPen and FillFlags.ValidGeometry). | |
| virtual void | GetValidTextAttributes () |
| Text equivalent of GetValidPathAttributes(). | |
| virtual void | GetRenderRegionCaps (RRCaps *pCaps) |
| This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy. | |
| virtual BOOL | WantsGrids () |
| This function is designed to help with the rendering of grids, as they are not always wanted (eg xara eps). EPS classes generally do not want to render grids. The ones that do (NativeEPS) should replace this with a version that returns TRUE. | |
| virtual BOOL | WriteNewLine (void) |
| Outputs a new line tag to the file. | |
| virtual void | SetClipRegion (ClipRegionAttribute *pClipAttr, BOOL Temp) |
| Shrink the RR's clipping region to the region defined by pClipAttr. We do this by: 1. Recording a save-state command. 2. Exporting a description of the clipping path in pClipAttr. 3. Recording a 'clip-to-last-path' command. 4. Recording a 'start-new-path' command, as we don't want our clip-path to get stroked or rendered in any way. | |
| virtual void | RestoreClipRegion (ClipRegionAttribute *pClipAttr, BOOL Temp) |
| Restore the RR's clipping region. We do this by recording a restore-state command. | |
Protected Member Functions | |
| virtual void | OutputFontName (void) |
| Output an Illustrator format fontname and pointsize token. The format is /_fontname[-Bold|-Italic|-BoldItalic] pointsize Tf. EncodeFontName will generate this format from an internal fontname. DocodeFontName will return an internal format fontname and flags where nec. | |
| INT32 | GetFontStyle (void) |
| Compile the current style attributes. | |
| virtual BOOL | WriteEPSVersion (void) |
| Writes the EPS version used by this particular file type. | |
| virtual BOOL | WriteEPSBoundingBox (void) |
| Writes an EPS bounding box. | |
| virtual BOOL | WriteEPSProcessColours (void) |
| Does nothing - process colours are only relevant in AI files. | |
| virtual BOOL | WriteEPSResources (EPSFilter *pFilter, Document *pDocument) |
| This is a stub function, that's over-loaded in the AIEPS render region. It's used to write out the necessary resources for an AI file. | |
| virtual BOOL | WriteEPSProlog (EPSFilter *pFilter, Document *pDocument) |
| This is a stub function, that's over-loaded in the AIEPS render region. It's used to write out the necessary Prolog script for an AI file. | |
| virtual BOOL | WriteEPSTrailerComments (void) |
| Writes the comments out at the end of an EPS file. | |
| virtual BOOL | WriteProlog (KernelDC *) |
| Output any PostScript prolog for this render region. For EPS and printing, this means output of our PostScript rendering procedures; for Native files we do nothing. | |
| virtual BOOL | WriteSetup (KernelDC *) |
| Output any PostScript setup for this render region. For EPS and printing, this means output of our PostScript code to initialise the context for rendering; for Native files we do nothing. | |
| virtual BOOL | WriteSepTables (KernelDC *) |
| Output the current set of device printer profiles as Postscript data arrays. Our Postscript prolog functions will use these arrays when creating separations. (if we are not separating, we do nothing). | |
| virtual BOOL | WriteSepFunctions (KernelDC *) |
| Output the current set of separation functions for this EPS file if any. These will usually be present in printable postscript versions of EPS render regions. | |
| BOOL | SetLastOutputAttribute (INT32 AttrID) |
| Check to see if the current attribute is the same as the last one that was output in EPS. | |
| void | ResetOutputAttributes (void) |
| Resets the attribute array so that all attributes are considered to be invalidated - i.e. the next time an attribute is needed, it will always be output, regardless of whether the last attribute output was the same as it. This is mainly used for PostScript printing when we use the OS to do text, because we cannot be sure of how the OS will leave the graphics state after doing text output, so we assume nothing, and reset all required attributes after doing text output via the OS. | |
| virtual BOOL | WriteFileVersion (KernelDC *) |
| This allows the filter to save out a comment line giving file version information. At present, in anything but Native format, it does nothing. | |
| virtual BOOL | WriteCompressionState (KernelDC *) |
| This starts the compression process. Called just after we output the document information so that this is not compressed and the galleries can access it easily. In this baseclass version we do nothing as compression would be a very bad thing. | |
| virtual BOOL | WriteEndCompressionState (KernelDC *) |
| This is called once almost everything has been output, just before we output the EOF and we fix the EPS header. In this baseclass version we do nothing as compression would be a very bad thing. | |
| virtual BOOL | WriteGradientFills (Document *pDocument) |
| This function is a stub function, which is overwritten in the AI render region. | |
| virtual BOOL | WriteDocumentSetup (Document *pDocument, EPSFilter *pFilter) |
| Browse through the tree, and if a text story is found invoke the document setup function. By only exporting the font setup when necessary, the file size produced is smaller (which makes it easier for me to interpret :) ), and it should hopefully make the filter run a bit faster too. | |
| virtual BOOL | EndLayer (void) |
| If there is an existing layer, it writes the end of layer tags, before creating a new layer record. | |
| ColourPlate * | GetOutputColourPlate (ColourModel ColModel) |
| void | GetOutputColourPlate (ColourModel ColModel, ColourContext **ppContext, ColourPlate **ppPlate) |
| This render region is associated with a document view. This function retrieves the colour context from this view and returns it along with a plate (if available). ColourModel is used to determin which plate to return from the context. If there is no view pContext and pPlate will be NULL. If there is no context in the view both return values will be NULL If there is a context but no plate attached to it, one can assume the current render action is not separated. | |
| virtual void | OutputWindingRule () |
| Output winding rule token to the EPS file. | |
| virtual void | OutputStrokeColour () |
| Output a stroke colour. This calls either OutputStrokeRGBcolour or OutputStrokeCMYKColour depending on the colour model. | |
| virtual void | OutputLineWidth () |
| Output the standard line width token and measure for EPS. | |
| virtual void | OutputJoinType () |
| Output the standard EPS join type. | |
| virtual void | OutputDashPatternInit () |
| Sets up the next dash pattern for output. | |
| virtual void | OutputDashPattern () |
| Output the current dash pattern settings. Watch for interaction with line widths, a change of line width causes the dash pattern to become invalid. To output a dash pattern correctly, use the following code. | |
| virtual void | OutputStartCap () |
| Output the start cap setting using the usual 'J' EPS token. | |
| virtual void | OutputMitreLimit () |
| Output the current mitre limit value using the usual 'M' EPS token. | |
| virtual void | OutputFillColour () |
| This now delegates the output to either OutputFillRGBColour or OutputFillCMYKColour, depending on the colour model used. | |
| virtual void | OutputStrokeRGBColour () |
| Output the current stroke colour as RGB. This function will use one of the following EPS tokens XA - if not separating and colour is unnamed XX - if not separating and colour is named G - if separating. | |
| virtual void | OutputFillRGBColour () |
| Output the current fill colour as RGB. This function will use one of the following EPS tokens Xa - if not separating and colour is unnamed Xx - if not separating and colour is named g - if separating. | |
| virtual void | OutputStrokeCMYKColour () |
| Output the current stroke colour. This function will use one of the following EPS tokens K - if not separating and colour is unnamed X - if not separating and colour is named G - if separating. | |
| virtual void | OutputFillCMYKColour () |
| Output the current fill colour in CMYK mode. This function will use one of the following EPS tokens k - if not separating and colour is unnamed x - if not separating and colour is named g - if separating. | |
| virtual void | OutputTextRenderMode () |
| Output the change in the text's Render Mode (Tr) - this happens when the text's fill or line colour changes to or from blank, see-through colour. | |
| virtual void | OutputTextAspectRatio () |
| Output the change in the text's aspect ratio (Tx). | |
| virtual void | OutputTextTracking () |
| Output the change in the tracking (Tt). | |
| virtual void | OutputTextJustification () |
| Output the change in the text justification (Ta). | |
| virtual void | OutputTextLineSpacing () |
| Output the change in the line spacing (Tl). | |
| virtual void | OutputTextBaselineShift () |
| Output the change in Baseline shift (Ts). | |
| virtual void | OutputTextSubSuperScript () |
| Output the change in the Sub/Super script attribute (Ts). | |
| virtual void | WriteGradientFillInstance () |
| This function allows extra work to be done on gradient fills, when the fill and/or stroke operators are written. i.e. at the last possible moment before rendering. | |
Protected Attributes | |
| BOOL | ValidPen |
| CCLexFile * | ExportFile |
| TCHAR * | CreatorString |
| RRCaps | Caps |
| BOOL | m_bValidPathAttrs |
| BOOL | m_bValidTextAttrs |
Friends | |
| class | NodeBitmap |
Definition at line 125 of file saveeps.h.
|
||||||||||||||||
|
Constructor for an EPSOutputFilter object. The object should be initialised before use.
Definition at line 157 of file saveeps.cpp. 00157 : 00158 VectorFileRenderRegion(ClipRect, ConvertMatrix, ViewScale) 00159 { 00160 ValidPen = FALSE; 00161 CreatorString = _T("Adobe Illustrator 3.0 (exported by Camelot)"); 00162 00163 ExportFile = NULL; 00164 m_bValidPathAttrs = TRUE; 00165 m_bValidTextAttrs = TRUE; 00166 }
|
|
||||||||||||||||||||
|
Attach the EPS render region to a device context and a spread to export.
Reimplemented from RenderRegion. Definition at line 212 of file saveeps.cpp. 00213 { 00214 // Sanity checks 00215 // ENSURE(pView == NULL, "Bad window pointer in EPSRenderRegion::AttachDevice"); 00216 00217 // Call the base class first 00218 if (!RenderRegion::AttachDevice(pView, pDC, pSpread)) 00219 return FALSE; 00220 00221 // Save the first node we need to export. 00222 // CurrentRenderState = pSpread->FindFirstForExport(this, FALSE); 00223 00224 // Get a pointer to the CCDiskFile object 00225 EPSExportDC* pEPSDC = (EPSExportDC*) CCDC::ConvertFromNativeDC(pDC); 00226 ExportFile = pEPSDC->ExportFile; 00227 00228 // All okey dokey 00229 return TRUE; 00230 }
|
|
|
Tells the EPS render region that all rendering is finished and the region is about to be shut down, so it should output any trailer etc that is required.
Reimplemented from RenderRegion. Reimplemented in PrintPSRenderRegion. Definition at line 438 of file saveeps.cpp. 00439 { 00440 // Close down any active layers. 00441 EndLayer (); 00442 00443 // Write out the trailer. 00444 WriteEPSTrailerComments (); 00445 00446 return TRUE; 00447 }
|
|
||||||||||||
|
Output all the commands required to render this path to the EPS file.
Implements RenderRegion. Reimplemented in CamelotEPSRenderRegion. Definition at line 1681 of file saveeps.cpp. 01682 { 01683 // ChrisG - 26/10/00 Only export paths if they have any co-ordinates - Exporting 01684 // paths with no co-ords causes no end of hassle in the ExportPath function below, 01685 // where they are used as controls for while loops, positions in arrays (but with 01686 // one subtracted), etc... 01687 if (DrawPath->GetNumCoords ()) 01688 { 01689 // If we are not drawing complex shapes and this shape is, then return 01690 if ((!RenderComplexShapes) && (TestForComplexShape(&Caps))) 01691 return; 01692 01693 ExportPath(DrawPath, FALSE); 01694 01695 // Now do the arrow heads if the render region can't do them directly 01696 // -- But only draw arrow heads if the path is "stroked" 01697 if (DrawPath->IsStroked && !Caps.ArrowHeads) 01698 { 01699 // Doesn't support arrow heads directly so we render them as paths. 01700 DrawPathArrowHeads(DrawPath->GetCoordArray(), 01701 DrawPath->GetVerbArray(), 01702 DrawPath->GetNumCoords()); 01703 } 01704 } 01705 }
|
|
|
If there is an existing layer, it writes the end of layer tags, before creating a new layer record.
Reimplemented in AIEPSRenderRegion. Definition at line 2141 of file saveeps.cpp. 02142 { 02143 // Don't do anything. 02144 return TRUE; 02145 }
|
|
||||||||||||||||
|
Output all the commands required to render this path to the EPS file. If this is a compound path, the stroke/fill operators will always be output, regardless of the value of the DataOnly parameter.
Definition at line 1732 of file saveeps.cpp. 01733 { 01734 // Only change data if we have actually have data to change 01735 if (!PureDataOnly) 01736 { 01737 // Make sure we draw in the right colours 01738 GetValidPathAttributes(); 01739 } 01740 01741 // Get the device context for our export file. 01742 KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC); 01743 01744 DocCoord* Coords = DrawPath->GetCoordArray(); 01745 PathVerb* Verbs = DrawPath->GetVerbArray(); 01746 INT32 NumCoords = DrawPath->GetNumCoords(); 01747 01748 // Position we are reading points from 01749 INT32 ReadPos = 1; 01750 01751 // Check to see if this is a compound path. If it is, there will be more than one 01752 // moveto command. 01753 BOOL CompoundPath = FALSE; 01754 01755 while (ReadPos < NumCoords) 01756 { 01757 // Find out the type of element that we are over (after the close flag has been removed) 01758 if (((Verbs[ReadPos]) & (~PT_CLOSEFIGURE) ) == PT_MOVETO) 01759 { 01760 // This is a compound path - stop searching for moveto's. 01761 CompoundPath = TRUE; 01762 break; 01763 } 01764 // Try next point 01765 ReadPos++; 01766 } 01767 01768 // Karim 24/05/2000 - don't want this bracket data if the PureDataOnly flag is set. 01769 if (CompoundPath && !PureDataOnly) 01770 { 01771 // Bracket compound paths./ 01772 pDC->OutputToken(_T("*u")); 01773 pDC->OutputNewLine(); 01774 } 01775 01776 // Work out how to render the path (stroke, fill, both, none, etc.) 01777 TCHAR PathTypeOpen[2] = _T("N"); 01778 TCHAR PathTypeClosed[2]; 01779 01780 // Work out if the path is filled. 01781 BOOL IsFilled = TRUE; 01782 01783 ColourFillAttribute *pFillAttr = 01784 (ColourFillAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr; 01785 01786 if (pFillAttr->IsKindOf(CC_RUNTIME_CLASS(FlatFillAttribute)) && 01787 pFillAttr->Colour.IsTransparent()) 01788 { 01789 // Flat fill with transparent colour => no fill 01790 IsFilled = FALSE; 01791 } 01792 01793 if (!DrawPath->IsFilled) 01794 IsFilled = FALSE; 01795 01796 // Work out what should be done to the path 01797 if (RR_STROKECOLOUR().IsTransparent() || !DrawPath->IsStroked) 01798 { 01799 if (IsFilled) 01800 // Fill path 01801 PathTypeOpen[0] = 'F'; 01802 } 01803 else 01804 { 01805 if (IsFilled) 01806 // Stroke and fill path 01807 PathTypeOpen[0] = 'B'; 01808 else 01809 // Stroke path, leaving it unfilled 01810 PathTypeOpen[0] = 'S'; 01811 } 01812 01813 // make closed varity of PathType 01814 PathTypeClosed[0] = camTolower(PathTypeOpen[0]); 01815 PathTypeClosed[1] = '\0'; 01816 01817 // Reset to start of path 01818 ReadPos = 0; 01819 01820 // loop through the whole path 01821 while(ReadPos < NumCoords) 01822 { 01823 // Find out the type of element that we are over (after the close flag has been removed) 01824 // Coord P[4]; 01825 switch ( (Verbs[ReadPos]) & (~PT_CLOSEFIGURE) ) 01826 { 01827 case PT_MOVETO: 01828 // If this is in the middle of the path, specify how this sub-path 01829 // should be rendered - this is needed so that we re-import all the flags 01830 // correctly on complex paths (e.g. PT_CLOSEFIGURE) 01831 // Karim 25/05/2000 - changed so we don't output this stroking token if PureDataOnly. 01832 if (ReadPos > 0 && !PureDataOnly) 01833 { 01834 pDC->OutputToken(((Verbs[ReadPos - 1] & PT_CLOSEFIGURE) != 0)?PathTypeClosed:PathTypeOpen); 01835 pDC->OutputNewLine(); 01836 } 01837 01838 // Output the moveto command 01839 pDC->OutputCoord(Coords[ReadPos]); 01840 pDC->OutputToken(TEXT("m")); 01841 pDC->OutputNewLine(); 01842 ReadPos++; 01843 break; 01844 01845 01846 case PT_LINETO: 01847 // Output the lineto command 01848 pDC->OutputCoord(Coords[ReadPos]); 01849 pDC->OutputToken(TEXT("l")); 01850 pDC->OutputNewLine(); 01851 ReadPos++; 01852 break; 01853 01854 01855 case PT_BEZIERTO: 01856 // If this point is a bezier, then the next 2 points should be beziers to 01857 ENSURE((Verbs[ReadPos+1]) & (~PT_CLOSEFIGURE), "Bezier found with 1 point"); 01858 ENSURE((Verbs[ReadPos+2]) & (~PT_CLOSEFIGURE), "Bezier found with 2 points"); 01859 01860 // Make sure that this is not at the start of the path 01861 ENSURE(ReadPos > 0, "Broken path found while exporting EPS" ); 01862 01863 // Output the moveto command 01864 pDC->OutputCoord(Coords[ReadPos]); 01865 pDC->OutputCoord(Coords[ReadPos+1]); 01866 pDC->OutputCoord(Coords[ReadPos+2]); 01867 pDC->OutputToken(TEXT("c")); 01868 pDC->OutputNewLine(); 01869 ReadPos += 3; 01870 break; 01871 01872 default: 01873 ENSURE( FALSE, "We found a Path Element that does not exist!" ); 01874 break; 01875 } 01876 } 01877 01878 // Karim 24/05/2000 - if PureDataOnly is specified, then we *really* don't want to render here! 01879 if (!PureDataOnly && (!DataOnly || CompoundPath)) 01880 { 01881 // Write out any additional info it's a gradient fill. 01882 if (pFillAttr->IsAGradFill ()) 01883 { 01884 WriteGradientFillInstance (); 01885 } 01886 01887 // Do the final (or possibly only) render command 01888 pDC->OutputToken(((Verbs[NumCoords - 1] & PT_CLOSEFIGURE) != 0)?PathTypeClosed:PathTypeOpen); 01889 pDC->OutputNewLine(); 01890 } 01891 01892 // Karim 24/05/2000 - don't want this bracket data if the PureDataOnly flag is set. 01893 if (CompoundPath && !PureDataOnly) 01894 { 01895 // End compound path 01896 pDC->OutputToken(_T("*U")); 01897 pDC->OutputNewLine(); 01898 } 01899 }
|
|
|
Compile the current style attributes.
Definition at line 622 of file saveeps.cpp. 00623 { 00624 INT32 Style = 0; 00625 if (RR_TXTBOLD()) Style+=1; 00626 if (RR_TXTITALIC()) Style+=2; 00627 return Style; 00628 }
|
|
||||||||||||||||
|
This render region is associated with a document view. This function retrieves the colour context from this view and returns it along with a plate (if available). ColourModel is used to determin which plate to return from the context. If there is no view pContext and pPlate will be NULL. If there is no context in the view both return values will be NULL If there is a context but no plate attached to it, one can assume the current render action is not separated.
Definition at line 1646 of file saveeps.cpp. 01647 { 01648 ColourContext *pCurContext=NULL; 01649 ColourPlate *pCurPlate=NULL; 01650 01651 // Get the render region view and find its local CMYK colour context 01652 View* pCurrView = GetRenderView(); 01653 if (pCurrView!=NULL) 01654 pCurContext = pCurrView->GetColourContext(ColModel, TRUE); 01655 01656 // If we have a context, check for mono output. 01657 if (pCurContext!=NULL) 01658 pCurPlate = pCurContext->GetColourPlate(); 01659 01660 // Set return vars 01661 if (pContext!=NULL) 01662 (*pContext) = pCurContext; 01663 if (pPlate!=NULL) 01664 (*pPlate) = pCurPlate; 01665 }
|
|
|
|
|
|
This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.
Reimplemented from RenderRegion. Reimplemented in CamelotEPSRenderRegion, and NativeRenderRegion. Definition at line 2435 of file saveeps.cpp. 02436 { 02437 // This forces line attributes - dash patterns and arrow heads to be output 02438 // properly for EPS, rather than using Camelot 'shorthand' tokens. 02439 pCaps->CanDoNothing(); 02440 pCaps->ClippedOutput = TRUE; 02441 }
|
|
|
Ensure the EPS context has the correct attributes for drawing paths. This required because when the path attributes change, we don't output the EPS commands to reflect this straight away - we set a flag to indicate that the attributes have changed, and then when this function is called, it notices that the attributes have changed, and outputs the EPS commands to select these attributes. This avoids redundant and copious attribute code in our EPS files. (The flags used are ValidPen and FillFlags.ValidGeometry).
Reimplemented in ArtWorksEPSRenderRegion, CamelotEPSRenderRegion, and NativeRenderRegion. Definition at line 1011 of file saveeps.cpp. 01012 { 01013 // Path stroking. Do nothing if the stroke is transparent. 01014 // Note, if this changes you MUST investigate and change GetValidTextAttributes 01015 // cause this needs to output transparent stroke colours. 01016 if (SetLastOutputAttribute(ATTR_WINDINGRULE) || !m_bValidPathAttrs) 01017 { 01018 OutputWindingRule (); 01019 } 01020 01021 if (!RR_STROKECOLOUR().IsTransparent()) 01022 { 01023 if (SetLastOutputAttribute(ATTR_STROKECOLOUR) || !m_bValidPathAttrs) 01024 OutputStrokeColour(); 01025 } 01026 01027 if (SetLastOutputAttribute(ATTR_LINEWIDTH) || !m_bValidPathAttrs) 01028 OutputLineWidth(); 01029 01030 if (SetLastOutputAttribute(ATTR_JOINTYPE) || !m_bValidPathAttrs) 01031 OutputJoinType(); 01032 01033 // Set up the dash pattern first. 01034 OutputDashPatternInit(); 01035 if (SetLastOutputAttribute(ATTR_DASHPATTERN) || !m_bValidPathAttrs) 01036 OutputDashPattern(); 01037 01038 if (SetLastOutputAttribute(ATTR_STARTCAP) || !m_bValidPathAttrs) 01039 OutputStartCap(); 01040 01041 if (SetLastOutputAttribute(ATTR_MITRELIMIT) || !m_bValidPathAttrs) 01042 OutputMitreLimit(); 01043 01044 // Path filling 01045 01046 if (!RR_FILLCOLOUR().IsTransparent()) 01047 { 01048 if (SetLastOutputAttribute(ATTR_FILLGEOMETRY) || !m_bValidPathAttrs) 01049 OutputFillColour(); 01050 } 01051 01052 // The path attributes must be valid (as we've just written them). 01053 m_bValidPathAttrs = TRUE; 01054 01055 }
|
|
|
Text equivalent of GetValidPathAttributes().
Reimplemented in NativeRenderRegion. Definition at line 643 of file saveeps.cpp. 00644 { 00645 // Illustrator does not specify a token for changing 00646 // -fontsize 00647 // -bold 00648 // -italic 00649 // We need to use the standard Tf token. (see OutputFontName) 00650 00651 BOOL FontOut = FALSE; 00652 if (SetLastOutputAttribute(ATTR_TXTFONTTYPEFACE)) 00653 { 00654 FontOut=TRUE; 00655 } 00656 00657 if (SetLastOutputAttribute(ATTR_TXTFONTSIZE)) 00658 { 00659 FontOut=TRUE; 00660 } 00661 00662 if (SetLastOutputAttribute(ATTR_TXTBOLD)) 00663 { 00664 FontOut=TRUE; 00665 } 00666 00667 if (SetLastOutputAttribute(ATTR_TXTITALIC)) 00668 { 00669 FontOut=TRUE; 00670 } 00671 00672 if (!m_bValidTextAttrs) 00673 { 00674 FontOut = TRUE; 00675 } 00676 00677 // ok check whether a font change needs generating 00678 if (FontOut) 00679 OutputFontName(); 00680 00681 00682 BOOL FillNLine = FALSE; 00683 if (SetLastOutputAttribute(ATTR_STROKECOLOUR)) 00684 { 00685 FillNLine = TRUE; 00686 } 00687 00688 if (SetLastOutputAttribute(ATTR_FILLGEOMETRY)) 00689 { 00690 FillNLine = TRUE; 00691 } 00692 00693 if (!m_bValidTextAttrs) 00694 { 00695 FillNLine = TRUE; 00696 } 00697 00698 // Text Render mode needs changing as Text has gained or lost fill and/or 00699 // line colours 00700 if (FillNLine) 00701 { 00702 OutputTextRenderMode (); 00703 } 00704 00705 if (SetLastOutputAttribute(ATTR_TXTASPECTRATIO) || !m_bValidTextAttrs) 00706 { 00707 OutputTextAspectRatio (); 00708 } 00709 00710 if (SetLastOutputAttribute(ATTR_TXTTRACKING) || !m_bValidTextAttrs) 00711 { 00712 OutputTextTracking (); 00713 } 00714 00715 if (SetLastOutputAttribute(ATTR_TXTJUSTIFICATION) || !m_bValidTextAttrs) 00716 { 00717 OutputTextJustification (); 00718 } 00719 00720 // BODGE TEXT - should this be output before any lines rather than on a line 00721 // by line basis? 00722 if (SetLastOutputAttribute(ATTR_TXTLINESPACE) || !m_bValidTextAttrs) 00723 { 00724 OutputTextLineSpacing (); 00725 } 00726 00727 if (SetLastOutputAttribute(ATTR_TXTBASELINE) || !m_bValidTextAttrs) 00728 { 00729 OutputTextBaselineShift (); 00730 } 00731 00732 if (SetLastOutputAttribute(ATTR_TXTSCRIPT) || !m_bValidTextAttrs) 00733 { 00734 OutputTextSubSuperScript (); 00735 } 00736 00737 // The text attributes are now Definitely valid (as we've just written all of them) 00738 m_bValidTextAttrs = TRUE; 00739 }
|
|
|
Initialise an EPSOutputFilter object.
Reimplemented from VectorFileRenderRegion. Definition at line 182 of file saveeps.cpp. 00183 { 00184 // Initialise all member variables. 00185 ValidPen = FALSE; 00186 LastOutputAttrs = NULL; 00187 ExportFile = NULL; 00188 CreatorString = NULL; 00189 00190 m_bValidPathAttrs = TRUE; 00191 m_bValidTextAttrs = TRUE; 00192 00193 // All ok 00194 return TRUE; 00195 }
|
|
|
Initialise the device specific mechanisms for this render region.
Reimplemented from RenderRegion. Reimplemented in PrintPSRenderRegion. Definition at line 247 of file saveeps.cpp. 00248 { 00249 // Call base class 00250 if (!RenderRegion::InitDevice()) 00251 return FALSE; 00252 00253 // Set the render caps up 00254 GetRenderRegionCaps(&Caps); 00255 00256 // Buffer used to build up the %%For and %%CreationDate comments. 00257 TCHAR buf[300]; 00258 00259 // Find out which document we're using 00260 ENSURE(RenderView->GetDoc() != NULL, "View's document is NULL!"); 00261 Document *TheDocument = RenderView->GetDoc(); 00262 00263 KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC); 00264 00265 // Output the standard EPS header affair... 00266 WriteEPSVersion (); 00267 00268 // Name of program that created this file. 00269 pDC->OutputToken ( _T("%%Creator:") ); 00270 pDC->OutputToken ( CreatorString ); 00271 pDC->OutputNewLine (); 00272 00273 // File version saving. In anything but Native format does nothing 00274 WriteFileVersion ( pDC ); 00275 00276 // Output the %%For comment 00277 camSprintf(buf, _T("%%%%For: (%s) (%s)"), ReleaseInfo::GetLicensee(), ReleaseInfo::GetCompany()); 00278 pDC->OutputToken(buf); 00279 pDC->OutputNewLine(); 00280 00281 // The title of the picture 00282 String_256 DocumentTitle = TheDocument->GetTitle(); 00283 camSprintf(buf, _T("%%%%Title: (%s)"), (TCHAR *) DocumentTitle); 00284 pDC->OutputToken(buf); 00285 pDC->OutputNewLine(); 00286 00287 // Date this file was created. 00288 time_t Now; 00289 time(&Now); 00290 struct tm *pNow = localtime(&Now); 00291 #if 1 00292 char buf2[100]; 00293 strftime(buf2, 100, "%%%%CreationDate: (%d/%m/%y) (%I:%M %p)", pNow); 00294 INT32 i=0; 00295 char c; 00296 do 00297 { 00298 c=buf2[i]; 00299 buf[i]=c; // 1:1 char/TCHAR conversion 00300 i++; 00301 } while (c); 00302 00303 #else 00304 _tcsftime(buf, 100, "%%%%CreationDate: (%d/%m/%y) (%I:%M %p)", pNow); 00305 #endif 00306 pDC->OutputToken(buf); 00307 pDC->OutputNewLine(); 00308 00309 // Bounding box. 00310 WriteEPSBoundingBox (); 00311 00312 // Get a handle to our filter 00313 EPSExportDC *pExportDC = (EPSExportDC *) pDC; 00314 EPSFilter *pFilter = (EPSFilter *) pExportDC->GetParentFilter(); 00315 00316 // Write out the document's process colours. (Only for AIEPS.) 00317 WriteEPSProcessColours (); 00318 00319 // Write out the Documents fonts 00320 TheDocument->WriteEPSFonts ( pFilter ); 00321 00322 // Write out the Documents resources 00323 WriteEPSResources ( pFilter, TheDocument ); 00324 00325 // Write out the Documents comments 00326 TheDocument->WriteEPSComments ( pFilter ); 00327 00328 // We can say compress this file if native. 00329 // We will leave the document comments in so that things like the clipart gallery 00330 // can still easily access this useful information. 00331 // 00332 // Compressed saving. In anything but Native format does nothing 00333 WriteCompressionState ( pDC ); 00334 00335 // Get all the document components to output their header comments (if any) 00336 DocComponent *pComponent = TheDocument->EnumerateDocComponents ( NULL ); 00337 00338 while (pComponent != NULL) 00339 { 00340 // Inform this document component that we are about to start an EPS export. 00341 pComponent->WriteEPSComments(pFilter); 00342 00343 // Look for next doc component 00344 pComponent = TheDocument->EnumerateDocComponents(pComponent); 00345 } 00346 00347 // No more comments 00348 pDC->OutputToken ( _T("%%EndComments") ); 00349 pDC->OutputNewLine (); 00350 00351 // Do the prolog... 00352 pDC->OutputToken ( _T("%%BeginProlog") ); 00353 pDC->OutputNewLine (); 00354 00355 // Do the render region specific prolog. 00356 WriteProlog ( pDC ); 00357 00358 // Write out the document,s Prolog script. 00359 WriteEPSProlog ( pFilter, TheDocument ); 00360 00361 // and the doc components prolog 00362 pComponent = TheDocument->EnumerateDocComponents(NULL); 00363 while (pComponent != NULL) 00364 { 00365 // Get this document component to write its EPS prolog out to the file. 00366 pComponent->WriteEPSProlog(pFilter); 00367 00368 // Look for next doc component 00369 pComponent = TheDocument->EnumerateDocComponents(pComponent); 00370 } 00371 00372 pDC->OutputToken(_T("%%EndProlog")); 00373 pDC->OutputNewLine(); 00374 00375 // Do the setup... 00376 pDC->OutputToken(_T("%%BeginSetup")); 00377 pDC->OutputNewLine(); 00378 00379 // Do the render region specific setup. 00380 WriteSetup ( pDC ); 00381 00382 // Write out the font definition. 00383 WriteDocumentSetup ( TheDocument, pFilter ); 00384 00385 // and the components setup 00386 pComponent = TheDocument->EnumerateDocComponents(NULL); 00387 while (pComponent != NULL) 00388 { 00389 // Get this document component to write its EPS setup out to the file. 00390 pComponent->WriteEPSSetup(pFilter); 00391 00392 // Look for next doc component 00393 pComponent = TheDocument->EnumerateDocComponents(pComponent); 00394 } 00395 00396 // Parse through the tree, locate the gradient fills, and write them out 00397 // to the file. 00398 WriteGradientFills ( TheDocument ); 00399 00400 // Wrap up the header section 00401 pDC->OutputToken(_T("%%EndSetup")); 00402 pDC->OutputNewLine(); 00403 00404 // We are into the main script of the EPS file here, so give the 00405 // doc components one last chance to write something out 00406 pComponent = TheDocument->EnumerateDocComponents(NULL); 00407 00408 while (pComponent != NULL) 00409 { 00410 // Get this document component to write its EPS Script data to the file 00411 pComponent->WriteScript(pFilter); 00412 00413 // Look for next doc component 00414 pComponent = TheDocument->EnumerateDocComponents(pComponent); 00415 } 00416 00417 // Set up render region 00418 InitClipping (); 00419 00420 // All ok 00421 return TRUE; 00422 }
|
|
|
Output the current dash pattern settings. Watch for interaction with line widths, a change of line width causes the dash pattern to become invalid. To output a dash pattern correctly, use the following code.
Reimplemented in AIEPSRenderRegion. Definition at line 1173 of file saveeps.cpp. 01174 { 01175 KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC); 01176 01177 // Set dash pattern 01178 INT32 NumEls = RR_DASHPATTERN().Elements; 01179 INT32* TempArray = NULL; 01180 01181 // If the dash patterns need scaling, then we need to scale them 01182 // here, as Illustrator format uses absolute sizes for the dash 01183 // patterns, rather than the 'relative to line width' that we use 01184 // INT32 DashLineWidth = RR_DASHPATTERN().LineWidth; 01185 INT32 LineWidth = RR_LINEWIDTH(); 01186 01187 BOOL DoScale = RR_DASHPATTERN().ScaleWithLineWidth; 01188 FIXED16 Scale = DoScale ? (double(LineWidth) / double(RR_DASHPATTERN().LineWidth)) : 1; 01189 01190 // Don't bother with zero width lines 01191 if (LineWidth == 0) 01192 NumEls = 0; 01193 01194 // But we needn't bother if there are no elements 01195 if (NumEls > 0) 01196 { 01197 INT32* DashArray = RR_DASHPATTERN().ElementData; 01198 TempArray = new INT32[NumEls]; 01199 01200 if (TempArray) 01201 { 01202 for (INT32 el=0; el<NumEls; el++) 01203 { 01204 TempArray[el] = LongMulFixed16(DashArray[el], Scale); 01205 01206 if (TempArray[el] == 0) 01207 { 01208 // Found a zero dash element - this line is obviously too small 01209 // to bother with dash patterns. 01210 NumEls = 0; 01211 break; 01212 } 01213 } 01214 } 01215 } 01216 01217 // Output the (possibly scaled) array of On-Off distances 01218 pDC->OutputArray(TempArray, NumEls); 01219 01220 // Delete the temp buffer if necessary 01221 delete TempArray; 01222 01223 // Also scale the Dash Start Offset if need be 01224 INT32 Offset = LongMulFixed16(RR_DASHPATTERN().DashStart, Scale); 01225 pDC->OutputUserSpaceValue(Offset); 01226 01227 pDC->OutputToken(_T("d")); 01228 pDC->OutputNewLine(); 01229 }
|
|
|
Sets up the next dash pattern for output.
Definition at line 1138 of file saveeps.cpp. 01139 { 01140 if (!StrokeFlags.ValidDashPattern && (RR_DASHPATTERN().Elements > 0)) 01141 { 01142 // Delete the attribute if necessary 01143 if (LastOutputAttrs[ATTR_DASHPATTERN].Temp) 01144 delete LastOutputAttrs[ATTR_DASHPATTERN].pAttr; 01145 01146 // Set to NULL to force it to be output by SetLastOutputAttribute() 01147 LastOutputAttrs[ATTR_DASHPATTERN].pAttr = NULL; 01148 } 01149 01150 // Don't do this again until we need to. 01151 StrokeFlags.ValidDashPattern = TRUE; 01152 }
|