CamelotEPSFilter Class Reference

A filter that imports EPS files in Camelot EPS format. More...

#include <cameleps.h>

Inheritance diagram for CamelotEPSFilter:

ArtWorksEPSFilter EPSFilter VectorFilter Filter ListItem CCObject SimpleCCObject CamelotNativeEPSFilter List of all members.

Public Member Functions

 CamelotEPSFilter ()
 Constructor for an CamelotEPSFilter object. The object should be initialised before use.
BOOL Init ()
 Initialise an CamelotEPSFilter object.
BOOL IsDefaultDocRequired (const TCHAR *pcszPathName)
 Works out if opening a file of this type requires a default document to be loaded. If the file format supplies the document then return FALSE otherwise return TRUE. An example would be opening a bitmap file. This has no document defined in the file format and so we need to load the default document before importing the bitmap into this file. In this baseclass version return FALSE and hence assume that the filters that need to will override this function to return TRUE.
BOOL PrepareToExport (CCLexFile *, Spread *pSpread)
 Prepare to import EPS data using this filter. This sets up the filter to a sensible state for reading.
TCHARGetEPSCommand (EPSCommand Cmd)
 Given an EPS token, return the string representation of it; mainly for debugging purposes.
BOOL ExportBitmap (KernelBitmap &)
 Export a bitmap to a Camelot EPS file. This outputs the standard tokens and data required to embed a bitmap in a Camelot EPS file.
virtual BOOL CanIncludePreviewBmp ()
 Admits that Camelot EPS is able to have a Preview Bitmap attached to the document. To actually put a bitmap into the file, call the IncludePreviewBmp(TRUE).

Protected Member Functions

virtual void LookUpToken ()
 Compare the current token against the Camelot keywords to see if it is one of them.
virtual BOOL ProcessToken ()
 Processes EPS tokens that are not part of the standard Illustrator set, or which need to be handled differently to the standard Illustrator meanings. i.e. this is the function that handles all the Camelot EPS operators.
INT32 EPSHeaderIsOk (ADDR pFileHeader, UINT32 HeaderSize)
 Checks to see if the EPS comment headers specify that this is an Camelot generated EPS file, as required.
BOOL PrepareToImport ()
 See base class. This just sets up the bitmap fill flag for Camelot EPS.
void CleanUpAfterImport (BOOL Successful)
 stops stuff happening after clearing up for a Camelot EPS import
virtual BOOL GetExportOptions ()
 Allows the user to be prompted to get information for export. In this Camelot EPS case, we are affectively exporting a printable EPS and so require the user to set a few options. Moves the code from OilFilters to a proper function. Scope: Protected.
virtual BOOL ReadBitmap ()
 Reads the bitmap info from the eps stack and loads in the bitmap data It loads a type 0 bitmap.
virtual void BitmapPoolAttach (KernelBitmap *pBitmap)
 Makes a reference to the bitmap so that it can be used throughout the eps file with repeating the data. This base class version actually does nothing but delete the bitmap. CamelotNativeEPS is where the real processing is done.
BOOL ProcessBlend ()
 Reads in all the elements of a blend structure in the EPS file.
BOOL ProcessBlender ()
 Reads in all the elements of a blender structure in the EPS file.
BOOL StartBlend ()
 Used when a blend structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new blend, until EndBlend is called.
BOOL StartBlender ()
 Used when a blender structure needs to be created - after this is called, all paths will be discarded, until EndBlender is called.
BOOL EndBlend ()
 Used when a blend has finished being constructed and we want to return to normal node positioning. The blend is added to the document when this function is called (although that depending on the current filter mode, i.e. whether this is a new or existing layer, it may not be added directly to the documnent tree straight away - it may be deferred until the next layer is found, or the import has ended).
BOOL EndBlender ()
 Used when a blender has finished being constructed. Path importing is returned to normal (i.e. they're no longer discarded).
BOOL ProcessRegularShape ()
 Reads in all the elements of a blend structure in the EPS file.
BOOL ProcessRegularShapeParams ()
 Reads in all the parameters of a regular shape structure in the EPS file.
BOOL ProcessEnvelope ()
 Reads in all the elements of an envelope structure in the EPS file.
BOOL ProcessPerspective ()
 Reads in all the elements of an perspective structure in the EPS file.
BOOL StartMould (MouldSpace mSpace)
 Used when an mould structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new mould, until EndMould is called.
BOOL EndMould ()
 Used when a mould has finished being constructed and we want to return to normal node positioning.
BOOL RemoveUnwantedAttributes (NodeMould *pNodeMould)
 Removes unwanted attributes added as first children of the node mould. It does this by scanning the children of the nodemouldgroup and determining what attributes are applied here.
void BuildSubtreeAttrMap (CCAttrMap *pAttribMap, Node *pNode)
 Adds all attribute pointers to the pAttribMap which it finds as children of pParent. Notes: Told off by MarkN for not commenting ... oopps.
BOOL ProcessMould ()
 Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.
BOOL ProcessMouldTokens ()
 Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.
BOOL ProcessMouldShape ()
 Reads in all the elements of a mould geometry held in the EPS file. The description of the geometry for this particular file type is that of a path. Input Stack = coord, coord.
BOOL ProcessMouldSourceObjs ()
 Reads in all the objects within the mould source grouping.
BOOL ProcessMouldDestinObjs ()
 Reads in all the objects within the mould destination grouping.
BOOL ProcessMouldThreshold ()
 Reads in all the elements of a mould threshold structure in the EPS file. The threshold structure is defined as an extension token as it only came into existance after version 1.1 documents. This function is called from the extension token parser. We read the threshold value and set the EPSFilter variable NewMouldThreshold. Having read in the mould, the threshold will be read from this variable and overwrite the default constructed threshold.
BOOL ReadSimplePath (Path *TempPath)
 Reads in the defined mould path shape.
BOOL ProcessFontFlags ()
 Reads in all the elements of a font flags structure in the EPS file.
BOOL ProcessBitmapFlags ()
 Reads in all the elements of a bitmap flags structure in the EPS file.
BOOL ProcessFontType ()
 Reads in all the elements of a font type structure in the EPS file.
BOOL FindEndOfTag ()
 Continues reading tokens until the ceo token is found.
BOOL ProcessGuideLayer ()
 Reads in a guide layer object.
BOOL ProcessGuideline ()
 Reads in a guide line object.

Protected Attributes

PendingBitmap m_PendingBitmap
INT32 BitmapTransparencyIndex
KernelBitmappBitmap
NodeRegularShapepRegularShape
BOOL RegularShapeIsFilled
BOOL RegularShapeIsStroked
CamelotEPSFilter::_BitmapAttrs BitmapAttrs

Static Protected Attributes

static CommandMap CamelotCommands []

Private Member Functions

 CC_DECLARE_DYNAMIC (CamelotEPSFilter)

Classes

struct  _BitmapAttrs

Detailed Description

A filter that imports EPS files in Camelot EPS format.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/03/94
See also:
EPSFilter; ArtWorksEPSFilter

Definition at line 262 of file cameleps.h.


Constructor & Destructor Documentation

CamelotEPSFilter::CamelotEPSFilter  ) 
 

Constructor for an CamelotEPSFilter object. The object should be initialised before use.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/93
See also:
EPSFilter::Init

Definition at line 293 of file cameleps.cpp.

00294 {
00295     // Set up filter descriptions.
00296     FilterNameID = _R(IDT_CAMEPS_FILTERNAME);
00297     FilterInfoID = _R(IDT_CAMEPS_FILTERINFO);
00298     ImportMsgID  = _R(IDT_IMPORTMSG_CAMELOT);
00299     ExportMsgID  = _R(IDT_EXPORTMSG_CAMEPS);
00300 
00301     FilterID = FILTERID_CAMELOT_EPS;
00302 
00303 #ifndef STANDALONE
00304     Flags.CanImport = TRUE;
00305     //WEBSTER-Martin-27/01/97
00306 #ifdef WEBSTER
00307     Flags.CanExport = FALSE;
00308 #else
00309     Flags.CanExport = TRUE;
00310 #endif //WEBSTER
00311 #else
00312     Flags.CanImport = FALSE;
00313     Flags.CanExport = FALSE;
00314 #endif
00315 
00316     // We don't want to re-position Camelot files because they should be ok and
00317     // Charles gets upset if his drawings move.
00318     AdjustOrigin = FALSE;
00319 
00320 }


Member Function Documentation

void CamelotEPSFilter::BitmapPoolAttach KernelBitmap pBitmap  )  [protected, virtual]
 

Makes a reference to the bitmap so that it can be used throughout the eps file with repeating the data. This base class version actually does nothing but delete the bitmap. CamelotNativeEPS is where the real processing is done.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/1/95
Parameters:
pBitmap - The bitmap to attach [INPUTS]

Reimplemented in CamelotNativeEPSFilter.

Definition at line 1494 of file cameleps.cpp.

01495 {
01496     // Base class version of the function just deletes the bitmap as it does not really know
01497     // what it needs to do with it
01498     if (pBitmap!=NULL)
01499         delete pBitmap;
01500 }

void CamelotEPSFilter::BuildSubtreeAttrMap CCAttrMap pAttribMap,
Node pParent
[protected]
 

Adds all attribute pointers to the pAttribMap which it finds as children of pParent. Notes: Told off by MarkN for not commenting ... oopps.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/10/95
Parameters:
pAttribMap = a pointer to an attribute map [INPUTS] pParent = a pointer to the parent node
Returns:
-

Definition at line 2519 of file cameleps.cpp.

02520 {
02521     CCRuntimeClass* pTypeInfo;
02522     void* pDummy;
02523 
02524     Node* qNode = pParent->FindFirstChild();
02525     while (qNode)
02526     {
02527         if (qNode->IsAnAttribute())
02528         {
02529             NodeAttribute* pAttrib = (NodeAttribute*)qNode;
02530             pTypeInfo = pAttrib->GetAttributeType();
02531             if (!pAttribMap->Lookup(pTypeInfo, pDummy))
02532                 pAttribMap->SetAt(pTypeInfo, qNode);
02533         }
02534 
02535         if (qNode->FindFirstChild())
02536         {
02537             BuildSubtreeAttrMap(pAttribMap, qNode);
02538         }
02539 
02540         qNode = qNode->FindNext();
02541     }
02542 }

BOOL CamelotEPSFilter::CanIncludePreviewBmp  )  [virtual]
 

Admits that Camelot EPS is able to have a Preview Bitmap attached to the document. To actually put a bitmap into the file, call the IncludePreviewBmp(TRUE).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/95
Returns:
TRUE
See also:
Filters::CanIncludePreviewBmp

Reimplemented from Filter.

Definition at line 364 of file cameleps.cpp.

00365 {
00366     return TRUE;
00367 }

CamelotEPSFilter::CC_DECLARE_DYNAMIC CamelotEPSFilter   )  [private]
 

void CamelotEPSFilter::CleanUpAfterImport BOOL  Successful  )  [protected, virtual]
 

stops stuff happening after clearing up for a Camelot EPS import

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/07/95
Parameters:
[INPUTS] 
Returns:
-

Errors: -

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 524 of file cameleps.cpp.

00525 {
00526     if(IS_A(this, CamelotEPSFilter))
00527         return;
00528 
00529     ArtWorksEPSFilter::CleanUpAfterImport(Successful);
00530 }

BOOL CamelotEPSFilter::EndBlend  )  [protected]
 

Used when a blend has finished being constructed and we want to return to normal node positioning. The blend is added to the document when this function is called (although that depending on the current filter mode, i.e. whether this is a new or existing layer, it may not be added directly to the documnent tree straight away - it may be deferred until the next layer is found, or the import has ended).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blend was ended ok; FALSE if not.

Errors: Out of memory

See also:
CamelotEPSFilter::StartBlend

Reimplemented from ArtWorksEPSFilter.

Definition at line 1912 of file cameleps.cpp.

