DIRECTORY Convert, Interpress, Imager, PDFileWriter, ImagerPrintContext, ImagerSample, IO, Real, Rope, SF, Vector2, ImagerMemory, ProcessProps, Process, PrintColor; Color400DirectPDImpl: CEDAR PROGRAM IMPORTS Interpress, PDFileWriter, ImagerPrintContext, ImagerSample, IO, Real, Rope, ImagerMemory, Convert, ProcessProps ~ BEGIN ROPE: TYPE ~ Rope.ROPE; Log: PROC [class: INT, code: ATOM, explanation: ROPE] ~ { WITH ProcessProps.GetProp[$StdOut] SELECT FROM msg: IO.STREAM => { msg.PutRope[ SELECT class FROM Interpress.classMasterError => "Master Error: ", Interpress.classMasterWarning => "Master Warning: ", Interpress.classAppearanceError => "Appearance Error: ", Interpress.classAppearanceWarning => "Appearance Warning: ", Interpress.classComment => "Comment: ", ENDCASE => Rope.Cat["Class ", Convert.RopeFromInt[class], " Error: "] ]; msg.PutRope[explanation]; msg.PutRope[" . . . "]; }; ENDCASE => NULL; }; pixelsPerHalftoneDot: REAL _ 7; writePD: BOOL _ TRUE; InterpressToPD: PROC [inputName, outputName: ROPE] ~ { interpress: Interpress.Master ~ Interpress.Open[fileName: inputName, log: Log]; size: SF.Vec ~ [s: Real.Round[13.75*400], f: Real.Round[10.24*400]]; bitmap: ImagerSample.RasterSampleMap ~ ImagerSample.ObtainScratchMap[box: [max: size]]; context: Imager.Context ~ ImagerPrintContext.SimpleCreate[deviceSpaceSize: size, scanMode: [slow: down, fast: right], surfaceUnitsPerInch: [400, 400], logicalDevice: 9, pixelsPerHalftoneDot: pixelsPerHalftoneDot, toners: [black: TRUE, cyan: TRUE, magenta: TRUE, yellow: TRUE]]; bandSSize: NAT _ 50; wordsPerLine: CARDINAL ~ (INT[size.f]+BITS[WORD]-1)/BITS[WORD]; bitsPerLine: NAT ~ wordsPerLine*BITS[WORD]; pdState: PDFileWriter.PDState ~ PDFileWriter.Create[fileName: outputName, deviceCode: VAL[9], sResolution: 400, fResolution: 400, imageSSize: size.s, imageFSize: size.f, bandSSize: bandSSize, copies: 1, leftOverMode: FALSE, maxLoadWords: 0]; pdTonerForPass: ARRAY [0..4) OF PDFileWriter.Toner ~ [yellow, magenta, cyan, black]; tonerForPass: ARRAY [0..4) OF PrintColor.Toner ~ [yellow, magenta, cyan, black]; ropeTonerForPass: ARRAY [0..4) OF Rope.ROPE ~ ["yellow", "magenta", "cyan", "black"]; ImagerPrintContext.SetBitmap[context: context, bitmap: bitmap]; FOR page: INT IN [1..interpress.pages] DO memory: Imager.Context ~ ImagerMemory.NewMemoryContext[]; Interpress.DoPage[master: interpress, page: page, context: memory, log: Log, copy: 1]; Log[Interpress.classComment, $page, IO.PutFR["page %g", [integer[page]]]]; FOR pass: NAT IN [0..4) DO tonerSet: PDFileWriter.TonerSet _ ALL[FALSE]; Log[Interpress.classComment, $pass, ropeTonerForPass[pass]]; tonerSet[pdTonerForPass[pass]] _ TRUE; PDFileWriter.StartImage[pdState: pdState, toners: tonerSet, feed: pass=0, strip: pass=3]; ImagerPrintContext.SetSeparation[context, tonerForPass[pass]]; ImagerSample.Clear[bitmap]; ImagerMemory.Replay[c: memory, into: context]; FOR s: NAT _ 0, s + bandSSize UNTIL s >= size.s DO sMax: NAT ~ MIN[s+bandSSize, size.s]; sSize: NAT ~ sMax-s; band: ImagerSample.RasterSampleMap ~ NARROW[ImagerSample.Clip[map: bitmap, box: [min: [s, 0], max: [sMax, size.f]]]]; Deliver: PROC [doLine: PDFileWriter.CaptureScanLineProc] = TRUSTED { p: LONG POINTER _ ImagerSample.GetBase[band].word; THROUGH [0..sSize) DO doLine[p]; p _ p + wordsPerLine; ENDLOOP; }; Process.CheckForAbort[]; IF writePD THEN PDFileWriter.MaskSamples[pdState: pdState, sMin: s, fMin: 0, sSize: sSize, fSize: size.f, deliverProc: Deliver]; TRUSTED { ImagerSample.ReleaseDescriptor[band] }; ENDLOOP; PDFileWriter.EndPage[pdState]; ENDLOOP; ENDLOOP; PDFileWriter.Close[pdState: pdState]; ImagerSample.ReleaseScratchMap[bitmap]; }; END. ξColor400DirectPDImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Michael Plass, July 13, 1987 8:12:16 pm PDT This creates PD files for the 400 bpi color thermal transfer printer. It is meant not as a production program, but merely as a testbed for getting the color correction parameters, special colors, etc. debugged. It builds each separation in memory before writing the bits to the PD file, so the resulting file is always about 11 megabytes for each page. Κ !˜šœ™Icode™˜E—K˜—Kšœ˜Kšœ˜Kšœ˜—Kšœœ˜—K˜K˜—Kšœœ˜šœ œœ˜K˜—šŸœœœ˜6K•StartOfExpansionΗ[fileName: ROPE, log: Interpress.LogProc, credentials: Interpress.Credentials _ NIL, externalInstructions: Interpress.Instructions _ NIL, defaultInstructions: Interpress.Instructions _ NIL]šœO˜OK–«[deviceSpaceSize: SF.Vec, scanMode: ImagerTransformation.ScanMode, surfaceUnitsPerInch: VEC, logicalDevice: PrintColor.LogicalDevice, pixelsPerHalftoneDot: REAL]šœœ<˜DK–X[box: SF.Box, bitsPerSample: ImagerSample.BitsPerSample _ 1, bitsPerLine: INT _ 0]šœW˜WK–[deviceSpaceSize: SF.Vec, scanMode: ImagerTransformation.ScanMode, surfaceUnitsPerInch: VEC, logicalDevice: PrintColor.LogicalDevice, halftoneProperties: PrintColor.HalftoneProperties, correction: PrintColor.ColorCorrection _ NIL, interpolate: BOOL _ FALSE]š œεœœ œ œ˜•Kšœ œ˜Kš œœœ œœœœ˜?Kšœ œœœ˜+KšœVœ€œ˜ρKšœœœ5˜TKšœœœ3˜PKšœœœœ*˜UK–=[context: Imager.Context, bitmap: ImagerSample.SampleMap]šœ?˜?šœœœ˜)Kšœ9˜9K–q[master: Interpress.Master, page: INT, context: Imager.Context, log: Interpress.LogProc, copy: INT _ 1]šœV˜VKšœ$œ$˜Jšœœœ˜Kšœ"œœ˜-Kšœ<˜˜>Kšœ˜Kšœ.˜.šœœœ ˜2K–u[map: ImagerSample.SampleMap, box: SF.Box _ [min: [s: -32768, f: -32768], max: [s: 32767, f: 32767]]]šœœœ˜%Kšœœ ˜Kšœ%œJ˜u–& -- [PDFileWriter.CaptureScanLineProc]šŸœœ.œ˜DKšœœœ#˜2šœ ˜Kšœ ˜ Kšœ˜Kšœ˜—K˜—K–Ÿ[pdState: PDFileWriter.PDState, sMin: CARDINAL, fMin: CARDINAL, sSize: CARDINAL, fSize: CARDINAL, deliverProc: PDFileWriter.DeliverSampleArrayProc]˜Kšœ œq˜€K–[map: ImagerSample.SampleMap]šœ*˜1Kšœ˜—Kšœ˜Kšœ˜—Kšœ˜—K–![pdState: PDFileWriter.PDState]šœ%˜%Kšœ'˜'Kšœ˜K˜——Kšœ˜—…—L[