home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Interface.c
-
- Contains: QuickDraw GX to PostScript conversion code.
- File contains interface routines for the PostScript Imaging Engine.
-
- Version: Technology: Quickdraw GX 1.1.x
-
- Copyright: © 1991-1997 by Apple Computer, Inc., all rights reserved.
- */
-
- #include <MacMemory.h>
- #include <Resources.h>
- #include <GXGraphics.h>
- #include "GXToPSBuildConfig.h"
- #include "GXToPostScript.h"
- #include "IOUtilities.h"
- #include "RDUtil.h"
- #include "FontHandler.h"
- #include "PublicPostScriptIE.h"
- #include "private.h"
- #include "PSIEResources.h"
- #include "GXErrors.h"
-
- #ifdef resumeLabel
- #undef resumeLabel
- #endif
- #define resumeLabel(exception)
-
- /************************************
-
- Function PSIENewInk:
- Called to create an ink for our base graphics
- state. We do this because we want a zero
- length profile to avoid the initial creation
- of the state to download a calibrated RGB space
- for PostScript.
-
- *************************************/
- gxInk PSIENewInk();
- gxInk PSIENewInk()
- {
- gxInk newInk;
- gxColorProfile aProfile;
- gxColor aColor;
-
- aProfile = GXNewColorProfile(0, nil);
- newInk = GXNewInk();
- GXGetInkColor(newInk, &aColor);
- aColor.profile = aProfile;
- GXSetInkColor(newInk, &aColor);
- GXDisposeColorProfile(aProfile);
-
- return(newInk);
-
- }//PSIENewInk
-
-
-
-
- /************************************
-
- Routine: CreateGrayColorSet
-
- Routine to create a 256 entry colorset for
- a gray ramp. 0 is black,
- 255 is white.
-
-
- *************************************/
- gxColorSet CreateGrayColorSet(void)
- {
- gxColorSet theSet;
- gxSetColor theGrays[256];
- gxSetColor* pColor = theGrays;
- short i;
-
-
- for (i = 0; i < 256; ++i) {
-
- pColor->gray = (gxColorValue)(i << 8) | i; // duplicate the value in both bytes of the short.
- ++pColor;
-
- }//end for
-
- theSet = GXNewColorSet(gxGraySpace, 256, theGrays);
-
- return(theSet);
-
- }//CreateGrayColorSet
-
- //<FF>
- /*******************************
- Routine EnterPostScriptIE:
-
- Routine initializes the PostScript Imaging Engine for the processing
- of a series of shapes. (Usually coming from the Transfer Mode Resolver/
- Picture Walker
-
- context: (returned) A context for the client of the imaging engine.
- params: The client's parameter block to initialize the IE with.
- deviceMapping view device mapping for printer.
- fhContext: A valid font handler context.
- compatFlags: compatability flags.
-
- ********************************/
- // Note, change: DL 7/13/97: Changed imagedata handle to pointer to struct
- OSErr EnterPostScriptIE(TPSIEContext *context, CGXtoPostScriptDevice *psDevice, gxPostScriptImageDataRec *params,
- TFontHandlerContext fhContext, TCompatibilityFlags* compatFlags)
- {
- OSErr status;
- TIEGlobalsPtr pGlobals;
-
- status = PrNewHandleClear((Handle*)context, (sizeof(TIEGlobalsRec) // Room for structure plus
- + sizeof(TGstate) + // room for base graphics state
- params->gsaveLimit * // plus one graphics state and one workspace
- (sizeof(TGstate) + sizeof(Handle))) ); // for each gsave level
- nrequire(status, failed_AllocGlobals);
-
- HLock((Handle)*context);
-
- pGlobals = *(TIEGlobalsHdl)(*context); // Dereference the handle.
-
-
- /******
- The offset to the array of workspace handles
- is the size of the globals record + (gsaveLimit + 1) * sizeof(TGstate)
- because the handles come after the array of graphics states
- and there are gsaveLimit graphics states plus one for the base state
- ******/
-
- pGlobals->offsetToWorkspace =
- sizeof(TIEGlobalsRec) + (params->gsaveLimit + 1) * sizeof(TGstate);
-
- /*******
- Set up grapics state pointers
- base graphics state is gStateArray[0]
- gStateNest[0] is gStateArray[1],
- Thus gStateNest[-1] is the base graphics state.
- This is done so that the gStateNest array
- is in phase (as opposed to one off) with
- the array of transforms that will come into
- PostScriptDrawShape.
- *******/
- pGlobals->baseGstate = &(pGlobals->gStateArray[0]);
- pGlobals->gStateNest = &(pGlobals->gStateArray[1]);
-
-
- /** Initialize the ResDump utility **/
-
- pGlobals->psDevice = psDevice;
-
- nrequire(status = RDInit(pGlobals->psDevice, &pGlobals->rdMap), failed_RDInit); // Allocate a Res Dump Util map.
-
- /** Set up the substitutions for PostScript strings **/
-
- status = RDSetSubstitutions(pGlobals->rdMap, 6,
- '(', "\p\\(", /* ( becomes \( for string quoting */
- ')', "\p\\)", /* ( becomes \( for string quoting */
- '\\', "\p\\\\", /* \ becomes \\ becuase \ is the quote character */
- 13, "\p\\r", /* carriage return becomes \r becuase PS scanner will substitute a raw carriage return for a line feed */
- 10, "\p\\n", /* line feed becomes \n becuase who knows what PS scanner might do */
- 4, "\p\\004" ); /* ctrl-D becomes octal-4 becuase ctrl-d is eof in serial connected PS */
-
- nrequire(status, failed_SetSubs);
-
- // copy in the initialization parameters.
- BlockMoveData(params, &(pGlobals->params), sizeof(gxPostScriptImageDataRec));
-
- // Make sure we are an ownder of the profile in the imagedata
- if (pGlobals->params.devCProfile != nil)
- GXCloneColorProfile(pGlobals->params.devCProfile);
-
- // Compatability flags.
- pGlobals->compatFlags = *compatFlags;
-
- /******
- Validate the rendering options
- ******/
-
- //Set language level to 1 if portable postscript is set
- if (pGlobals->params.renderOptions & gxPortablePostScriptOption)
- pGlobals->params.languageLevel = 1;
-
- //Level2 color on < level2 printer or portable PostScript makes no sense
- if ( (pGlobals->params.languageLevel < 2) || (pGlobals->params.renderOptions & gxPortablePostScriptOption))
- pGlobals->params.renderOptions &= ~gxUseLevel2ColorOption;
-
-
-
- /** Set up the rest of the globals **/
-
- pGlobals->fhContext = fhContext;
-
- pGlobals->workSpaceIndex = 0; // Workspace zero is available.
-
- /** If necessary, create a gray ramp color set for 8-bit PS image operator **/
-
- if (pGlobals->params.devCSpace == gxGraySpace)
- pGlobals->graySet = CreateGrayColorSet();
- else
- pGlobals->graySet = nil;
-
- nrequire(status = GXGetGraphicsError(nil), failed_CreateGrays);
-
- /**
- For Level-2 Color, make a copy of the default profile - this is because we can't clone and dispose of the default
- Also allocate the collection for the CRD database
- **/
-
- if (pGlobals->params.renderOptions & gxUseLevel2ColorOption) {
-
- pGlobals->defaultProfileCopy = GXCopyToColorProfile(nil, GXGetDefaultColorProfile());
- nrequire(status = GXGetGraphicsError(nil), failed_CreateProfile);
-
- } else {
-
- pGlobals->defaultProfileCopy = nil;
-
- }//end if
-
-
-
- /* Ignore these notices, because Imaging Engine is almost guarenteed to cause them */
-
- GXIgnoreGraphicsNotice(mapping_unaffected);
- GXIgnoreGraphicsNotice(graphic_type_cannot_be_mapped);
- GXIgnoreGraphicsNotice(request_exceeds_available_data);
-
- GXIgnoreGraphicsNotice(glyph_tangents_have_no_effect);
- GXIgnoreGraphicsWarning(index_out_of_range);
- GXIgnoreGraphicsWarning(count_out_of_range);
-
- #ifdef IEdoVALIDATION
- GXSetValidation(gxPublicValidation +
- gxAllObjectValidation +
- gxApHeapValidation);
- #endif
-
- #ifdef usePerfLib
- status = InitPerf(&(pGlobals->perfGlobals), 4, 16, true, true, "\ppost", 0, "\p", false, 0, 0, 0);
- if (status)
- PerfControl(pGlobals->perfGlobals, true);
- else
- dprintf(notrace, "Init Performance failed");
- #endif
-
-
- /* successful allocation and initialization, return */
- return(status);
-
- failed_CreateProfile:
- failed_CreateGrays:
- failed_WorkSpace:
-
- failed_SetSubs:
- RDShutdown(pGlobals->rdMap);
-
- failed_RDInit:
- DisposeHandle((Handle)context);
-
- failed_AllocGlobals:
-
- return(status);
-
- }//EnterPostScriptIE
-
-
- //<FF>
- /*************************************
- Routine: PostScriptInitGraphics
- Routine sets up a known initial graphics state.
- This should be called at the start of each logical page (or EPS file)
-
- context: Imaging engine context.
- hParams: Imaging Engine parameters.
- devMapping: view device mapping for page.
- halftoneRecord: halftone record for page.
-
- **************************************/
- OSErr PostScriptInitGraphics(TPSIEContext context, gxPostScriptImageDataRec *imageData, gxMapping *devMapping, gxFormatHalftoneInfo *halftoneRecord)
- {
- OSErr status;
- TGstate *pGstate;
- TIEGlobalsPtr pGlobals;
- TRDParams rdParams; // Pointer to this will be passed down call chain.
- unsigned char stateFlags;
- gxShape defaultShape;
- gxColorProfile oldProfile;
-
- /** Time data throughput **/
- #ifdef TIMEIO
- {
- Handle h;
- long i;
- long *p;
- long time;
- long size = 500000;
-
- status = PrNewHandle(&h, size);
- ncheck(status);
- HLockHi(h);
- p = (long*)*h;
- for (i = 0; i < (size / 4); ++i)
- *p++ = 0x2525250D;
-
- time = TickCount();
- status = Send_GXBufferData(*h, size, gxNoBufferOptions);
- ncheck(status);
- status = Send_GXWriteData("\n", 1);
- ncheck(status);
- time = (TickCount() - time) / 60;
-
- #if DEBUGLEVEL >= DEBUGFEEDBACK
- dprintf(notrace, "bytes per second: %d", size / time);
- #endif
-
- (void)PrDisposeHandle(h);
-
- }
- #endif
-
- /** Lock the context, All the pritnf's can move mem **/
- stateFlags = HGetState((Handle)context);
- HLock((Handle)context);
-
- pGlobals = *(TIEGlobalsHdl)(context); // Dereference the context handle.
-
- pGlobals->deviceMapping = *devMapping;
-
- /*******
- Copy the new image data handle into the globals and deal with the profile ownership
- Warning: Changing languageLevel or some renderoptions or flipping the PortablePostScript
- bit after EnterPostScriptIE can cause PostScript errors. Some proc-sets may not
- have been downloaded. It really only makes sense to change color space and profile
- here.
- ******/
-
- oldProfile = pGlobals->params.devCProfile; // Get the old profile
-
- BlockMoveData(imageData, &(pGlobals->params), sizeof(gxPostScriptImageDataRec));
-
- if (pGlobals->params.devCProfile != nil) // Make sure we own the new one.
- GXCloneColorProfile(pGlobals->params.devCProfile);
-
- if (oldProfile != nil) // Dispose of the old one.
- GXDisposeColorProfile(oldProfile);
-
-
- /** Get ready to image the next page **/
-
- pGlobals->ieStateFlags = eInitializeGstate; // all other bits clear
- pGlobals->gStateDepth = -1; // Index will Point to base graphics state.
- pGlobals->pRDParams = &rdParams; // Point to this one for this call chain.
- pGlobals->theFont = nil; // No font yet.
- pGlobals->fontSize = 0; // thus no font size.
- pGlobals->fontTangent.x = 0; // and no tangent. (A real one couldn't be 0-0)
- pGlobals->fontTangent.y = 0;
- pGlobals->textStyle = nil; // No text face.
- pGlobals->theColorSet = nil; // no bitmap color set yet.
-
- /* set up top of nested graphics state */
-
- defaultShape = GXNewShape(gxRectangleType); // We'll use the characteristics of the default rectangle.
-
- /** Output the initial graphics state **/
-
- rdParams.rdMap = pGlobals->rdMap;
- rdParams.resType = 'STR#';
- rdParams.resID = kScriptResID;
- rdParams.rdFlags = eRDnoOptions;
-
- /*****
- Put md on stack (this way, evil applications use of currentdict to check for
- laserPrep definitions fails since md is empty
- Apps that bother to check for laserprep operators this way won't find them and thus do the 'clean'
- thing. Apps that don't check continue to work the way they always did
- *****/
- rdParams.resIndex = kMDBegin;
- nrequire(status = RDResPrintf(&rdParams), failed_MDBegin);
-
- /** Put Imaging Engine ProcSet dictionary on top of dict stack **/
-
- nrequire(status = BeginProcSetDict(&rdParams), failed_Dict);
-
- #if DEBUGLEVEL>1
- if (pGlobals->params.renderOptions & gxNeedsCommentsOption) {
-
- rdParams.resIndex = kInitComment;
- nrequire(status = RDResPrintf(&rdParams, "Begin", 5), failed_ResPrintf);
-
- }//end if
- #endif
-
- /** Set up the initial style for the page **/
-
- pGlobals->theStyle = GXCloneStyle(GXGetShapeStyle(defaultShape));
-
- /** nrequire(status = StyleDrone((TIEGlobalsHdl)(context), pGlobals->theStyle), failed_State); **/
- /** ^^^ Commented out, now handled when first shape is draw **/
-
- /** Set up the initial halftone screens for the page **/
-
- if (halftoneRecord != nil) {
-
- status = HalftonePrimitive((TIEGlobalsHdl)(context), halftoneRecord);
- nrequire(status, failed_halftone);
-
- }//end if
-
- /** Now make sure we define the default halftone in our ProcSet dictionary **/
- rdParams.resIndex = kDefineDefaultScreen;
- nrequire(status = RDResPrintf(&rdParams), failed_ResPrintf);
-
-
- /*****
- For Portable RGB PostScript, make the colorspace a Calibrated RGB space
- based on the device profile
- ****/
- if ( (pGlobals->params.devCSpace == gxRGBSpace) &&
- (pGlobals->params.renderOptions & gxPortablePostScriptOption)) {
-
- status = CalibratedRGBSpacePrimitive((TIEGlobalsHdl)context, pGlobals->params.devCProfile);
- nrequire(status, failed_space);
-
- rdParams.resIndex = kSetPortableColorSpace;
- nrequire(status = RDResPrintf(&rdParams), failed_ResPrintf);
-
- }//end if
-
-
- /*** Create up the base graphics state ***/
- pGstate = pGlobals->baseGstate;
- pGstate->pointsAvail = pGlobals->params.pathLimit; // assumed we start at initial value passed.
- pGstate->theInk = PSIENewInk();
- pGstate->halftoneTag = nil;
- pGstate->theTransform = GXNewTransform();
- pGstate->flags = eNoGstateFlags;
-
- /** Stuff for Level-2 color if necessary , harmless to set it in either case **/
- pGstate->currSpace = gxNoSpace;
- pGstate->level2DevSpace = false;
- if (pGlobals->defaultProfileCopy != nil)
- pGstate->currProfile = GXCloneColorProfile(pGlobals->defaultProfileCopy);
-
- /** Make sure the color in the printer graphics state reflects our base state **/
- status = InkDrone((TIEGlobalsHdl)(context), pGstate->theInk);
- nrequire(status, failed_Ink);
-
- /** Grab the "port" mapping in the current graphics state **/
- rdParams.resIndex = kSavePortMapping;
- nrequire(status = RDResPrintf(&rdParams), failed_ResPrintf);
-
- #ifdef noBaseState
- /*****
- If we are ignoring transform lists for old apps, initialize our base graphics state
- by calling the gsave. Bumps graphicsState level up to 0. We still need a base
- state. Pass true for internalOnly to inhibit the output of a gsave operator
- *****/
- if (pGlobals->compatFlags.flags1 & kPSIgnoreTransformList) {
- status = DoGsave((TIEGlobalsHdl)(context), true);
- nrequire(status, failed_gsave);
- }//end if
- #endif
-
- pGlobals->ieStateFlags = eInitializeGstate; // So first shape initializes printer.
-
- #if DEBUGLEVEL>1
- if (pGlobals->params.renderOptions & gxNeedsCommentsOption) {
-
- rdParams.resIndex = kInitComment;
- nrequire(status = RDResPrintf(&rdParams, "End", 3), failed_ResPrintf);
-
- }//end if
- #endif
-
- #ifdef TIMEIE
- pGlobals->pageTime = TickCount();
- pGlobals->shapeTime = 0;
- pGlobals->shapeCount = 0;
- #if DEBUGLEVEL >= DEBUGFEEDBACK
- dprintf(trace, "Starting to image page");
- #endif
- #endif
-
- failed_gsave:
- failed_Ink:
- failed_space:
- failed_halftone:
- failed_State:
- failed_ResPrintf:
- failed_Dict:
- failed_MDBegin:
- GXDisposeShape(defaultShape);
-
- HSetState((Handle)context, stateFlags);
- return(status);
-
- }//PostScriptInitGraphics
-
-
-
- //<FF>
- /*************************************
- Routine: PostScriptRestoreGraphics
- Routine restores graphics state to the known state
- created by PostScriptInitGraphics.
- Does all grestores, etc… Disposes of all transforms
- in Imaging Engine internal state.
-
- This should be called at the end of each logical page (or EPS file)
-
- **************************************/
- OSErr PostScriptRestoreGraphics(TPSIEContext context)
- {
- OSErr status = noErr;
- short i;
- TIEGlobalsPtr pGlobals;
- TRDParams rdParams;
- Boolean internalOnly = false; // normally output grestores as well as clean up.
-
- pGlobals = *(TIEGlobalsHdl)context;
-
- #if USECOMPATFLAGS
- if (pGlobals->compatFlags.flags1 & kPSIgnoreTransformList) // If we are ignoring transforms then grestore is internal only.
- internalOnly = true;
- #endif
-
- pGlobals->pRDParams = &rdParams; // Point to this one for this call chain.
-
- rdParams.rdMap = pGlobals->rdMap;
- rdParams.resType = 'STR#';
- rdParams.resID = kScriptResID;
- rdParams.rdFlags = eRDnoOptions;
-
- for (i = pGlobals->gStateDepth; i >= 0; --i) {
-
- status = DoGrestore((TIEGlobalsHdl)context, internalOnly);
- nrequire(status, failed_Grestore);
-
- }//end for
-
- /*** Now dispose of items hanging off of base graphics state (keep in sync with code in DoGrestore) ***/
-
- pGlobals = *(TIEGlobalsHdl)context;
- DisposeGstateItems(pGlobals->baseGstate);
-
- pGlobals = *(TIEGlobalsHdl)context;
- GXDisposeStyle(pGlobals->theStyle); // We cloned ourselves a copy of shape's style.
-
- if (pGlobals->theColorSet != nil)
- GXDisposeColorSet(pGlobals->theColorSet);
-
- if (pGlobals->textStyle != nil)
- GXDisposeStyle(pGlobals->textStyle);
-
-
- /* Clean up any non-document level color rendering dictionaries downloaded for this job if necessary */
-
- if ( pGlobals->params.renderOptions & gxPageIndependentPostScript) {
-
- status = RemoveDownloadedCRDs((TIEGlobalsHdl)context);
- nrequire(status, failed_removeCRDs);
-
- }//end if
-
- /** remove ProcSet dictionary from top of dict stack **/
-
- nrequire(status = EndProcSetDict(&rdParams), failed_Dict);
-
- /** Remove MD from dictionary stack **/
-
- rdParams.resIndex = kMDEnd;
- nrequire(status = RDResPrintf(&rdParams), failed_MDEnd);
-
- #ifdef TIMEIE
- pGlobals->pageTime = TickCount() - pGlobals->pageTime;
-
- #if DEBUGLEVEL >= DEBUGFEEDBACK
- dprintf(trace, "Page Time: %d sec., #shapes: %d, shape Time: %d sec.", pGlobals->pageTime / 60,
- pGlobals->shapeCount, pGlobals->shapeTime / 1000);
- #endif
- #endif
-
- failed_removeCRDs:
- failed_MDEnd:
- failed_Dict:
- failed_Grestore:
-
- return(status);
-
- }//PostScriptRestoreGraphics
-
- #if GXTOPOSTSCRIPTLIBRARY
- /**********************************************
- Routine to download the Procsets:
-
- The code is different from the original imaging engine in that
- the PostScript code resources are explicitly downloaded here.
- In the original imaging engine, the IE returned a resource containing
- a list of resources which the GX printing system would then download.
-
- ***********************************************/
- OSErr PostScriptIEDownloadProcSets(TPSIEContext context)
- {
- short basicProcArray[] = {
- kProcCopyRightNoticeID,
- kStartProcID,
- kStartProcIDL1+1,
- kStartProcIDL1+2,
- kStartProcIDL1+3,
- kStartProcIDL1+4,
- kStartProcIDL1+5,
- kStartProcIDL1+6,
- kStartProcIDL1+7,
- kStartProcIDL1+8,
- kLastProcID
- };
-
- short portableProcArray[] = {
- kProcCopyRightNoticeID,
- kStartProcID,
- kLevel2ColorProcID, // Portable color requires some of the same stuff as level-2 for response functions.
- kPortableColorProcID,
- kStartProcIDL1+1,
- kStartProcIDL1+2,
- kStartProcIDL1+3,
- kStartProcIDL1+4,
- kStartProcIDL1+5,
- kStartProcIDL1+6,
- kStartProcIDL1+7,
- kStartProcIDL1+8,
- kLastProcID
- };
-
- short level2ColorProcArray[] = {
- kProcCopyRightNoticeID,
- kStartProcID,
- kLevel2ColorProcID,
- kStartProcIDL1+1,
- kStartProcIDL1+2,
- kStartProcIDL1+3,
- kStartProcIDL1+4,
- kStartProcIDL1+5,
- kStartProcIDL1+6,
- kStartProcIDL1+7,
- kStartProcIDL1+8,
- kLastProcID
- };
-
- TIEGlobalsPtr pGlobals = *(TIEGlobalsHdl)context;
- long resourceCount;
- OSErr status;
- short *resourceArray;
-
- CGXtoPostScriptDevice *theDevice = pGlobals->psDevice;
-
- if (pGlobals->params.renderOptions & gxPortablePostScriptOption) {
- resourceArray = portableProcArray;
- resourceCount = sizeof(portableProcArray) / sizeof(short);
- } else {
- if (pGlobals->params.renderOptions & gxUseLevel2ColorOption) {
- resourceArray = level2ColorProcArray;
- resourceCount = sizeof(level2ColorProcArray) / sizeof(short);
- } else {
- resourceArray = basicProcArray;
- resourceCount = sizeof(basicProcArray) / sizeof(short);
- }//end if
- }//end if
-
- /** Now stream out the proc-sets **/
-
- for (int i = 0; i < resourceCount; ++i) {
-
- short ID = resourceArray[i];
- Handle hProc;
- status = FetchResource('wstr', ID, &hProc);
- nrequire(status, failed_fetchResource);
-
- HLock(hProc);
- short size = *(short*)(*hProc);
- char* data = (*hProc) + sizeof(short); // skip past size word in wstr resource.
- status = theDevice->BufferData(data, size, gxNoBufferOptions);
- ReleaseResource(hProc);
- nrequire(status, failed_download);
-
- }//end for
-
- failed_download:
- failed_fetchResource:
-
- return(status);
-
- }
- #else
- //<FF>
- /**********************************************
- Routine PostScriptIEGetProcSetList
- Returns the range of id's and type of the resources for the
- PostScript Procedure set, based upon the parameters specified at init time.
-
- context: A valid imaging engine context.
-
- ************************************************/
- OSErr _PostScriptIEGetProcSetList(TPSIEContext context, gxProcSetListPtr procSetList)
- {
- TIEGlobalsPtr pGlobals = *(TIEGlobalsHdl)context;
-
-
- procSetList->controlType = kControlResType;
- procSetList->dataType = kBinaryResType;
-
- if (pGlobals->params.renderOptions & gxPortablePostScriptOption) {
-
- procSetList->controlid = kControlResIDPortable;
-
- #if DEBUGLEVEL >= DEBUGFEEDBACK
- dprintf(trace, "Using portable proc-set");
- #endif
-
- } else {
-
- if (pGlobals->params.renderOptions & gxUseLevel2ColorOption)
- procSetList->controlid = kControlResIDL2Color;
- else
- procSetList->controlid = kControlResID;
-
- }//end if
-
- return(noErr);
- }//PostScriptIEGetProcSetList
- #endif
-
-
- //<FF>
- /***********************
- Routine: PostScriptIEReplaceFontHandler
-
- This function is used to replace the font handler context for the imaging engine.
- This can be called when doing single pass printing when we don't have all the pages
- before imaging.
- ************************/
- void PostScriptIEReplaceFontHandler(TPSIEContext context, TFontHandlerContext newFHContext)
- {
- TIEGlobalsPtr pGlobals = *(TIEGlobalsHdl)context;
- pGlobals->fhContext = newFHContext;
- }
-
-
- //<FF>
-
- /*******************************
- Routine ExitPostScriptIE:
-
- Routine shuts down the PostScript Imaging Engine
-
- context: (returned) A context for the client of the imaging engine.
-
- ********************************/
- OSErr ExitPostScriptIE(TPSIEContext context)
- {
- OSErr status = noErr;
- Handle *workSpaceArray; // Pointer to first handle in array o'workspaces
-
- TIEGlobalsPtr pGlobals = *(TIEGlobalsHdl)context;
- short i;
-
- HLock((Handle)context);
-
- #ifdef usePerfLib
- status = PerfDump(pGlobals->perfGlobals, "\pDevilGerbil:Imaging Utilities:Performance.output", true, 80);
- nrequire(status, failed_Performance);
-
- TermPerf(pGlobals->perfGlobals);
- #endif
-
- workSpaceArray = (Handle*)((long)pGlobals + pGlobals->offsetToWorkspace);
-
- /** Dispose of all workspaces **/
- for (i = 0; i < pGlobals->params.gsaveLimit; i++) {
-
- if (*workSpaceArray != nil)
- DisposeHandle(*workSpaceArray);
-
- ++workSpaceArray;
-
- }//end for
-
-
- if (pGlobals->params.devCProfile != nil)
- GXDisposeColorProfile(pGlobals->params.devCProfile);
-
- if (pGlobals->graySet != nil)
- GXDisposeColorSet(pGlobals->graySet);
-
- if (pGlobals->defaultProfileCopy != nil)
- GXDisposeColorProfile(pGlobals->defaultProfileCopy);
-
- RDShutdown(pGlobals->rdMap);
-
- DisposeHandle((Handle)context);
-
-
- failed_Performance:
- return(status);
-
- }//ExitPostScriptIE
-
-
-