01913 {
01914     // Sanity check
01915     ENSURE(pNode->IsKindOf(CC_RUNTIME_CLASS(NodeBlend)), "No blend in CamelotEPSFilter::EndBlend");
01916 
01917     // Keep the blend ptr and find the first child of the node before we reset pNode.
01918     Node* pNodeBlend = pNode;
01919     Node* pChildNode = pNode->FindFirstChild();
01920 
01921     // Get the parent of the blend node, and use that to add new objects to
01922     pNode = pNodeBlend->FindParent();
01923     ENSURE(pNode != NULL, "Blend has no parent in ProcessBlend()");
01924 
01925     // Initialise all the child blender nodes
01926     UINT32 BlenderCount=0;
01927     while (pChildNode != NULL)
01928     {
01929         if (IS_A(pChildNode,NodeBlender))
01930         {
01931             NodeBlender* pNodeBlender = (NodeBlender*)pChildNode;
01932 
01933             // Get the imported blender params
01934             INT32 PathIndexStart = pNodeBlender->GetPathIndexStart();
01935             INT32 PathIndexEnd   = pNodeBlender->GetPathIndexEnd();
01936             INT32 ObjIndexStart     = pNodeBlender->GetObjIndexStart();
01937             INT32 ObjIndexEnd       = pNodeBlender->GetObjIndexEnd();
01938 
01939             // Find the nodes this blender is to blend together
01940             NodeRenderableInk* pNodeStart = pNodeBlender->FindObjIndexedNode(ObjIndexStart);
01941             NodeRenderableInk* pNodeEnd   = pNodeBlender->FindObjIndexedNode(ObjIndexEnd);
01942 
01943             // They should not be NULL
01944             if (pNodeStart == NULL || pNodeEnd == NULL)
01945                 return FALSE;
01946 
01947             // Init the blender with the start and end nodes.
01948             if (!pNodeBlender->Initialise(pNodeStart,pNodeEnd,PathIndexStart,PathIndexEnd,ImportInfo.pOp,NULL,TRUE))
01949                 return FALSE;
01950 
01951             BlenderCount++;
01952         }
01953         pChildNode = pChildNode->FindNext();
01954     }
01955 
01956     if (BlenderCount == 0)
01957     {
01958         ERROR3("Imported Blend node doesn't contain any blender nodes");
01959         if (!ImportInfo.pOp->DoHideNode(pNodeBlend, TRUE))
01960             return FALSE;
01961     }
01962 
01963     return TRUE;
01964 }

BOOL CamelotEPSFilter::EndBlender  )  [protected]
 

Used when a blender has finished being constructed. Path importing is returned to normal (i.e. they're no longer discarded).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blender was ended ok; FALSE if not.

Errors: -

See also:
CamelotEPSFilter::StartBlender

Reimplemented from ArtWorksEPSFilter.

Definition at line 2077 of file cameleps.cpp.

02078 {
02079     ThePathType = PATH_NORMAL;
02080     return TRUE;
02081 }

BOOL CamelotEPSFilter::EndMould  )  [protected]
 

Used when a mould has finished being constructed and we want to return to normal node positioning.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/03/95
Returns:
TRUE if the envelope was ended ok; FALSE if not.
See also:
CamelotEPSFilter::StartMould()

Reimplemented from ArtWorksEPSFilter.

Definition at line 2408 of file cameleps.cpp.

02409 {
02410     // Sanity check
02411     ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeMould)), "No MouldParent in CamelotEPSFilter::EndMould");
02412 
02413     // Get a pointer to the mould object
02414     NodeMould* pNodeMould = (NodeMould*)pNode;
02415     // move pNode up one level
02416     pNode = pNode->FindParent();
02417     ERROR3IF(pNode==NULL, "No parent of mould in CamelotEPSFilter::EndMould");
02418 
02419     // for loaded docs we need to set the default threshold to the
02420     // old 1024 threshold until such time as it changes by way of parsing
02421     // the threshold token. This avoids blends from remapping!
02422     pNodeMould->GetGeometry()->SetThreshold(EPSFilter::NewMouldThreshold);
02423 
02424     // We should really have these items, otherwise well, we have nothing whatsoever
02425     NodeMouldPath* pNodeMouldPath = (NodeMouldPath*)pNodeMould->FindFirstChild(CC_RUNTIME_CLASS(NodeMouldPath));
02426     NodeMouldGroup* pNodeMouldGroup = (NodeMouldGroup*)pNodeMould->FindFirstChild(CC_RUNTIME_CLASS(NodeMouldGroup));
02427 
02428     if (pNodeMouldPath==NULL || pNodeMouldGroup==NULL)
02429     {
02430         // delete the object and all its children
02431         pNodeMould->CascadeDelete();
02432     }
02433 
02434     // Finally trash any unwanted attributes which may have been added
02435     // by SnapShotCurrentAttributes.
02436     RemoveUnwantedAttributes(pNodeMould);
02437 
02438     // All is well and lovely
02439     return TRUE;
02440 }

INT32 CamelotEPSFilter::EPSHeaderIsOk ADDR  pFileHeader,
UINT32  HeaderSize
[protected, virtual]
 

Checks to see if the EPS comment headers specify that this is an Camelot generated EPS file, as required.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Returns:
TRUE if the header is ok and import should proceed, FALSE if not.

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 408 of file cameleps.cpp.

00409 {
00410     // THIS ROUTINE IS NOT UNICODE
00411     // Check the first line in EPS file
00412     if (strncmp((char *) pFileHeader, "%!PS-Adobe-2.0 EPSF-1.2", 23) != 0)
00413     {
00414         // Incorrect version of EPS header line - we don't want this
00415         return 0;
00416     }
00417 
00418     // !PS-Adobe line is ok - check creator line...
00419     istringstream HeaderFile( (char*)pFileHeader );
00420     char Buffer[200];
00421 
00422     UINT32 Lines = 0;
00423     while ((Lines < 20) && !HeaderFile.eof())
00424     {
00425         HeaderFile.getline(Buffer, 200);
00426         Lines++;
00427 
00428         // Return TRUE if this file was created by Camelot
00429         if (strncmp(Buffer, "%%Creator: Camelot", 18) == 0)
00430         {
00431             // Camelot is the creator.
00432             return 10;
00433         }
00434         // (ChrisG 8/11/00) Changed creator type to "Xara X")
00435         else if (strncmp (Buffer, "%%Creator: Xara X", 17) == 0)
00436         {
00437             // New Xara X string was set as the creator.
00438             return 10;
00439         }
00440 
00441         // If we find the compression token then stop the search as we don't want to start
00442         // looking in the compressed data!
00443         if (strncmp(Buffer, "%%Compression:", 14)==0)
00444             break;
00445     }
00446 
00447     // Didn't find a suitable Creator line, but we did find an EPS line, so indicate
00448     // that we're interested, but not sure.
00449     return 5;
00450 }

BOOL CamelotEPSFilter::ExportBitmap KernelBitmap TheBitmap  )  [virtual]
 

Export a bitmap to a Camelot EPS file. This outputs the standard tokens and data required to embed a bitmap in a Camelot EPS file.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/09/94
Parameters:
TheBitmap - the bitmap to export [INPUTS]
Returns:
TRUE if the bitmap was exported ok (or if it wasn't exported because the file format does not support it; FALSE if an error occured.

Errors: Usual disk/file errors.

See also:
Filter::ExportBitmap

Reimplemented from Filter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 1520 of file cameleps.cpp.

01521 {
01522 #if !defined(EXCLUDE_FROM_RALPH)
01523     BitmapInfo Info;
01524     String_256 BitmapName;
01525 
01526     // Check to seed if the bitmap has a transparent Index, 
01527     // and output a special token if so
01528     if (TheBitmap.ActualBitmap->GetBPP() <= 8)
01529     {
01530         INT32 TransparencyIndex;
01531 
01532         if (TheBitmap.ActualBitmap->GetTransparencyIndex(&TransparencyIndex))
01533         {
01534             TRACEUSER( "Will", _T("Exporting bitmap with Transparent Index %d\n"), TransparencyIndex);
01535 
01536             ExportDCPtr->OutputValue((INT32) EOTAG_BITMAPFLAGS);
01537             ExportDCPtr->OutputToken(_T("cso"));    // Start of new object type
01538 
01539             ExportDCPtr->OutputValue((INT32) TransparencyIndex);
01540             ExportDCPtr->OutputToken(_T("cbti"));   // Index of the colour that is transparent
01541 
01542             ExportDCPtr->OutputToken(_T("ceo"));    // End of new object type
01543             ExportDCPtr->OutputNewLine();
01544         }
01545     }
01546 
01547     // Get details of the bitmap
01548     TheBitmap.ActualBitmap->GetInfo(&Info);
01549     BitmapName = TheBitmap.ActualBitmap->GetName();
01550 
01551     // Write them out to the EPS file.
01552     ExportDCPtr->OutputString((TCHAR*)BitmapName);
01553     ExportDCPtr->OutputValue((UINT32) Info.PixelWidth);
01554     ExportDCPtr->OutputValue((UINT32) Info.PixelHeight);
01555     ExportDCPtr->OutputValue((UINT32) Info.PixelDepth);
01556     ExportDCPtr->OutputValue((UINT32) Info.NumPaletteEntries);
01557     ExportDCPtr->OutputUserSpaceValue(Info.RecommendedWidth);
01558     ExportDCPtr->OutputUserSpaceValue(Info.RecommendedHeight);
01559 
01560     // Bitmap type is 0 as this is the type that exports all the bitmap data
01561     // Type 1 is used as a reference to a bitmap in the pool
01562     ExportDCPtr->OutputToken(_T("0"));
01563 
01564     // Write out the bitmap start token
01565     ExportDCPtr->OutputToken(_T("csbm"));
01566     ExportDCPtr->OutputNewLine();
01567 
01568     // Write out the bitmap data
01569     TheBitmap.ActualBitmap->ExportBitmap(ExportRegion);
01570 
01571     // Write out the bitmap end token
01572     ExportDCPtr->OutputToken(_T("cebm"));
01573     ExportDCPtr->OutputNewLine();
01574 #endif
01575     // All ok
01576     return TRUE;
01577 }

BOOL CamelotEPSFilter::FindEndOfTag  )  [protected]
 

Continues reading tokens until the ceo token is found.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/06/95
Returns:
TRUE if the end of tag token was found, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1703 of file cameleps.cpp.

01704 {
01705     // Keep processing tokens until we find the 'end of tag' token
01706     while (!EPSFile->eof())
01707     {
01708         GetToken();
01709         switch (Token)
01710         {
01711             case EPSC_ceo:
01712                 return TRUE;
01713                 break;
01714 
01715             default:
01716                 if (!HandleToken())
01717                     return FALSE;
01718                 break;
01719         }
01720     }
01721     HandleEPSError();
01722     return FALSE;
01723 }

TCHAR * CamelotEPSFilter::GetEPSCommand EPSCommand  Cmd  ) 
 

Given an EPS token, return the string representation of it; mainly for debugging purposes.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Parameters:
Cmd - the EPS token, e.g. EPSC_aoa [INPUTS]
Returns:
Pointer to the string representation of the token, e.g. "aoa"

Reimplemented from ArtWorksEPSFilter.

Definition at line 1399 of file cameleps.cpp.

01400 {
01401     INT32 i = 0;
01402     while (CamelotCommands[i].Cmd != EPSC_Invalid)
01403     {
01404         if (CamelotCommands[i].Cmd == Cmd)
01405             return CamelotCommands[i].CmdStr;
01406 
01407         // Try next command
01408         i++;
01409     }
01410 
01411     // Couldn't find it - default to base class method
01412     return ArtWorksEPSFilter::GetEPSCommand(Cmd);
01413 }

BOOL CamelotEPSFilter::GetExportOptions  )  [protected, virtual]
 

Allows the user to be prompted to get information for export. In this Camelot EPS case, we are affectively exporting a printable EPS and so require the user to set a few options. Moves the code from OilFilters to a proper function. Scope: Protected.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> HUmphrys
Date:
22/12/95
Parameters:
- [INPUTS]
Returns:
TRUE if OK, FALSE if user pressed Cancel.

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 548 of file cameleps.cpp.

00549 {
00550 #if !defined(EXCLUDE_FROM_RALPH)
00551     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(XSEPSExportOptions)); 
00552     if ( pOpDesc )
00553         pOpDesc->Invoke();
00554     
00555     return !XSEPSExportOptions::Aborted;
00556 #endif
00557     return TRUE;
00558 }

BOOL CamelotEPSFilter::Init void   )  [virtual]
 

Initialise an CamelotEPSFilter object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Returns:
TRUE if the filter was initialised ok, FALSE otherwise.

Errors: Will fail if not enough memory to initialise the EPS stack.

See also:
EPSStack

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 335 of file cameleps.cpp.

