DIRECTORY Rope USING [ROPE], PrintColor USING [ColorCorrection], Imager USING [ScanMode, Context, defaultScanMode], ImagerPixel USING [PixelBuffer, PixelMap]; ConvertToRasters: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; PixelMap: TYPE ~ ImagerPixel.PixelMap; Context: TYPE ~ Imager.Context; ColorCorrection: TYPE ~ PrintColor.ColorCorrection; RasterProc: TYPE ~ PROC [raster: ImagerPixel.PixelBuffer] RETURNS [stop: BOOLEAN _ FALSE]; RasterType: TYPE ~ {rgb, gray, cmyk}; RasterSpec: TYPE ~ RECORD[ type: RasterType, fSize, sSize: NAT, -- size of raster surfaceUnitsPerPixel: NAT _ 5, -- controls smoothing. Make 1 for none scanMode: Imager.ScanMode _ Imager.defaultScanMode, colorCorrection: ColorCorrection _ NIL, --see PrintColorTransformations maxPixel: NAT _ 255 ]; Convert: PROC [action: PROC[Context], rasterSpec: RasterSpec, proc: RasterProc] RETURNS [nBands: NAT]; ToPixelMap: PROC [action: PROC[Context], rasterSpec: RasterSpec] RETURNS [PixelMap]; FromIP: PROC [ip: ROPE, ppiF,ppiS: REAL, page: NAT _ 1, rasterSpec: RasterSpec, proc: RasterProc, x,y,w,h: REAL _ 0] RETURNS[nBands: NAT]; FromIPToPixelMap: PROC [ip: ROPE, ppiF,ppiS: REAL, page: NAT _ 1, rasterSpec: RasterSpec, x,y,w,h: REAL _ 0] RETURNS [PixelMap]; AISFromPixelMap: PROC[aisRoot: ROPE, pm: PixelMap]; IPToRasterIP: PROC[ipIn, ipOut: ROPE, ppiF,ppiS: REAL, page: NAT _ 1, rasterSpec: RasterSpec, x,y,w,h: REAL _ 0, tx,ty: REAL _ 0]; IPWindow: PROC[ip: ROPE, page: NAT _ 1, tol: REAL _ 0.02] RETURNS [x,y,w,h: REAL]; CreateRasterSpec: PROC[type: RasterType, fSize, sSize: NAT, colorCorrection: ColorCorrection, surfaceUnitsPerPixel: NAT _ 5, scanMode: Imager.ScanMode _ Imager.defaultScanMode,maxPixel: NAT _ 255] RETURNS[RasterSpec]; END. LConvertToRasters.mesa Copyright Ó 1987, 1988 by Xerox Corporation. All rights reserved. Maureen Stone, May 26, 1989 4:37:48 pm PDT Doug Wyatt, April 12, 1988 3:53:34 pm PDT Generate (color corrected) rasters from an action proc. Special case added for Interpress. Delivers one scanline worth of pixels Basic Conversion Routines Creates rasters by calling action to image onto the ImagerSmoothContext (set rasterSpec.surfaceUnitsPerPixel _ 1 if no smoothing is desired). The RasterSpec specifies the size and type of the context. The coordinate system is pixels. These procedures work by creating a PixelMap of fSize by sSize by bytes/pixel (1, 3 or 4). For high resolution images, it may be necessary to make the image in bands rather than allocate one giant PixelMap. The value of nBands will be determined by catching VM.CantAllocate and increasing nBands until the allocate succeeds. Using bands will call the action proc nBands times (classic time/space tradeoff). The The RasterSpec should always specify the size of the entire PixelMap. Rather than using a RasterProc, returns the entire PixelMap. Use ConvertRasterObject to turn the PixelMap into an AIS file or other raster format. Convenience procedures for Interpress, AIS Convert from an interpress master to a raster. x,y,w,h specify a window on the Interpress master in inches. If w,h are 0, assume the whole page. Client is responsible for making everything fit. makes 1, 3 or 4 AIS files depending on pm.samplesPerPixel. File names are aisRoot.ais, aisRoot-red.ais, -grn.ais, -blu.ais or aisRoot-cyan.ais, -magenta.ais, -yellow.ais -black.ais Makes an Interpress master with the pixel map imaged at tx,ty (inches). Uses the appropriate color operator depending on pm.samplesPerPixel: GrayLinear, RGBLinear or CMYKLinear. This calls FromIPToPixelMap so the rasters must fit in VM. Renders the IP file through ImagerMaskCapture and returns a window on the area which has the printable stuff in it. The tolerance is expressed in inches. The bigger the tolerance the faster this will run. The returned box is guaranteed to be big enough. Êטcode•Mark outsideHeaderšœ™KšœB™BKšœ*™*K™)—K™K™\K™šÏk ˜ Kšœœœ˜Kšœ œ˜#Kšœœ&˜2Kšœ œ˜*—K˜KšÐblœœ ˜#šœ˜K˜Kšœœœ˜Kšœ œ˜&Kšœ œ˜Kšœœ˜3unitš œ œœ#œœœ˜ZK™%—Lšœ œ˜%šœ œœ˜Kšœ˜KšœœÏc˜$KšœœŸ'˜FKšœ3˜3Kšœ#œŸ˜GKšœ œ˜Kšœ˜——head™š Ïnœœ œ5œ œ˜fKšœ™Kšœ\™\Kšœ[™[Kšœê™êKšœV™VKšœF™FK™—š  œœ œ#œ ˜TJšœ<™