00336 {
00337     // Get the OILFilter object
00338     pOILFilter = new CamelotEPSOILFilter(this);
00339     if (pOILFilter == NULL)
00340         return FALSE;
00341 
00342     // Load the description strings
00343     FilterName.Load(FilterNameID);
00344     FilterInfo.Load(FilterInfoID);
00345 
00346     // All ok
00347     return TRUE;
00348 }

BOOL CamelotEPSFilter::IsDefaultDocRequired const TCHAR pcszPathName  )  [virtual]
 

Works out if opening a file of this type requires a default document to be loaded. If the file format supplies the document then return FALSE otherwise return TRUE. An example would be opening a bitmap file. This has no document defined in the file format and so we need to load the default document before importing the bitmap into this file. In this baseclass version return FALSE and hence assume that the filters that need to will override this function to return TRUE.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/10/95
Parameters:
pcszPathName pointer to the pathname to check [INPUTS]
Returns:
TRUE if the filter requires a default document, FALSE if not.
See also:
Filter; Filter::IsDefaultDocRequired; CCamDoc::OnOpenDocument;

FilterFamily::DoImport; Filter::DoImport;

Reimplemented from EPSFilter.

Definition at line 389 of file cameleps.cpp.

00390 {
00391     // Return false here. All derived classes should return what they need
00392     return FALSE;
00393 }   

void CamelotEPSFilter::LookUpToken  )  [protected, virtual]
 

Compare the current token against the Camelot keywords to see if it is one of them.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/02/94
Returns:
TRUE if the token is an Camelot EPS token; FALSE if not.
See also:
EPSFilter::LookUpToken; EPSFilter::DecodeToken

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 625 of file cameleps.cpp.

00626 {
00627     // Not interested in comments
00628     if (Token == EPSC_Comment)
00629         return;
00630 
00631     // Check to see if it is a keyword - cycle through the array of keyword names and
00632     // compare against our token (could use a hash table?)
00633     INT32 i = 0;
00634     while (CamelotCommands[i].Cmd != EPSC_Invalid)
00635     {
00636         if (camStrcmp(TokenBuf, CamelotCommands[i].CmdStr) == 0)
00637         {
00638             // Found the token - set the token variable and return success
00639             Token = CamelotCommands[i].Cmd;
00640             return;
00641         }
00642         // Try next command
00643         i++;
00644     }
00645 
00646     // Did not find this token - pass on to base class.
00647     ArtWorksEPSFilter::LookUpToken();
00648 }

BOOL CamelotEPSFilter::PrepareToExport CCLexFile pFile,
Spread pSpread
[virtual]
 

Prepare to import EPS data using this filter. This sets up the filter to a sensible state for reading.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/04/94
Parameters:
pFile - The file to export to [INPUTS] pSpread - the spread to export
Returns:
TRUE if succeeded, FALSE if not (e.g. no memory for EPS stack)

Errors: Out of memory.

See also:
EPSFilter::DoImport; EPSFilter::CleanUpAfterImport Scope: Private

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 577 of file cameleps.cpp.

00578 {
00579 #if !defined(EXCLUDE_FROM_RALPH)
00580     // Use base class to do most of it
00581     if (!EPSFilter::PrepareToExport(pFile, pSpread))
00582         return FALSE;
00583 
00584     // Set export device to use full Camelot accuracy for user space values.
00585     ExportDCPtr->SetFullAccuracy(TRUE);
00586 
00587     // Create the region if it is this class
00588     if (IS_A(this, CamelotEPSFilter))
00589     {
00590         // Don't care about clip regions when exporting - create a null region.
00591         DocRect NullClipRect;
00592         NullClipRect.MakeEmpty();
00593 
00594         // Don't use rendering matrix when exporting EPS as it uses fractional coordinates.
00595         Matrix Identity;
00596 
00597         // Don't use view scale; set to 1
00598         FIXED16 Scale(1);
00599 
00600         ExportRegion = new CamelotEPSRenderRegion(NullClipRect, Identity, Scale);
00601         if (ExportRegion == NULL)
00602             return FALSE;
00603 
00604         // Attach to the right device.
00605         ExportRegion->AttachDevice(DocView::GetSelected(), ExportDCPtr->GetDC(), pSpread);
00606     }
00607 #endif
00608     // All ok
00609     return TRUE;
00610 };

BOOL CamelotEPSFilter::PrepareToImport  )  [protected, virtual]
 

See base class. This just sets up the bitmap fill flag for Camelot EPS.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Returns:
TRUE if filter initialised ok; FALSE if not.

Errors: See base class.

See also:
EPSFilter::PrepareToImport;

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 466 of file cameleps.cpp.

00467 {
00468     if(IS_A(this, CamelotEPSFilter))
00469     {
00470         // tell the user that we can't do it
00471         PathName Path;
00472         String_256 FileName;
00473         BOOL HaveName = FALSE;
00474         if(EPSFile->IsKindOf(CC_RUNTIME_CLASS(CCDiskFile)))
00475         {
00476             CCDiskFile *DF = (CCDiskFile *)EPSFile;
00477 
00478             Path = DF->GetPathName();
00479             FileName = Path.GetFileName();
00480             HaveName = TRUE;
00481         }
00482         String_256 ErrMsg;
00483         if(HaveName)
00484         {
00485             String_256 ErrMsg;
00486             ErrMsg.MakeMsg(_R(IDE_LOADCAMELOTEPSITHINKNOTNAMED), (TCHAR *)FileName);
00487             Error::SetError(0, ErrMsg, 0);
00488         }
00489         else
00490         {
00491             Error::SetError(_R(IDE_LOADCAMELOTEPSITHINKNOT));
00492         }
00493         return FALSE;
00494     }
00495     else
00496     {
00497         // Initialise base class first.
00498         if (!ArtWorksEPSFilter::PrepareToImport())
00499             return FALSE;
00500 
00501         // Not expecting a bitmap fill initially
00502         m_PendingBitmap = PENDING_BITMAP_NONE;
00503         BitmapTransparencyIndex = -1;
00504         pBitmap = FALSE;
00505         pRegularShape = NULL;
00506     }
00507 
00508     return TRUE;
00509 }

BOOL CamelotEPSFilter::ProcessBitmapFlags  )  [protected]
 

Reads in all the elements of a bitmap flags structure in the EPS file.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/06/95
Returns:
TRUE if the bitmap flags were processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1745 of file cameleps.cpp.

01746 {
01747     // Keep processing tokens until we find the end of the bitmap flags tag object
01748     while (!EPSFile->eof())
01749     {
01750         GetToken();
01751 
01752         // Look for the only bitmap tokens we're interested in
01753         switch (Token)
01754         {
01755             case EPSC_ceo:
01756                 // found the end of the bitmap flags block so return done.
01757                 return TRUE;
01758                 break;
01759 
01760             case EPSC_cbot:
01761                 // This token indicates that the next bitmap fill is really 
01762                 // a bitmap object
01763                 m_PendingBitmap = PENDING_BITMAP_OBJECT_FILL;
01764                 break;
01765 
01766             case EPSC_cbti:
01767                 // The next bitmap must have a transparency Index
01768                 INT32 Index;
01769 
01770                 if (!Stack.Pop(&Index))
01771                 {
01772                     HandleEPSError();
01773                     return FALSE;
01774                 }
01775 
01776                 BitmapTransparencyIndex = Index;
01777                 break;
01778 
01779             default:
01780                 // try to handle whatever token this is.
01781                 if (!HandleToken()) 
01782                     return FALSE;
01783                 break;
01784         }
01785     }
01786 
01787     HandleEPSError();
01788     return FALSE;
01789 }

BOOL CamelotEPSFilter::ProcessBlend  )  [protected]
 

Reads in all the elements of a blend structure in the EPS file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blend was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 1803 of file cameleps.cpp.

01804 {
01805     if (!StartBlend())
01806         return FALSE;
01807 
01808     // Keep processing tokens until we find the end of the blend
01809     do
01810     {
01811         GetToken();
01812 
01813         // Look for the end of the blend token...
01814         if (Token == EPSC_cebd)
01815         {
01816             return EndBlend();
01817         }
01818     }
01819     // Otherwise keep going until an error or eof is encountered
01820     while (HandleToken() && (!EPSFile->eof()));
01821 
01822     if (EPSFile->eof())
01823     {
01824         // Didn't find end of blend - syntax error; deal with it
01825         HandleEPSError();
01826     }
01827 
01828     // If we're here, something went wrong
01829     return FALSE;
01830 }

BOOL CamelotEPSFilter::ProcessBlender  )  [protected]
 

Reads in all the elements of a blender structure in the EPS file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blender was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 1979 of file cameleps.cpp.

01980 {
01981     if (!StartBlender())
01982         return FALSE;
01983 
01984     // Keep processing tokens until we find the end of the blender
01985     do
01986     {
01987         GetToken();
01988 
01989         // Look for the end of the blender token...
01990         if (Token == EPSC_cebr)
01991         {
01992             return EndBlender();
01993         }
01994     }
01995     // Otherwise keep going until an error or eof is encountered
01996     while (HandleToken() && (!EPSFile->eof()));
01997 
01998     if (EPSFile->eof())
01999     {
02000         // Didn't find end of blender - syntax error; deal with it
02001         HandleEPSError();
02002     }
02003 
02004     // If we're here, something went wrong
02005     return FALSE;
02006 }

BOOL CamelotEPSFilter::ProcessEnvelope  )  [protected]
 

Reads in all the elements of an envelope structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the envelope object was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 2280 of file cameleps.cpp.

02281 {
02282     // NOT IMPLEMENTED
02283     if (!StartMould(MOULDSPACE_ENVELOPE))
02284         return FALSE;
02285     
02286     if (ProcessMould())
02287         // If we've completed then all is well
02288         return EndMould();
02289 
02290     if (EPSFile->eof())
02291     {
02292         // Didn't find end of envelope - syntax error; deal with it
02293         HandleEPSError();
02294     }
02295 
02296     // if made it here all is not well
02297     return FALSE;
02298 }

BOOL CamelotEPSFilter::ProcessFontFlags  )  [protected]
 

Reads in all the elements of a font flags structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/06/95
Returns:
TRUE if the font flags were processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1593 of file cameleps.cpp.

01594 {
01595     FontFlags.Bold = FALSE;
01596     FontFlags.Italic = FALSE;
01597     // Keep processing tokens until we find the end of the font flags tag object
01598     while (!EPSFile->eof())
01599     {
01600         GetToken();
01601 
01602         // Look for the only font tokens we're interrested in
01603         switch (Token)
01604         {
01605             case EPSC_ceo:
01606                 // found the end of the font flags block so return done.
01607                 return TRUE;
01608                 break;
01609 
01610             case EPSC_cfft:
01611                 // This flag indicates that the next bold/italic attributes are to
01612                 // be applied to the current font style rather than as physical attributes
01613                 FontFlags.Bold = TRUE;
01614                 FontFlags.Italic = TRUE;
01615                 break;
01616 
01617             default:
01618                 // try to handle whatever token this is.
01619                 if (!HandleToken()) 
01620                     return FALSE;
01621                 break;
01622         }
01623     }
01624 
01625     HandleEPSError();
01626     return FALSE;
01627 }

BOOL CamelotEPSFilter::ProcessFontType  )  [protected]
 

Reads in all the elements of a font type structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/06/95
Returns:
TRUE if the font type was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1643 of file cameleps.cpp.

01644 {
01645     EPSFilter::ClassOfFont = FC_TRUETYPE;
01646     // Keep processing tokens until we find the end of the font flags tag object
01647     while (!EPSFile->eof())
01648     {
01649         GetToken();
01650 
01651         // Look for the only font tokens we're interrested in
01652         switch (Token)
01653         {
01654             case EPSC_ceo:
01655                 // found the end of the font flags block so return done.
01656                 return TRUE;
01657                 break;
01658 
01659             case EPSC_cftf:
01660             {
01661                 // This type indicates that the next font name is of a particular font type
01662                 INT32 Type;
01663                 FontClass actclass;
01664 
01665                 if (!Stack.Pop(&Type))
01666                 {
01667                     HandleEPSError();
01668                     return FALSE;
01669                 }
01670 
01671                 if (FONTMANAGER->LegalFontClass(Type, actclass))
01672                     EPSFilter::ClassOfFont = actclass;
01673                 // if we don't know what the class is assume Truetype.
01674             }
01675             break;
01676 
01677             default:
01678                 // try to handle whatever token this is.
01679                 if (!HandleToken()) 
01680                     return FALSE;
01681                 break;
01682         }
01683     }
01684 
01685     HandleEPSError();
01686     return FALSE;
01687 }

BOOL CamelotEPSFilter::ProcessGuideLayer  )  [protected]
 

Reads in a guide layer object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Returns:
TRUE if the guide layer was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 3047 of file cameleps.cpp.

03048 {
03049     String_64 GuideColourName;
03050     PColourCMYK CMYK;
03051     FIXEDPOINT TintVal;
03052 
03053     String_256 LayerName;
03054     INT32 Visible;
03055     INT32 Locked;
03056     INT32 Foreground;
03057     INT32 Printable;
03058 
03059     // Read in the guide layer params
03060     if (!Stack.PopColour(&CMYK, TINT_ILLUSTRATOR, &TintVal, &GuideColourName)   ||  
03061         !Stack.Pop(&Locked)     || 
03062         !Stack.Pop(&Printable)  || 
03063         !Stack.Pop(&Visible)    || 
03064         !Stack.Pop(&Foreground) || 
03065         !Stack.Pop(&LayerName))
03066     {
03067         return FALSE;
03068     }
03069 
03070 #if defined(EXCLUDE_FROM_RALPH)
03071     // In ralph we dont want to import guideline layers
03072 #else
03073     if (Filter::ImportWithLayers)
03074     {
03075         // We are importing layers, so put all new nodes on this layer.
03076         UseLayer(LayerName,TRUE);
03077 
03078         // Try to set the visible/locked flags on this layer, but only if
03079         // we created a new one (i.e. don't change the flags of existing layers.
03080         if (EPSFlags.AddToNewLayer)
03081         {
03082             // Here we force layers to be printable if they are in the foreground - just in case
03083             // This will have to change if the UI allows Printable & Foreground to be specified
03084             // independantly.
03085             Printable = Foreground;
03086 
03087             // Visible flag
03088             // Only relevant for non-guide layers. Guide layer visibility is stored in the DocView
03089             // and is saved in the document comments header
03090 
03091             // Locked flag
03092             pLayer->SetLocked(!(Locked == 0));
03093 
03094             // Printable flag
03095             pLayer->SetPrintable(!(Printable == 0));
03096 
03097             // Background flag
03098             pLayer->SetBackground(Foreground == 0);
03099 
03100             DocColour Col;
03101 
03102             GetEPSColour(&Col,&CMYK,TINT_ILLUSTRATOR,TintVal,&GuideColourName);
03103             IndexedColour* pIndexedColour = Col.FindParentIndexedColour();
03104             pLayer->SetGuideColour(pIndexedColour);
03105         }
03106     }
03107 #endif
03108     return TRUE;
03109 }

BOOL CamelotEPSFilter::ProcessGuideline  )  [protected]
 

Reads in a guide line object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Returns:
TRUE if the guideline was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 3123 of file cameleps.cpp.

03124 {
03125     INT32 Type, Ordinate;
03126 
03127     // Read in the guideline's params
03128     if (!Stack.Pop(&Type)   ||
03129         !Stack.Pop(&Ordinate))
03130     {
03131         return FALSE;
03132     }
03133 
03134 #ifdef WEBSTER
03135     // Neville 8/8/97
03136     // If we aren't importing with layers into Webster, which we wont by default,
03137     // then ignore any guidelines, as these should only be loaded onto guide layers
03138     if (!Filter::ImportWithLayers)
03139         return TRUE;
03140 #endif
03141 
03142     NodeGuideline* pGuideline = new NodeGuideline;
03143     ERROR1IF(pGuideline == NULL, FALSE, _R(IDT_EPS_NOMEMORY));
03144 
03145     // Add it into the tree
03146     if (!AddNewNode(pGuideline))
03147         return FALSE;
03148 
03149     pGuideline->SetType(GuidelineType(Type));
03150     pGuideline->SetOrdinate(Ordinate);
03151 
03152     return TRUE;
03153 }

BOOL CamelotEPSFilter::ProcessMould  )  [protected]
 

Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/03/95
Returns:
TRUE if the mould was processed ok; FALSE if not.
See also:

Reimplemented from ArtWorksEPSFilter.

Definition at line 2561 of file cameleps.cpp.

02562 {
02563     // Try to make a snap shot of the current attribute state
02564     SnapShotCurrentAttrs();
02565 
02566     // process the mould
02567     BOOL success=ProcessMouldTokens();
02568 
02569     // Get rid of the snap shot again.
02570     DeleteSnapShot();
02571 
02572     return success;
02573 }

BOOL CamelotEPSFilter::ProcessMouldDestinObjs  )  [protected]
 

Reads in all the objects within the mould destination grouping.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the source objects have been read correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2988 of file cameleps.cpp.

02989 {
02990     // Sanity check
02991     ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeMould)), "No MouldParent in CamelotEPSFilter::ProcessMouldDestinObjs");
02992     NodeMould* pNodeMould = (NodeMould*)pNode;
02993 
02994     // create a new moulder object
02995     NodeMoulder* pMoulder = pNodeMould->CreateNewMoulder(ImportInfo.pOp);
02996     if (!pMoulder)
02997         return FALSE;
02998 
02999     // Add it into the tree as the last child of the mould
03000     if (!AddNewNode(pMoulder))
03001         return FALSE;
03002 
03003     // save the old insert position
03004     Node* pOldPos=pNode;
03005     pNode=pMoulder;
03006 
03007     // scan the tokens until we find the one we want
03008     BOOL done=FALSE;
03009     while (!done && (!EPSFile->eof()))
03010     {
03011         GetToken();
03012         if (!(done=(Token==EPSC_cedo)))
03013         {
03014             if (!HandleToken())
03015             {   
03016                 pNode=pOldPos;
03017                 return FALSE;
03018             }
03019         }
03020     }
03021 
03022     // reposition our magic insert position 
03023     pNode=pOldPos;
03024 
03025     if (EPSFile->eof())
03026     {
03027         HandleEPSError();
03028         return FALSE;
03029     }
03030 
03031     return TRUE;
03032 }

BOOL CamelotEPSFilter::ProcessMouldShape  )  [protected]
 

Reads in all the elements of a mould geometry held in the EPS file. The description of the geometry for this particular file type is that of a path. Input Stack = coord, coord.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/03/94
Returns:
TRUE if the shape has been read correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 2730 of file cameleps.cpp.

02731 {
02732     // We really should be inside a mould object at this stage
02733     if (!IS_A(pNode,NodeMould)) return FALSE;
02734     NodeMould* pNodeMould = (NodeMould*)pNode;
02735 
02736     Path TempPath;
02737     if (!TempPath.Initialise(24,12))
02738         return FALSE;
02739 
02740     BOOL done = FALSE;
02741     // Keep processing tokens until we find the end of the mould path
02742     while (!done && (!EPSFile->eof()))
02743     {
02744         GetToken();
02745 
02746         switch (Token)
02747         {
02748 
02749             case EPSC_m:
02750                 if (!ReadSimplePath(&TempPath))
02751                     return FALSE;
02752                 break;
02753 
02754             case EPSC_cemp:
02755                 done=TRUE;
02756                 break;
02757 
02758             default:
02759                 // try to handle whatever token this is.
02760                 if (!HandleToken())
02761                     return FALSE;
02762                 break;
02763         }
02764     }
02765 
02766     if (EPSFile->eof())
02767     {
02768         HandleEPSError();
02769         return FALSE;
02770     }
02771 
02772     // We have read the path so now lets try and build the geometry
02773     // check the shape we've been given is fine and lovely  
02774     UINT32 errID;
02775     if (!pNodeMould->GetGeometry()->Validate(&TempPath,errID))
02776     {
02777         // ok the path we read is invalid so lets try to build a valid one
02778         Path* pPath = NULL;
02779         INT32 Corners[4] = {0, 3, 6, 9}; 
02780         if (!pNodeMould->GetGeometry()->MakeValidFrom(&pPath, &TempPath, Corners))
02781             return FALSE;
02782         if (!TempPath.CloneFrom(*pPath))
02783         {
02784             delete pPath;
02785             return FALSE;
02786         }
02787         delete pPath;
02788     }
02789 
02790     // Build and if necessary fit the geometry
02791     NodeMouldPath* pNodeMPath = pNodeMould->CreateNewMouldShape(&TempPath,NULL,ImportInfo.pOp);
02792     if (pNodeMPath==NULL) 
02793         return FALSE;
02794 
02795     // having created the shape bung it in the tree.
02796     if (!AddNewNode(pNodeMPath))
02797     {
02798         delete pNodeMPath;
02799         return FALSE;
02800     }
02801 
02802     /* Ok, what we need to do now is apply the current set of attributes
02803        as first children of the pNodeMould. This will apply all none default
02804        attributes at this level. We need to do this as we dont want the current
02805        attributes as they are now to be applied to objects within the source
02806        mould object tree. If they do get applied there, they will be moulded
02807        and will look wrong.
02808        Background:
02809        There is a problem I'm fixing here. Currently you can apply attributes
02810        to moulds eg dragging a linear fill over a selected mould. This creates
02811        an attribute as a first child of the mould, outside the source object
02812        group which gets moulded. So the att is not moulded. Right, when you
02813        save, these atts are put into the file before the nodemouldpath.
02814        On loading currently all atts are gathered and applied to each object
02815        as it is created. This means atts that weren't moulded migrate onto
02816        objects which will be moulded and get moulded. yuk. So what I am doing
02817        is to save the CurrentAttrs state when we find a start mould token.
02818        Then when we find the nodemouldpath, apply all the current atts and
02819        reset the current set back to the saved set. That means all the atts
02820        that appear before the nodemouldpath dont get applied to the source objects
02821        and only those that appear later do.
02822     */
02823 
02824     if (!ApplyChangedAttrs(pNodeMould))
02825         return FALSE;
02826     
02827     // All is well.
02828     return TRUE;
02829 }

BOOL CamelotEPSFilter::ProcessMouldSourceObjs  )  [protected]
 

Reads in all the objects within the mould source grouping.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the source objects have been read correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2924 of file cameleps.cpp.

02925 {
02926     // Sanity check
02927     ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeMould)), "No MouldParent in CamelotEPSFilter::ProcessMouldSourceObjs");
02928     NodeMould* pNodeMould = (NodeMould*)pNode;
02929 
02930     // Create a mould group object
02931     NodeMouldGroup* pMouldGroup = pNodeMould->CreateNewMouldGroup(ImportInfo.pOp);
02932     if (pMouldGroup==NULL) 
02933         return FALSE;
02934 
02935     if (!AddNewNode(pMouldGroup))
02936     {
02937         delete pMouldGroup;
02938         return FALSE;
02939     }
02940 
02941     // save the old insert position and position to our group
02942     Node* pOldPos = pNode;
02943     pNode = pMouldGroup;
02944 
02945     // scan the tokens until we find the one we want
02946     BOOL done = FALSE;
02947     while (!done && (!EPSFile->eof()))
02948     {
02949         GetToken();
02950         if (!(done=(Token==EPSC_ceso)))
02951         {
02952             if (!HandleToken())
02953             {   
02954                 pNode=pOldPos;
02955                 return FALSE;
02956             }
02957         }
02958     }
02959 
02960     // reposition our magic insert position 
02961     pNode = pOldPos;
02962 
02963     if (EPSFile->eof())
02964     {
02965         HandleEPSError();
02966         return FALSE;
02967     }
02968 
02969     return TRUE;
02970 }

BOOL CamelotEPSFilter::ProcessMouldThreshold  )  [protected]
 

Reads in all the elements of a mould threshold structure in the EPS file. The threshold structure is defined as an extension token as it only came into existance after version 1.1 documents. This function is called from the extension token parser. We read the threshold value and set the EPSFilter variable NewMouldThreshold. Having read in the mould, the threshold will be read from this variable and overwrite the default constructed threshold.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/06/95
Returns:
TRUE if the threshold was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2671 of file cameleps.cpp.

02672 {
02673     EPSFilter::NewMouldThreshold = MOULD_V1THRESHOLD;
02674 
02675     while (!EPSFile->eof())
02676     {
02677         GetToken();
02678         switch (Token)
02679         {
02680             case EPSC_ceo:
02681             {
02682                 // found the end of the threshold block so return done.
02683                 return TRUE;
02684             }
02685             break;
02686 
02687             case EPSC_cmth:
02688             {
02689                 INT32 Threshold;
02690                 if (!Stack.Pop(&Threshold))
02691                 {
02692                     HandleEPSError();
02693                     return FALSE;
02694                 }
02695                 EPSFilter::NewMouldThreshold = Threshold;
02696             }
02697             break;
02698 
02699             default:
02700             {
02701                 // try to handle whatever token this is.
02702                 if (!HandleToken()) 
02703                     return FALSE;
02704             }   
02705             break;
02706         }
02707     }
02708 
02709     HandleEPSError();
02710     return FALSE;
02711 }

BOOL CamelotEPSFilter::ProcessMouldTokens  )  [protected]
 

Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/03/95
Returns:
TRUE if the mould was processed ok; FALSE if not.
See also:

Definition at line 2592 of file cameleps.cpp.

02593 {   
02594     // Keep processing tokens until we find the end of the envelope
02595     while (!EPSFile->eof())
02596     {
02597         GetToken();
02598 
02599         // Look for the end of the mould token...
02600         switch (Token)
02601         {
02602             case EPSC_ceev:
02603             case EPSC_cepr:
02604                 // found the end of the mould so return done.
02605                 return TRUE;
02606                 break;
02607 
02608             case EPSC_csmp:
02609                 // if we've found the envelope/perspective end then
02610                 // all is well.
02611                 if (!ProcessMouldShape())
02612                     return FALSE;
02613                 break;
02614 
02615             case EPSC_csso:
02616             {
02617                 // Remove all current attributes which don't match snap shot
02618                 // saving their values on the stack. (These should not be applied)
02619                 // (See ApplyChangedAttrs call below)
02620                 PushCurrentAttrsBasedOnSnapShot();
02621 
02622                 // Process all mould source objects
02623                 BOOL Success = ProcessMouldSourceObjs();
02624             
02625                 // Put back the current attrs how they were.                
02626                 PopCurrentAttrsBasedOnSnapShot();
02627 
02628                 if (!Success)
02629                     return FALSE;
02630             }
02631             break;
02632 
02633             case EPSC_csdo:
02634                 // Create next object as a child
02635                 if (!ProcessMouldDestinObjs())
02636                     return FALSE;
02637                 break;
02638 
02639             default:
02640                 // try to handle whatever token this is.
02641                 if (!HandleToken()) 
02642                     return FALSE;
02643                 break;
02644         }
02645     }
02646 
02647     HandleEPSError();
02648     return FALSE;
02649 }

BOOL CamelotEPSFilter::ProcessPerspective  )  [protected]
 

Reads in all the elements of an perspective structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the perspective object was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

See also:
ProcessEnvelope() for furher details

Reimplemented from ArtWorksEPSFilter.

Definition at line 2314 of file cameleps.cpp.

02315 {
02316     // NOT IMPLEMENTED
02317     if (!StartMould(MOULDSPACE_PERSPECTIVE))
02318         return FALSE;
02319 
02320     // If we've completed then all is well
02321     if (ProcessMould())
02322         return EndMould();
02323 
02324     if (EPSFile->eof())
02325     {
02326         // Didn't find end of perspective - syntax error; deal with it
02327         HandleEPSError();
02328     }
02329 
02330     // if made it here all is not well
02331     return FALSE;
02332 }

BOOL CamelotEPSFilter::ProcessRegularShape  )  [protected]
 

Reads in all the elements of a blend structure in the EPS file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blend was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2097 of file cameleps.cpp.

02098 {
02099     // Make a regular shape node, and use this as a temporary context for storing path
02100     // data before passing it into the shape object.
02101     pRegularShape = new NodeRegularShape;
02102     if (pRegularShape == NULL)
02103         return FALSE;
02104 
02105     if (!pRegularShape->SetUpShape())
02106     {
02107         delete pRegularShape;            
02108         pRegularShape = NULL;
02109         return FALSE;
02110     }
02111 
02112     // Add it into the tree
02113     if (!AddNewNode(pRegularShape))
02114     {
02115         pRegularShape = NULL;
02116         return FALSE;
02117     }
02118     
02119     // Get a new ink path to store the shape's edge paths in.
02120     ERROR3IF(pInkPath != NULL, "Already creating an InkPath object in regular shape");
02121     pInkPath = new Path;
02122     if (pInkPath == NULL)
02123         return FALSE;
02124 
02125     // Set up the shape's path - this is currently 4 elements long - and 
02126     // move to the start of the path
02127     if (!pInkPath->Initialise())
02128     {
02129         delete pInkPath;
02130         pInkPath = NULL;
02131         delete pRegularShape;
02132         pRegularShape = NULL;
02133         return FALSE;
02134     }   
02135 
02136     pInkPath->FindStartOfPath();
02137 
02138     // Keep processing tokens until we find the end of the regular shape
02139     do
02140     {
02141         GetToken();
02142 
02143         // Look for the end of the regular shape token...
02144         if (Token == EPSC_cers)
02145         {
02146             if (pInkPath != NULL)
02147             {
02148                 // Shape has not been saved correctly if we haven't read in both paths by now.
02149                 HandleEPSError();
02150                 return FALSE;
02151             }
02152 
02153             // Apply current attributes to the shape
02154             if (!AddAttributes(pRegularShape, RegularShapeIsStroked, RegularShapeIsFilled))
02155             {
02156                 HandleNoMemory();
02157                 return FALSE;
02158             }
02159 
02160             // Force shape's path to be reconstructed
02161             pRegularShape->InvalidateCache();
02162             pRegularShape->InvalidateBoundingRect();
02163 
02164             pRegularShape = NULL;
02165             return TRUE;
02166         }
02167     }
02168     // Otherwise keep going until an error or eof is encountered
02169     while (HandleToken() && (!EPSFile->eof()));
02170 
02171     if (EPSFile->eof())
02172     {
02173         // Didn't find end of regular - syntax error; deal with it
02174         HandleEPSError();
02175     }
02176 
02177     // If we're here, something went wrong
02178     return FALSE;
02179 }

BOOL CamelotEPSFilter::ProcessRegularShapeParams  )  [protected]
 

Reads in all the parameters of a regular shape structure in the EPS file.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/95
Returns:
TRUE if the regular shape was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2194 of file cameleps.cpp.

02195 {
02196     // Check we are actually making a regular shape at the moment.
02197     if (pRegularShape == NULL)
02198     {
02199         HandleEPSError();
02200         return FALSE;
02201     }
02202 
02203     UINT32 NumSides;
02204     INT32   Circular;
02205     INT32   Stellated;
02206     INT32   PrimaryCurvature;
02207     INT32   StellationCurvature;
02208     double  StellRadiusToPrimary;
02209     double  PrimaryCurveToPrimary;
02210     double  StellCurveToStell;
02211     double  StellOffsetRatio;
02212     DocCoord    UTCentrePoint;
02213     DocCoord    UTMajorAxes;
02214     DocCoord    UTMinorAxes;
02215 
02216 //Peter was here
02217     INT32 StrokedFlag;
02218     INT32 FilledFlag;
02219 
02220     // Try to get all the parameters off the EPS stack.
02221     if (!Stack.Pop(&StrokedFlag) ||
02222         !Stack.Pop(&FilledFlag) ||
02223         !Stack.PopCoordPair(&UTMinorAxes) ||
02224         !Stack.PopCoordPair(&UTMajorAxes) ||
02225         !Stack.PopCoordPair(&UTCentrePoint) ||
02226         !Stack.Pop(&StellOffsetRatio) ||
02227         !Stack.Pop(&StellCurveToStell) ||
02228         !Stack.Pop(&PrimaryCurveToPrimary) ||
02229         !Stack.Pop(&StellRadiusToPrimary) ||
02230         !Stack.Pop(&StellationCurvature) ||
02231         !Stack.Pop(&PrimaryCurvature) ||
02232         !Stack.Pop(&Stellated) ||
02233         !Stack.Pop(&Circular) ||
02234         !Stack.Pop(&NumSides))
02235     {
02236         HandleEPSError();
02237         return FALSE;
02238     }
02239     else
02240     {
02241         RegularShapeIsStroked = StrokedFlag;
02242         RegularShapeIsFilled = FilledFlag;
02243     }
02244 
02245     // Now set the flag specifying whether the path is filled
02246     SetPathFilled(RegularShapeIsFilled);
02247 
02248     // Set up the shape
02249     pRegularShape->SetNumSides(NumSides);
02250     pRegularShape->SetCircular(Circular);
02251     pRegularShape->SetStellated(Stellated);
02252     pRegularShape->SetPrimaryCurvature(PrimaryCurvature);
02253     pRegularShape->SetStellationCurvature(StellationCurvature);
02254     pRegularShape->SetStellRadiusToPrimary(StellRadiusToPrimary);
02255     pRegularShape->SetPrimaryCurveToPrimary(PrimaryCurveToPrimary);
02256     pRegularShape->SetStellCurveToStell(StellCurveToStell);
02257     pRegularShape->SetStellationRatio(StellOffsetRatio);
02258     pRegularShape->SetCentrePoint(UTCentrePoint);
02259     pRegularShape->SetMajorAxes(UTMajorAxes);
02260     pRegularShape->SetMinorAxes(UTMinorAxes);
02261 
02262     // All ok
02263     return TRUE;
02264 }

BOOL CamelotEPSFilter::ProcessToken  )  [protected, virtual]
 

Processes EPS tokens that are not part of the standard Illustrator set, or which need to be handled differently to the standard Illustrator meanings. i.e. this is the function that handles all the Camelot EPS operators.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/02/94
Returns:
TRUE if token understood and processed ok, FALSE if not.

Errors: Syntax error in EPS, Out of memory.

See also:
EPSFilter::ProcessToken

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 665 of file cameleps.cpp.

00666 {
00667     // Variables used to extract operands from the stack
00668     String_64   ColName;
00669     PColourCMYK Col;
00670     TintType    Tint = TINT_NONE;
00671     FIXEDPOINT  TintVal;
00672     DocCoord    StartPoint, 
00673                 EndPoint;
00674     PathFlags   Flags;
00675     INT32       ObjectNesting = 0;
00676 
00677     DocCoord    BmpCoords[4];
00678     INT32           i;
00679 
00680     // Used to keep track of bitmaps loading them in.
00681     static      NodeBitmap *pBitmapObject = NULL;
00682 
00683     // Decode the command, and execute it...
00684     switch (Token)
00685     {
00686         case EPSC_cso:
00687             INT32 ObjectID;
00688             if (!Stack.Pop(&ObjectID))
00689                 goto EPSError;     // pop the ID
00690 
00691             switch (ObjectID)
00692             {
00693                 case EOTAG_FONTFLAGS:
00694                 {
00695                     if (!ProcessFontFlags())
00696                         goto EPSError;
00697                 }
00698                 break;
00699 
00700                 case EOTAG_BITMAPFLAGS:
00701                 {
00702                     if (!ProcessBitmapFlags())
00703                         goto EPSError;
00704                 }
00705                 break;
00706 
00707                 case EOTAG_TEXTWRAPPED:
00708                 {
00709                     if (!FindEndOfTag())
00710                         goto EPSError;
00711                 }
00712                 break;
00713 
00714                 case EOTAG_FONTTYPE:
00715                 {
00716                     if (!ProcessFontType())
00717                         goto EPSError;
00718                 }
00719                 break;
00720 
00721                 case EOTAG_GUIDELAYER:
00722                 case EOTAG_GUIDELINE:
00723                     break;
00724 
00725                 case EOTAG_MOULDTHRESHOLD:
00726                 {
00727                     if (!ProcessMouldThreshold())
00728                         goto EPSError;
00729                 }
00730                 break;
00731 
00732 
00733                 default:
00734                 {
00735                     // Report we're skipping an unknown object
00736                     ERROR1RAW(_R(IDE_UNKNOWN_EPSOBJECT));
00737                     ObjectNesting++;
00738                     do
00739                     {
00740                         if (!GetToken())
00741                             goto EPSError;
00742 
00743                         LexTokenType Type = EPSFile->GetTokenType();
00744                         if ((Type != TOKEN_EOL) && (Type != TOKEN_EOF))
00745                         {
00746                             if (camStrcmp(TokenBuf, _T("cso")) == 0)
00747                             {
00748                                 ObjectNesting++;
00749                             }
00750                             else if (camStrcmp(TokenBuf, _T("ceo")) == 0)
00751                             {
00752                                 ObjectNesting--;
00753                             }                           
00754                         }
00755                     }
00756                     while (ObjectNesting > 0);
00757                 }
00758                 break;
00759             }
00760 
00761             break;
00762 
00763         case EPSC_ceo:
00764             break;
00765 //          goto EPSError;
00766 
00767         // Line/Fill colours
00768         case EPSC_cx:
00769         case EPSC_cX:
00770         case EPSC_ck:
00771         case EPSC_cK:
00772             break;
00773 
00774         // Linear/radial fills
00775         case EPSC_cax:
00776             // Colours are described using a name and tint as well as CMYK.
00777             Tint = TINT_ILLUSTRATOR;
00778         case EPSC_caz:
00779         {
00780             DocColour StartColour, EndColour;
00781             DocCoord StartPoint, EndPoint, EndPoint2;
00782             CamelotEPSFillType FillType;
00783 
00784             // Used for fractal fills
00785             INT32 Seed;
00786             double Graininess, Gravity, Squash;
00787             UINT32 DPI;
00788             INT32 Tileable;
00789 
00790             // Get fill type
00791             if (!Stack.Pop((INT32*) &FillType))
00792                 goto EPSError;
00793 
00794             TRACEUSER( "Will", _T("Importing Fill, Type=%d\n"),FillType);
00795 
00796             if (FillType == CAMEPS_FILL_FRACTAL)
00797             {
00798                 // If it's a fractal fill type, discard the 'sub-type' parameter (should 
00799                 // always be zero currently!)
00800                 INT32 SubType;
00801 
00802                 if (!Stack.Pop(&SubType))
00803                     goto EPSError;
00804 
00805                 // Default to no tiling
00806                 Tileable = FALSE;
00807 
00808                 // Work out the sub-type: either it has no tileable flag, or it does,
00809                 // or it's a type that is not supported.
00810                 if (SubType != 0)
00811                 {
00812                     if (SubType == 1)
00813                     {
00814                         // Get the tileable flag
00815                         if (!Stack.Pop(&Tileable))
00816                             goto EPSError;
00817                     }
00818                     else
00819                     {
00820                         ERROR2RAW("Bad fractal fill sub-type");
00821                         goto EPSError;
00822                     }
00823                 }
00824 
00825                 // Now get the fractal parameters:
00826                 if (!Stack.Pop(&DPI) ||
00827                     !Stack.Pop(&Squash) ||
00828                     !Stack.Pop(&Gravity) ||
00829                     !Stack.Pop(&Graininess) ||
00830                     !Stack.Pop(&Seed))
00831                 {
00832                     // Error in fractal parameteres
00833                     goto EPSError;
00834                 }
00835             }
00836 
00837             // For elliptical & bitmap fills, get the second end-point of the fill
00838             if ((FillType == CAMEPS_FILL_ELLIPTICAL) ||
00839                 (FillType == CAMEPS_FILL_BITMAP) ||
00840                 (FillType == CAMEPS_FILL_FRACTAL) ||
00841                 (FillType == CAMEPS_FILL_NEWBITMAP) ||
00842                 (FillType == CAMEPS_FILL_NEWLINEAR))
00843             {
00844                 if (!Stack.PopCoordPair(&EndPoint2))
00845                     goto EPSError;
00846             }
00847             
00848             // Get start and end positions for grad-fills
00849             if (!Stack.PopCoordPair(&EndPoint) || !Stack.PopCoordPair(&StartPoint))
00850                 goto EPSError;
00851 
00852             // Get start and end colours for grad-fills (but not bitmap fills)
00853             if (FillType != CAMEPS_FILL_BITMAP)
00854             {
00855                 if (!Stack.PopColour(&Col, Tint, &TintVal, &ColName))
00856                     // Invalid colour operands
00857                     goto EPSError;
00858 
00859                 GetEPSColour(&EndColour, &Col, Tint, TintVal, &ColName);
00860 
00861                 if (!Stack.PopColour(&Col, Tint, &TintVal, &ColName))
00862                     // Invalid colour operands
00863                     goto EPSError;
00864 
00865                 GetEPSColour(&StartColour, &Col, Tint, TintVal, &ColName);
00866             }
00867                 
00868             switch (FillType)
00869             {
00870                 // Decode Camelot EPS grad fill codes
00871                 case CAMEPS_FILL_LINEAR:
00872                     if (!SetLinearFill(StartColour, EndColour, StartPoint, EndPoint))
00873                         goto NoMemory;
00874                     break;
00875 
00876                 case CAMEPS_FILL_NEWLINEAR:
00877                     if (!SetLinearFill(StartColour, EndColour, StartPoint, EndPoint, &EndPoint2))
00878                         goto NoMemory;
00879                     break;
00880 
00881                 case CAMEPS_FILL_ELLIPTICAL:
00882                     if (!SetRadialFill(StartColour, EndColour, StartPoint, EndPoint, EndPoint2))
00883                         goto NoMemory;
00884                     break;
00885 
00886                 case CAMEPS_FILL_CIRCULAR:
00887                     if (!SetRadialFill(StartColour, EndColour, StartPoint, EndPoint))
00888                         goto NoMemory;
00889                     break;
00890 
00891                 case CAMEPS_FILL_CONICAL:
00892                     if (!SetConicalFill(StartColour, EndColour, StartPoint, EndPoint))
00893                         goto NoMemory;
00894                     break;
00895 
00896                 case CAMEPS_FILL_BITMAP:
00897                     
00898                     // Is it really a bitmap fill ?
00899                     // It may be a new type bitmap object
00900                     if (m_PendingBitmap != PENDING_BITMAP_OBJECT_FILL)
00901                         m_PendingBitmap = PENDING_BITMAP_FILL;
00902 
00903                     BitmapAttrs.Coords[0] = StartPoint;
00904                     BitmapAttrs.Coords[1] = EndPoint;
00905                     BitmapAttrs.Coords[2] = EndPoint2;
00906 
00907                     BitmapAttrs.StartCol    = COLOUR_NONE;
00908                     BitmapAttrs.EndCol      = COLOUR_NONE;
00909                     break;
00910 
00911                 case CAMEPS_FILL_NEWBITMAP:
00912                     m_PendingBitmap = PENDING_BITMAP_FILL;
00913                     BitmapAttrs.Coords[0] = StartPoint;
00914                     BitmapAttrs.Coords[1] = EndPoint;
00915                     BitmapAttrs.Coords[2] = EndPoint2;
00916 
00917                     BitmapAttrs.StartCol    = StartColour;
00918                     BitmapAttrs.EndCol      = EndColour;
00919                     break;
00920 
00921                 case CAMEPS_FILL_FRACTAL:
00922                     if (!SetFractalFill(StartColour, EndColour, 
00923                                         StartPoint, EndPoint, EndPoint2,
00924                                         Seed, Graininess, Gravity, Squash, DPI, Tileable))
00925                         goto NoMemory;
00926                     break;
00927 
00928                 default:
00929                     ENSURE(FALSE, "Unknown fill type found!");
00930                     break;  // Don't know this fill type
00931             }
00932 
00933             break;
00934         }
00935 
00936 
00937         case EPSC_cxe:
00938         {
00939             INT32 EffectType;
00940 
00941             // Get fill effect type
00942             if (!Stack.Pop(&EffectType))
00943                 goto EPSError;
00944 
00945             // Call base class to use it
00946             switch (EffectType)
00947             {
00948                 case FILLEFFECT_FADE:
00949                     if (!SetFadeFillEffect())
00950                         goto NoMemory;
00951                     break;
00952 
00953                 case FILLEFFECT_RAINBOW:
00954                     if (!SetRainbowFillEffect())
00955                         goto NoMemory;
00956                     break;
00957 
00958                 case FILLEFFECT_ALTRAINBOW:
00959                     if (!SetAltRainbowFillEffect())
00960                         goto NoMemory;
00961                     break;
00962 
00963                 default:
00964                     ERROR3_PF(("Unknown fill effect type (%d) in EPS", EffectType));
00965             }
00966             break;
00967         }
00968 
00969         case EPSC_cxm:
00970         {
00971             INT32 MappingType;
00972             INT32 Repeat;
00973 
00974             // Get fill mapping type (should always be 0)
00975             if (!Stack.Pop(&MappingType))
00976                 goto EPSError;
00977 
00978             if (MappingType != 0)
00979             {
00980                 ERROR2RAW("Bad mapping type in EPS");
00981                 goto EPSError;
00982             }
00983 
00984             // Get proper fill mapping type (should be 1, 2 or 3)
00985             if (!Stack.Pop(&Repeat))
00986                 goto EPSError;
00987 
00988             if ((Repeat < 1) || (Repeat > 3))
00989             {
00990                 ERROR2RAW("Bad mapping type in EPS");
00991                 goto EPSError;
00992             }
00993 
00994             // Call base class to use it
00995             if (Token == EPSC_cxm)
00996             {
00997                 if (!SetLinearFillMapping(Repeat))
00998                     goto NoMemory;
00999             }
01000             else
01001             {
01002                 if (!SetLinearTranspFillMapping(Repeat))
01003                     goto NoMemory;
01004             }
01005 
01006             break;
01007         }
01008 
01009         case EPSC_csbm:
01010             // Try to read in a bitmap
01011             if (!ReadBitmap())
01012                 return FALSE;
01013             break;
01014 
01015         case EPSC_cebm:
01016             // Should have just finished reading a bitmap...what should we use for?
01017             switch (m_PendingBitmap)
01018             {
01019                 case PENDING_BITMAP_FILL:
01020                     // Use the bitmap to do a bitmap fill
01021 
01022                     if (!SetBitmapFill(pBitmap, 
01023                                        BitmapAttrs.Coords[0], 
01024                                        BitmapAttrs.Coords[1], 
01025                                        BitmapAttrs.Coords[2],
01026                                        &BitmapAttrs.StartCol,
01027                                        &BitmapAttrs.EndCol))
01028                         return FALSE;
01029 
01030                     // NULL the colours, so we don't get 'Index Colour in Use'
01031                     BitmapAttrs.StartCol    = COLOUR_NONE;
01032                     BitmapAttrs.EndCol      = COLOUR_NONE;
01033 
01034                     // Get rid of our KernelBitmap object (the bitmap itself is now
01035                     // attached to the current fill geometry attribute.
01036                     pBitmap = NULL;
01037                     break;
01038 
01039                 case PENDING_BITMAP_TRANSPFILL:
01040                     // Use the bitmap to do a transparent bitmap fill (texture)
01041 
01042                     if (!SetBitmapTranspFill(BitmapAttrs.TranspType, pBitmap, 
01043                                              BitmapAttrs.Coords[0], 
01044                                              BitmapAttrs.Coords[1], 
01045                                              BitmapAttrs.Coords[2],
01046                                              BitmapAttrs.Transp,
01047                                              BitmapAttrs.EndTransp))
01048                         return FALSE;
01049 
01050                     // Get rid of our KernelBitmap object (the bitmap itself is now
01051                     // attached to the current transparent fill geometry attribute.
01052                     pBitmap = NULL;
01053                     break;
01054 
01055                 case PENDING_BITMAP_OBJECT_FILL:
01056 
01057                     // This is the new format used to save 'Non-contoned' bitmaps,
01058                     // where it is saved as a bitmap filled path, so the Viewer
01059                     // can render it, and an extra token that tells this code that
01060                     // it's really a bitmap object.
01061 
01062                     // Bitmap object - make one ready to put into the tree.
01063                     pBitmapObject = new NodeBitmap;
01064                     if ((pBitmapObject == NULL) || (!pBitmapObject->SetUpPath(12,12)))
01065                         goto EPSError;
01066 
01067                     // Now we need to Skip over the path that is output for the
01068                     // Viewer to render ...
01069                     while (!EPSFile->eof())
01070                     {
01071                         GetToken();
01072 
01073                         // We'll remember the coords and use them to build the bitmap
01074                         switch (Token)
01075                         {
01076                             case EPSC_Integer:
01077                                 Stack.Push(TokenData.Long);
01078                                 break;
01079 
01080                             case EPSC_Double:
01081                                 Stack.Push(TokenData.Double);
01082                                 break;
01083 
01084                             case EPSC_FixedPoint:
01085                                 Stack.Push(TokenData.FixedPoint);
01086                                 break;
01087                         }   
01088 
01089                         // Look for the 'Filled Path' token...
01090                         if (Token == EPSC_F)
01091                             break;
01092                     }
01093 
01094                     Stack.Discard(2);   // Throw away the first coord pair
01095 
01096                     // Now read in reverse order because they're stacked
01097                     for (i = 3; i >= 0; i--)
01098                     {
01099                         if (!Stack.PopCoordPair(&BmpCoords[i]))
01100                             goto EPSError;
01101                         pBitmapObject->Parallel[i] = BmpCoords[i];
01102                     }
01103 
01104                     // Put them into the path.
01105                     pBitmapObject->InkPath.InsertMoveTo(BmpCoords[0]);
01106 
01107                     for (i = 1; i <= 3; i++)
01108                         pBitmapObject->InkPath.InsertLineTo(BmpCoords[i]);
01109 
01110                     pBitmapObject->InkPath.InsertLineTo(BmpCoords[0]);
01111                     pBitmapObject->InkPath.CloseSubPath();
01112 
01113                     // Make sure the bitmap has no fill colour applied
01114                     SetPathFilled(FALSE);
01115                     
01116                     // Now fall though to the Bitmap Object code .....
01117 
01118                 case PENDING_BITMAP_OBJECT:
01119                 {
01120                     // Use the bitmap to do a bitmap object
01121 
01122                     // Copy the bitmap into this node and delete the one we've just imported.
01123                     if (pBitmapObject == NULL)
01124                         // No bitmap node to load!
01125                         goto EPSError;
01126 
01127                     pBitmapObject->GetBitmapRef()->Attach(pBitmap, GetDocument());
01128                     if (pBitmapObject->GetBitmap() != pBitmap)
01129                     {
01130                         // It didn't use the bitmap we gave it, so we can delete it
01131                         delete pBitmap;
01132                     }
01133 
01134                     pBitmap = NULL;
01135 
01136                     AttributeValue* pOldLineColour = NULL;
01137                     AttributeValue* pOldLineWidth = NULL;
01138 
01139                     if (m_PendingBitmap == PENDING_BITMAP_OBJECT_FILL)
01140                     {
01141                         // This must be a non-contone bitmap, so make sure we
01142                         // don't apply any line colour.
01143 
01144                         // (The fill colour will already have been turned off
01145                         //  with a 'SetPathFilled(FALSE)' above)
01146                     
01147                         pOldLineColour = CurrentAttrs[ATTR_STROKECOLOUR].pAttr;
01148                         
01149                         // Force Line Colour be NONE.
01150                         StrokeColourAttribute* pLineCol = new StrokeColourAttribute;
01151                         if (pLineCol == NULL)
01152                             goto NoMemory;
01153 
01154                         DocColour   colorNone( COLOUR_NONE );
01155                         pLineCol->SetStartColour( &colorNone );
01156                             
01157                         CurrentAttrs[ATTR_STROKECOLOUR].pAttr = pLineCol;
01158                     }
01159 
01160                     pOldLineWidth = CurrentAttrs[ATTR_LINEWIDTH].pAttr;
01161                     
01162                     // Force the line width to be zero for Bitmap objects
01163                     LineWidthAttribute* pLineWidth = new LineWidthAttribute;
01164                     if (pLineWidth == NULL)
01165                         goto NoMemory;
01166 
01167                     pLineWidth->LineWidth = 0;
01168                         
01169                     CurrentAttrs[ATTR_LINEWIDTH].pAttr = pLineWidth;
01170 
01171                     // Add attributes to the path, if they are different from the default...
01172                     BOOL Success = AttributeManager::ApplyBasedOnDefaults(pBitmapObject, 
01173                                                                           CurrentAttrs);
01174 
01175                     // Did it work?
01176                     if (!Success)
01177                     {
01178                         // No clean up and report error
01179                         delete pBitmapObject;
01180                         pBitmapObject = NULL;
01181                         goto NoMemory;
01182                     }
01183 
01184                     // Finally, add it into the tree
01185                     pBitmapObject->InvalidateBoundingRect();
01186                     AddNewNode(pBitmapObject);
01187 
01188                     // Switch path filling back on again
01189                     SetPathFilled(TRUE);
01190 
01191                     if (pOldLineColour != NULL)
01192                     {
01193                         delete CurrentAttrs[ATTR_STROKECOLOUR].pAttr;
01194 
01195                         // Restore the old line colour attribute
01196                         CurrentAttrs[ATTR_STROKECOLOUR].pAttr = pOldLineColour;
01197                     }
01198 
01199                     if (pOldLineWidth != NULL)
01200                     {
01201                         delete CurrentAttrs[ATTR_LINEWIDTH].pAttr;
01202 
01203                         // Restore the old line width attribute
01204                         CurrentAttrs[ATTR_LINEWIDTH].pAttr = pOldLineWidth;
01205                     }
01206 
01207                     // Get rid of our KernelBitmap object (the bitmap itself is now
01208                     // attached to the current fill geometry attribute.
01209                     pBitmap = NULL;
01210                     pBitmapObject = NULL;
01211                     break;
01212                 }
01213 
01214                 case PENDING_BITMAP_POOLITEM:
01215                 {
01216                     // Attach the Bitmap to a reference so that it is kept around for things to use
01217                     TRACEUSER( "Rik", _T("What do you know, its a Pool Item\n"));
01218                     BitmapPoolAttach(pBitmap);
01219                     pBitmap = NULL;
01220                     break;
01221                 }
01222 
01223                 default:
01224                     ENSURE(FALSE, "Found a bitmap but don't know what to do with it!");
01225                     delete pBitmap;
01226                     pBitmap = NULL;
01227                     goto EPSError;
01228                     break;
01229             }
01230 
01231             m_PendingBitmap = PENDING_BITMAP_NONE;
01232             BitmapTransparencyIndex = -1;
01233             break;
01234 
01235         case EPSC_cbm:
01236         {
01237             // Bitmap object - make one ready to put into the tree.
01238             pBitmapObject = new NodeBitmap;
01239             if ((pBitmapObject == NULL) || (!pBitmapObject->SetUpPath(12,12)))
01240                 return FALSE;
01241 
01242             // First, try to read in the coordinates of the bitmap object
01243             DocCoord Coords[4];
01244 
01245             // NB. reverse order because they're stacked, remember!
01246             INT32 i;
01247             for ( i = 3; i >= 0; i--)
01248             {
01249                 if (!Stack.PopCoordPair(&Coords[i]))
01250                     goto EPSError;
01251                 pBitmapObject->Parallel[i] = Coords[i];
01252             }
01253 
01254             // Put them into the path.
01255             pBitmapObject->InkPath.InsertMoveTo(Coords[0]);
01256 
01257             for (i = 1; i <= 3; i++)
01258                 pBitmapObject->InkPath.InsertLineTo(Coords[i]);
01259 
01260             pBitmapObject->InkPath.InsertLineTo(Coords[0]);
01261             pBitmapObject->InkPath.CloseSubPath();
01262 
01263 //          pBitmapObject->InkPath.UpdateBoundingRect();
01264 
01265             // Flag to the code above that the next bitmap should be added to this object.
01266             m_PendingBitmap = PENDING_BITMAP_OBJECT;
01267 
01268             break;
01269         }
01270 
01271         case EPSC_cbmp:
01272             // A bitmap palette - should not ever get this in ART files.
01273             goto EPSError;
01274 
01275         // Blend related procedures
01276         case EPSC_csbd:
01277             return ProcessBlend();
01278             
01279         case EPSC_cebd:
01280             goto EPSError;
01281             
01282         case EPSC_csbr:
01283             return ProcessBlender();
01284             
01285         case EPSC_cebr:
01286             goto EPSError;
01287 
01288         // Regular shape related procedures         
01289         case EPSC_csrs:
01290             return ProcessRegularShape();
01291 
01292         case EPSC_cers:
01293             goto EPSError;
01294 
01295         case EPSC_crsp:
01296             return ProcessRegularShapeParams();
01297 
01298         case EPSC_crstm:
01299             {
01300                 if (pRegularShape == NULL)
01301                     goto EPSError;
01302 
01303                 // Get the shape's matrix from the stack and put it into the shape.
01304                 Matrix TheMatrix;
01305                 if (!Stack.Pop(&TheMatrix, FALSE))
01306                     goto EPSError;
01307 
01308                 pRegularShape->SetTransformMatrix(&TheMatrix);
01309                 break;
01310             }
01311 
01312         case EPSC_crsp1:
01313             {
01314                 if ((pRegularShape == NULL) || (pInkPath == NULL))
01315                     goto EPSError;
01316 
01317                 // Path is held in pInkPath - copy into shape and clear the pInkPath ready for
01318                 // the second edge's path.
01319                 pRegularShape->EdgePath1.ClearPath();
01320                 if (!pRegularShape->EdgePath1.CopyPathDataFrom(pInkPath))
01321                     goto NoMemory;
01322 
01323                 pInkPath->ClearPath();
01324                 break;
01325             }
01326 
01327         case EPSC_crsp2:
01328             {
01329                 if ((pRegularShape == NULL) || (pInkPath == NULL))
01330                     goto EPSError;
01331 
01332                 // Path is held in pInkPath - copy into shape's second edge path and delete the
01333                 // temporary path.
01334                 pRegularShape->EdgePath2.ClearPath();
01335                 if (!pRegularShape->EdgePath2.CopyPathDataFrom(pInkPath))
01336                     goto NoMemory;
01337 
01338                 // No more paths to read in.
01339                 delete pInkPath;
01340                 pInkPath = NULL;
01341                 break;
01342             }
01343 
01344         // Mould commands
01345         case EPSC_csev:
01346             return ProcessEnvelope();
01347 
01348         case EPSC_cspr:
01349             return ProcessPerspective();
01350 
01351         // Guide layers & guidelines
01352         case EPSC_glyr:
01353             return ProcessGuideLayer();
01354 
01355         case EPSC_glne:
01356             return ProcessGuideline();
01357 
01358         case EPSC_cag:
01359             // A separated grey fill - should not ever get this in ART files.
01360             goto EPSError;
01361         
01362         default:
01363             // Token not understood - pass on to base class
01364             return ArtWorksEPSFilter::ProcessToken();
01365     }
01366 
01367 
01368     // No errors encountered while parsing this token and its operands.
01369     return TRUE;
01370     
01371     
01372     // Error handlers:
01373     
01374 EPSError:
01375     HandleEPSError();
01376     return FALSE;
01377 
01378 NoMemory:
01379     HandleNoMemory();
01380     return FALSE;
01381 }

BOOL CamelotEPSFilter::ReadBitmap  )  [protected, virtual]
 

Reads the bitmap info from the eps stack and loads in the bitmap data It loads a type 0 bitmap.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com> (Will)
Date:
25/1/95
Returns:
TRUE if it worked, FALSE if it failed
See also:
CamelotNativeEPSFilter::ReadBitmap

Reimplemented in CamelotNativeEPSFilter.

Definition at line 1432 of file cameleps.cpp.

01433 {
01434     // Find out what kind of bitmap it is - always type 0 at present in CamelotEPS (CamelotNative has a type 1 as well).
01435     INT32 BitmapType;
01436     if (!Stack.Pop(&BitmapType) || (BitmapType != 0))
01437     {
01438         // Error - not enough operands, or bitmap is wrong type
01439         ENSURE(BitmapType == 0, "Unknown bitmap type in EPS!");
01440         HandleEPSError();
01441         return FALSE;
01442     }
01443     
01444     // Read in info on the bitmap
01445     // Recommended size is stored as a user space value, i.e. in points, so we
01446     // use PopCoord() to get the automatic scaling to millipoints.
01447     BitmapInfo Info;
01448     String_256 BitmapName;
01449     if (!Stack.PopCoord(&Info.RecommendedHeight) || !Stack.PopCoord(&Info.RecommendedWidth) ||
01450         !Stack.Pop(&Info.NumPaletteEntries)      || !Stack.Pop(&Info.PixelDepth)            ||
01451         !Stack.Pop(&Info.PixelHeight)            || !Stack.Pop(&Info.PixelWidth)            ||
01452         !Stack.Pop(&BitmapName))
01453     {
01454         // Error - not enough operands
01455         HandleEPSError();
01456         return FALSE;
01457     }
01458 
01459     BOOL IsNew;
01460     BOOL ImportOk = KernelBitmap::ImportBitmap(this, &Info, BitmapType,
01461                                                 &pBitmap, &IsNew);
01462     if (ImportOk && IsNew)
01463     {
01464         // Set the name in it
01465         pBitmap->ActualBitmap->SetName(BitmapName);
01466 
01467         // Set the TransparencyIndex
01468         if (BitmapTransparencyIndex >= 0)
01469         {
01470             TRACEUSER( "Will", _T("Imported bitmap with Transparent Index %d\n"), BitmapTransparencyIndex);
01471         }
01472 
01473         pBitmap->SetTransparencyIndex(BitmapTransparencyIndex);
01474     }
01475 
01476     return ImportOk;
01477 }

BOOL CamelotEPSFilter::ReadSimplePath Path TempPath  )  [protected]
 

Reads in the defined mould path shape.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the path shape has been read FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 2850 of file cameleps.cpp.

02851 {
02852     DocCoord Ta,Tb,Tc;
02853     PathFlags flags;
02854     flags.IsSelected = FALSE;
02855     BOOL ok, done = FALSE;
02856 
02857     // ok, pop off the move stacked coordinate
02858     if (!Stack.PopCoordPair(&Ta))
02859         return FALSE;
02860 
02861     // Make sure there's absolutely no elements in this path
02862     TempPath->ClearPath(FALSE);
02863 
02864     // Add this first element as a move to
02865     if (!TempPath->AddMoveTo(Ta, &flags))
02866         return FALSE;
02867 
02868     // Keep processing tokens until we find the end of the mould path
02869     while (!done && (!EPSFile->eof()))
02870     {
02871         GetToken();
02872 
02873         switch (Token)
02874         {
02875             case EPSC_l:
02876                 // lineto (x,y) found
02877                         ok = Stack.PopCoordPair(&Ta);
02878                 if (ok) ok = TempPath->AddLineTo(Ta, &flags);
02879                 break;
02880                                                 
02881             case EPSC_c:
02882                 // curveto (x0,y0,x1,y1,x2,y2) found
02883                         ok = Stack.PopCoordPair(&Tc);
02884                 if (ok) ok = Stack.PopCoordPair(&Tb);
02885                 if (ok) ok = Stack.PopCoordPair(&Ta);
02886                 if (ok) ok = TempPath->AddCurveTo(Ta,Tb,Tc,&flags);
02887                 break;
02888 
02889             case EPSC_s: case EPSC_f: case EPSC_b: case EPSC_h: case EPSC_n:
02890             case EPSC_S: case EPSC_F: case EPSC_B: case EPSC_H: case EPSC_N:
02891                 // found a stroked close path. That should be it for path elements
02892                 ok = TempPath->CloseSubPath();
02893                 done = TRUE;
02894                 break;
02895 
02896             default:
02897                 // try to handle whatever token this is.
02898                 ok = HandleToken();
02899                 break;
02900         }
02901 
02902         // if someones failed return.
02903         if (!ok) return FALSE;
02904     }
02905 
02906     // All is well
02907     return TRUE;
02908 }

BOOL CamelotEPSFilter::RemoveUnwantedAttributes NodeMould pNodeMould  )  [protected]
 

Removes unwanted attributes added as first children of the node mould. It does this by scanning the children of the nodemouldgroup and determining what attributes are applied here.

BOOL CamelotEPSFilter::RemoveUnwantedAttributes(NodeMould* pNodeMould)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/10/95
Parameters:
pNodeMould = a pointer to a node mould object [INPUTS]
Returns:
TRUE if all unwanted attributes were removed ok. FALSE if none have been removed

Definition at line 2458 of file cameleps.cpp.

02459 {
02460     /* Ok, at this stage, we have a list of attributes applied to the
02461        first level of the node mould. All these atts have been applied to
02462        avoid them being applied to the mould source objects which would
02463        then be moulded (not what we want). Unfortunately we now need to check
02464        all attributes applied to the source objects. This is unfortunately
02465        a side effect of the method we are using. If we find that there
02466        are attributes applied in the source object tree which have been
02467        applied to the root, then we delete those at the root. Groan!
02468     */
02469 
02470     // grab the node mould group.
02471     NodeMouldGroup* pNdMldGrp = (NodeMouldGroup*)pNodeMould->FindFirstChild(CC_RUNTIME_CLASS(NodeMouldGroup));
02472     if (pNdMldGrp==NULL)
02473         return FALSE;
02474 
02475     // ok, build a list of attribute pointers.
02476     CCAttrMap AttrMap(30);
02477     CCRuntimeClass* pTypeInfo;
02478     void* pDummy;
02479 
02480     BuildSubtreeAttrMap(&AttrMap, pNdMldGrp);
02481     
02482     Node *qNode, *pNode = pNodeMould->FindFirstChild();
02483     while (pNode)
02484     {
02485         qNode = pNode->FindNext();
02486         if (pNode->IsAnAttribute())
02487         {
02488             NodeAttribute* pAttrib = (NodeAttribute*)pNode;
02489             pTypeInfo = pAttrib->GetAttributeType();
02490             if (AttrMap.Lookup(pTypeInfo, pDummy))
02491             {
02492                 pNode->UnlinkNodeFromTree();
02493                 delete pNode;
02494             }
02495         }
02496         pNode = qNode;
02497     }
02498 
02499     return TRUE;
02500 }

BOOL CamelotEPSFilter::StartBlend  )  [protected]
 

Used when a blend structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new blend, until EndBlend is called.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the new blend was created ok; FALSE if not.

Errors: Out of memory

See also:
CamelotEPSFilter::EndBlend

Reimplemented from ArtWorksEPSFilter.

Definition at line 1848 of file cameleps.cpp.

01849 {
01850     INT32 NumBlendSteps,Version,OneToOne,NotAntialiased,ColBlendType;
01851     INT32 Reserved3,Reserved2,Reserved1;
01852     
01853     // The last param before the token is the version.
01854     if (!Stack.Pop(&Version))
01855         return FALSE;
01856 
01857     // Error if the version number is not correct
01858     ERROR1IF(Version != 1,FALSE,_R(IDT_EPS_BADSYNTAX));
01859 
01860     // Read in the blend's params
01861     if (!Stack.Pop(&NumBlendSteps)  ||
01862         !Stack.Pop(&NotAntialiased) ||
01863         !Stack.Pop(&OneToOne)       ||
01864         !Stack.Pop(&ColBlendType)   ||
01865         !Stack.Pop(&Reserved3)      ||
01866         !Stack.Pop(&Reserved2)      ||
01867         !Stack.Pop(&Reserved1))
01868     {
01869         return FALSE;
01870     }
01871 
01872     // Make a new blend node for this blend
01873     NodeBlend *pNodeBlend = new NodeBlend;
01874     ERROR1IF(pNodeBlend == NULL, FALSE, _R(IDT_EPS_NOMEMORY));
01875 
01876     // Add it into the tree
01877     if (!AddNewNode(pNodeBlend))
01878         return FALSE;
01879 
01880     // Set the blend's params
01881     pNodeBlend->SetOneToOne(OneToOne);
01882     pNodeBlend->SetNotAntialiased(NotAntialiased);
01883     pNodeBlend->SetNumBlendSteps(NumBlendSteps);
01884     pNodeBlend->SetColourBlendType((ColourBlendType)ColBlendType);
01885 
01886     // Make sure new objects are added as children of the node
01887     pNode = pNodeBlend;
01888 
01889     // All ok
01890     return TRUE;
01891 }

BOOL CamelotEPSFilter::StartBlender  )  [protected]
 

Used when a blender structure needs to be created - after this is called, all paths will be discarded, until EndBlender is called.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the new blender was created ok; FALSE if not.

Errors: Out of memory

See also:
CamelotEPSFilter::EndBlender

Reimplemented from ArtWorksEPSFilter.

Definition at line 2023 of file cameleps.cpp.

02024 {
02025     INT32 ObjIndexStart,ObjIndexEnd,PathIndexStart,PathIndexEnd;
02026     INT32 Reserved1,Reserved2,Reserved3,Reserved4;
02027     
02028     // Read the blender's params
02029     if (!Stack.Pop(&PathIndexEnd)   ||
02030         !Stack.Pop(&PathIndexStart) ||
02031         !Stack.Pop(&ObjIndexEnd)    ||
02032         !Stack.Pop(&ObjIndexStart)  ||
02033         !Stack.Pop(&Reserved4)      ||
02034         !Stack.Pop(&Reserved3)      ||
02035         !Stack.Pop(&Reserved2)      ||
02036         !Stack.Pop(&Reserved1))
02037     {
02038         return FALSE;
02039     }
02040 
02041     // Make a new blender node for this blender
02042     NodeBlender *pNodeBlender = new NodeBlender;
02043     ERRORIF(pNodeBlender == NULL, _R(IDT_EPS_NOMEMORY), FALSE);
02044 
02045     // Add it into the tree
02046     if (!AddNewNode(pNodeBlender))
02047         return FALSE;
02048 
02049     // Set the blender params
02050     pNodeBlender->SetObjIndexStart(ObjIndexStart);
02051     pNodeBlender->SetObjIndexEnd  (ObjIndexEnd);
02052     pNodeBlender->SetPathIndexStart(PathIndexStart);
02053     pNodeBlender->SetPathIndexEnd  (PathIndexEnd);
02054     
02055     // Discard all subsequent paths - until we get an "end blender" token
02056     ThePathType = PATH_DISCARD_STICKY;
02057 
02058     // All ok
02059     return TRUE;
02060 }

BOOL CamelotEPSFilter::StartMould MouldSpace  mSpace  )  [protected]
 

Used when an mould structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new mould, until EndMould is called.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
mSpace = Mould geometry to define, either envelope or perspective [INPUTS]
Returns:
TRUE if the new mould object was created ok; FALSE if not.

Errors: Out of memory

See also:
CamelotEPSFilter::EndMould

Reimplemented from ArtWorksEPSFilter.

Definition at line 2354 of file cameleps.cpp.

02355 {
02356     // Read in the version number of this camelot mould
02357     INT32 version;
02358     if (!Stack.Pop(&version))
02359         return FALSE;
02360 
02361     // if the version number's not one we recognise then return an error
02362     if (version!=100)
02363         return FALSE;   
02364 
02365     // create a mould parent and insert it in the tree
02366     NodeMould* pMouldParent = new NodeMould;
02367     ERROR1IF(pMouldParent == NULL, FALSE, _R(IDT_EPS_NOMEMORY));
02368 
02369     // give the parent mould object a shape and mould space to work with and stick it in the tree
02370     if (!pMouldParent->CreateGeometry(mSpace))
02371     {
02372         delete pMouldParent;
02373         return FALSE;
02374     }
02375 
02376     if (!AddNewNode(pMouldParent))
02377     {
02378         HandleNoMemory();
02379         return FALSE;
02380     }
02381 
02382     // Make sure new objects are added as children of the mould
02383     pNode = pMouldParent;
02384 
02385     // Make sure the default mould threshold is set correctly
02386     EPSFilter::NewMouldThreshold = MOULD_V1THRESHOLD;
02387 
02388     // All ok
02389     return TRUE;
02390 }


Member Data Documentation

struct CamelotEPSFilter::_BitmapAttrs CamelotEPSFilter::BitmapAttrs [protected]
 

INT32 CamelotEPSFilter::BitmapTransparencyIndex [protected]
 

Definition at line 287 of file cameleps.h.

CommandMap CamelotEPSFilter::CamelotCommands [static, protected]
 

Definition at line 346 of file cameleps.h.

PendingBitmap CamelotEPSFilter::m_PendingBitmap [protected]
 

Definition at line 286 of file cameleps.h.

KernelBitmap* CamelotEPSFilter::pBitmap [protected]
 

Definition at line 290 of file cameleps.h.

NodeRegularShape* CamelotEPSFilter::pRegularShape [protected]
 

Definition at line 292 of file cameleps.h.

BOOL CamelotEPSFilter::RegularShapeIsFilled [protected]
 

Definition at line 293 of file cameleps.h.

BOOL CamelotEPSFilter::RegularShapeIsStroked [protected]
 

Definition at line 294 of file cameleps.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:45 2007 for Camelot by  doxygen 1.4.4