DIRECTORY Basics, Font, Imager, ImagerAISUtil, ImagerBasic, ImagerBrick, ImagerDefault, ImagerPixelMaps, ImagerPrivate, ImagerPD, IO, JaM, JaMImagerContexts, JaMImager, JaMIPrivate, Real, Rope, UFPressFontReader, UFFileManager, ImagerHalftone ; ImagerJaM: CEDAR PROGRAM IMPORTS Basics, Font, Imager, IO, JaM, JaMImagerContexts, JaMIPrivate, JaMImager, Real, ImagerAISUtil, ImagerPD, Rope, UFPressFontReader, UFFileManager, ImagerBrick, ImagerHalftone, ImagerPixelMaps EXPORTS JaMIPrivate = BEGIN Context: TYPE = Imager.Context; Pair: TYPE = ImagerBasic.Pair; ROPE: TYPE = Rope.ROPE; Transformation: TYPE = ImagerBasic.Transformation; PopPair: PROC [state: JaM.State] RETURNS [Pair] = { y: REAL _ JaM.PopReal[state]; x: REAL _ JaM.PopReal[state]; RETURN [[x, y]] }; ConicTo: PROC [state: JaM.State] = { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; r: REAL _ JaM.PopReal[state]; p2: Pair _ PopPair[state]; p1: Pair _ PopPair[state]; IF info.trajectory # NIL THEN info.trajectory.first _ info.trajectory.first.ConicTo[p1, p2, r]; }; ArcTo: PROC [state: JaM.State] = { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; p2: Pair _ PopPair[state]; p1: Pair _ PopPair[state]; IF info.trajectory # NIL THEN info.trajectory.first _ info.trajectory.first.ArcTo[p1, p2]; }; Move: PROC [state: JaM.State] = { Paint: PROC [dc: Context] = {dc.Move}; JaMImager.Painter[Paint, state]; }; Trans: PROC [state: JaM.State] = { Paint: PROC [dc: Context] = {dc.Trans}; JaMImager.Painter[Paint, state]; }; SetXY: PROC [state: JaM.State] = { p: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.SetXY[p]}; JaMImager.Painter[Paint, state]; }; SetXYRel: PROC [state: JaM.State] = { p: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.SetXYRel[p]}; JaMImager.Painter[Paint, state]; }; MakeGray: PROC [state: JaM.State] = { JaM.Push[state, Imager.MakeGray[JaM.PopReal[state]]]; }; Black: PROC [state: JaM.State] = { JaM.Push[state, Imager.black]; }; White: PROC [state: JaM.State] = { JaM.Push[state, Imager.white]; }; MakeStipple: PROC [state: JaM.State] = { JaM.Push[state, Imager.MakeStipple[JaM.PopInt[state]]]; }; SetColor: PROC [state: JaM.State] = { color: Imager.Color _ NARROW[JaM.Pop[state]]; Paint: PROC [dc: Context] = {dc.SetColor[color]}; JaMImager.Painter[Paint, state]; }; SetSampledColor: PROC [state: JaM.State] = { aisName: ROPE _ JaM.PopRope[state]; color: ImagerBasic.SampledColor _ ImagerAISUtil.AISToColor[aisName]; Paint: PROC [dc: Context] = { trans: Transformation _ NARROW[dc.state, ImagerDefault.State].T; copy: ImagerBasic.SampledColor _ NEW[ImagerBasic.ColorRep.sampled _ color^]; copy.m _ trans; dc.SetColor[copy]; }; JaMImager.Painter[Paint, state]; }; --the old version takes: PixelArray transparent SetSampledBlackIdent: PROC [state: JaM.State] = { transparent: BOOLEAN _ JaM.PopBool[state]; pa: ImagerBasic.PixelArray _ NARROW[JaM.Pop[state]]; Paint: PROC [dc: Context] = { dc.SetSampledBlack[pa, Imager.Rotate[0], transparent]; }; JaMImager.Painter[Paint, state]; }; --new version takes: PixelArray Transformation transparent SetSampledBlack: PROC [state: JaM.State] = { transparent: BOOLEAN _ JaM.PopBool[state]; trans: Transformation _ NARROW[JaM.Pop[state]]; pa: ImagerBasic.PixelArray _ NARROW[JaM.Pop[state]]; Paint: PROC [dc: Context] = { dc.SetSampledBlack[pa, trans, transparent]; }; JaMImager.Painter[Paint, state]; }; MakeSampledBlack: PROC [state: JaM.State] = { transparent: BOOLEAN _ JaM.PopBool[state]; trans: Transformation _ NARROW[JaM.Pop[state]]; pa: ImagerBasic.PixelArray _ NARROW[JaM.Pop[state]]; color: ImagerBasic.SampledColor ~ NEW[ImagerBasic.ColorRep.sampled _ [sampled[ transparent: transparent, pa: pa, m: trans, colorOperator: $SampledBlack ]]]; JaM.Push[state,color]; }; ConcatT: PROC [state: JaM.State] = { m: Imager.Transformation _ NARROW[JaM.Pop[state]]; Paint: PROC [dc: Context] = { dc.ConcatT[m]; }; JaMImager.Painter[Paint, state]; }; MakeT: PROC [state: JaM.State] = { f: REAL _ JaM.PopReal[state]; e: REAL _ JaM.PopReal[state]; d: REAL _ JaM.PopReal[state]; c: REAL _ JaM.PopReal[state]; b: REAL _ JaM.PopReal[state]; a: REAL _ JaM.PopReal[state]; JaM.Push[state, Imager.MakeT[a: a, b: b, c: c, d: d, e: e, f: f]]; }; Translate: PROC [state: JaM.State] = { y: REAL _ JaM.PopReal[state]; x: REAL _ JaM.PopReal[state]; JaM.Push[state, Imager.Translate[x: x, y: y]]; }; Scale: PROC [state: JaM.State] = { JaM.Push[state, Imager.Scale[s: JaM.PopReal[state]]]; }; Scale2: PROC [state: JaM.State] = { y: REAL _ JaM.PopReal[state]; x: REAL _ JaM.PopReal[state]; JaM.Push[state, Imager.Scale2[sx: x, sy: y]]; }; Rotate: PROC [state: JaM.State] = { JaM.Push[state, Imager.Rotate[a: JaM.PopReal[state]]]; }; Invert: PROC [state: JaM.State] = { JaM.Push[state, Imager.Invert[m: NARROW[JaM.Pop[state]]]]; }; GetCP: PROC [state: JaM.State] = { cp: Pair _ [0, 0]; Paint: PROC [dc: Context] = {cp _ NARROW[dc.class, ImagerPrivate.Class].GetCP[dc]}; JaMImager.Painter[Paint, state]; state.PushReal[cp.x]; state.PushReal[cp.y]; }; SetStrokeWidth: PROC [state: JaM.State] = { w: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = {dc.SetStrokeWidth[w]}; JaMImager.Painter[Paint, state]; }; SetStrokeEnd: PROC [state: JaM.State] = { i: INT _ JaM.PopInt[state]; Paint: PROC [dc: Context] = {dc.SetStrokeEnd[IF i=1 THEN square ELSE IF i=2 THEN round ELSE butt]}; JaMImager.Painter[Paint, state]; }; SetNoImage: PROC [state: JaM.State] = { b: BOOLEAN _ JaM.PopBool[state]; encode: ARRAY BOOLEAN OF INTEGER = [FALSE: 0, TRUE: 1]; Paint: PROC [dc: Context] = { class: ImagerPrivate.Class _ NARROW[dc.class]; class.ISetInt[dc, $noImage, encode[b]] }; JaMImager.Painter[Paint, state]; }; MaskFill: PROC [state: JaM.State] = { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Paint: PROC [dc: Context] = {dc.MaskFill[info.trajectory]}; JaMImager.Painter[Paint, state]; }; MaskStroke: PROC [state: JaM.State] = { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Paint: PROC [dc: Context] = {dc.MaskStroke[info.trajectory.first]}; IF info.trajectory # NIL THEN JaMImager.Painter[Paint, state]; }; MaskStrokeClosed: PROC [state: JaM.State] = { info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Paint: PROC [dc: Context] = {dc.MaskStrokeClosed[info.trajectory.first]}; IF info.trajectory # NIL THEN JaMImager.Painter[Paint, state]; }; MaskRectangle: PROC [state: JaM.State] = { wh: Pair _ PopPair[state]; xy: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.MaskRectangle[xy.x, xy.y, wh.x, wh.y]}; JaMImager.Painter[Paint, state]; }; MaskVector: PROC [state: JaM.State] = { p2: Pair _ PopPair[state]; p1: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.MaskVector[p1, p2]}; JaMImager.Painter[Paint, state]; }; StartUnderline: PROC [state: JaM.State] = { Paint: PROC [dc: Context] = {dc.StartUnderline}; JaMImager.Painter[Paint, state]; }; MaskUnderline: PROC [state: JaM.State] = { h: REAL _ JaM.PopReal[state]; dy: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = { dc.MaskUnderline[dy, h]; }; JaMImager.Painter[Paint, state]; }; SetAmplifySpace: PROC [state: JaM.State] = { e: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = {dc.SetAmplifySpace[e]}; JaMImager.Painter[Paint, state]; }; SetPriorityImportant: PROC [state: JaM.State] = { b: BOOLEAN _ JaM.PopBool[state]; Paint: PROC [dc: Context] = {dc.SetPriorityImportant[b]}; JaMImager.Painter[Paint, state]; }; CorrectMask: PROC [state: JaM.State] = { Paint: PROC [dc: Context] = {dc.CorrectMask}; JaMImager.Painter[Paint, state]; }; CorrectSpace: PROC [state: JaM.State] = { p: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.CorrectSpace[p]}; JaMImager.Painter[Paint, state]; }; DoSave: PROC [state: JaM.State] = { op: REF _ JaM.Pop[state]; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Body: PROC = {JaM.Execute[state, op]}; dcList: JaMImagerContexts.DCList _ info.dcList; venabled: BOOLEAN _ info.venabled; {ENABLE UNWIND => {info.dcList _ dcList; info.venabled _ venabled}; info.dcList _ NIL; IF info.venabled THEN { info.vdc.DoSave[Body]; }; info.venabled _ FALSE; FOR dcListItem: JaMImagerContexts.DCList _ dcList, dcListItem.next UNTIL dcListItem = NIL DO next: JaMImagerContexts.DCList _ dcListItem.next; {ENABLE UNWIND => dcListItem.next _ next; info.dcList _ dcListItem; dcListItem.next _ NIL; IF dcListItem.enabled THEN { dcListItem.dc.DoSave[Body]; }; }; dcListItem.next _ next; ENDLOOP; }; info.dcList _ dcList; info.venabled _ venabled; }; DoSaveAll: PROC [state: JaM.State] = { op: REF _ JaM.Pop[state]; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Body: PROC = {JaM.Execute[state, op]}; dcList: JaMImagerContexts.DCList _ info.dcList; venabled: BOOLEAN _ info.venabled; {ENABLE UNWIND => {info.dcList _ dcList; info.venabled _ venabled}; info.dcList _ NIL; IF info.venabled THEN { info.vdc.DoSaveAll[Body]; }; info.venabled _ FALSE; FOR dcListItem: JaMImagerContexts.DCList _ dcList, dcListItem.next UNTIL dcListItem = NIL DO next: JaMImagerContexts.DCList _ dcListItem.next; {ENABLE UNWIND => dcListItem.next _ next; info.dcList _ dcListItem; dcListItem.next _ NIL; IF dcListItem.enabled THEN { dcListItem.dc.DoSaveAll[Body]; }; }; dcListItem.next _ next; ENDLOOP; }; info.dcList _ dcList; info.venabled _ venabled; }; Correct: PROC [state: JaM.State] = { op: REF _ JaM.Pop[state]; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[state]; Body: PROC = {JaM.Execute[state, op]}; dcList: JaMImagerContexts.DCList _ info.dcList; venabled: BOOLEAN _ info.venabled; {ENABLE UNWIND => {info.dcList _ dcList; info.venabled _ venabled}; info.dcList _ NIL; IF info.venabled THEN { info.vdc.Correct[Body]; }; info.venabled _ FALSE; FOR dcListItem: JaMImagerContexts.DCList _ dcList, dcListItem.next UNTIL dcListItem = NIL DO next: JaMImagerContexts.DCList _ dcListItem.next; {ENABLE UNWIND => dcListItem.next _ next; info.dcList _ dcListItem; dcListItem.next _ NIL; IF dcListItem.enabled THEN { dcListItem.dc.Correct[Body]; }; }; dcListItem.next _ next; ENDLOOP; }; info.dcList _ dcList; info.venabled _ venabled; }; SetCorrectMeasure: PROC [state: JaM.State] = { p: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.SetCorrectMeasure[p]}; JaMImager.Painter[Paint, state]; }; SetCorrectTolerance: PROC [state: JaM.State] = { p: Pair _ PopPair[state]; Paint: PROC [dc: Context] = {dc.SetCorrectTolerance[p]}; JaMImager.Painter[Paint, state]; }; SetCorrectShrink: PROC [state: JaM.State] = { e: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = {dc.SetCorrectShrink[e]}; JaMImager.Painter[Paint, state]; }; Space: PROC [state: JaM.State] = { e: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = {dc.Space[e]}; JaMImager.Painter[Paint, state]; }; IState: PROC [state: JaM.State] = { s: IO.STREAM _ IO.ROS[]; Paint: PROC [dc: Context] = { s.Put[IO.refAny[dc.state]]; s.PutChar['\n]; }; JaMImager.Painter[Paint, state]; JaM.Push[state, IO.RopeFromROS[s]]; }; AnyToRope: PROC [state: JaM.State] = { r: REF _ JaM.Pop[state]; s: IO.STREAM _ IO.ROS[]; s.Put[IO.refAny[r]]; s.PutChar['\n]; JaM.Push[state, IO.RopeFromROS[s]]; }; PlatemakerTemplate: ImagerPD.PDFileDescriptionRep _ [ fileName: NIL, deviceCode: mig, sResolution: 880, fResolution: 880, imageSSize: 9680, imageFSize: 7480, nColors: 1, bandSSize: 16, maxLoadWords: 60000, leftovers: TRUE, copies: 1 ]; VersatecTemplate: ImagerPD.PDFileDescriptionRep _ [ fileName: NIL, deviceCode: mig, sResolution: 200, fResolution: 200, imageSSize: 20000, imageFSize: 8000, nColors: 1, bandSSize: 64, maxLoadWords: 60000, leftovers: FALSE, copies: 1 ]; PlateMakerParam: PROC[fileName: ROPE] RETURNS [param: ImagerPD.PDFileDescription] = { param _ NEW[ImagerPD.PDFileDescriptionRep _ PlatemakerTemplate]; param.fileName _ fileName; }; VersatecParam: PROC[fileName: ROPE] RETURNS [param: ImagerPD.PDFileDescription] = { param _ NEW[ImagerPD.PDFileDescriptionRep _ VersatecTemplate]; param.fileName _ fileName; }; ColorVersatecParam: PROC[fileName: ROPE] RETURNS [param: ImagerPD.PDFileDescription] = { param _ NEW[ImagerPD.PDFileDescriptionRep _ VersatecTemplate]; param.fileName _ fileName; param.nColors _ 4; }; SetLineScreen: PROC[state: JaM.State] = { angle: REAL _ JaM.PopReal[state]; linesPerInch: REAL _ JaM.PopReal[state]; Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN { dtheta: REAL _ IF param.imageSSize < param.imageFSize THEN 90 ELSE 0; brick: ImagerBrick.Brick _ ImagerBrick.BuildBrick[freq: param.sResolution/linesPerInch, angle: angle+dtheta, filter: ImagerHalftone.LineScreen]; Imager.PutProp[dc, $CustomBrick, brick]; }; }; JaMImager.Painter[Paint, state]; }; SetDotScreen: PROC[state: JaM.State] = { angle: REAL _ JaM.PopReal[state]; linesPerInch: REAL _ JaM.PopReal[state]; ratio: REAL _ MIN[MAX[JaM.PopReal[state], 0], 1]; DotScreen: PROC [x, y: REAL] RETURNS [fvalue: REAL] ~ { tx: REAL _ (x-1)*(x-1)*(x+1)*(x+1); ty: REAL _ (y-1)*(y-1)*(y+1)*(y+1); fvalue _ tx*ratio+ty*(1-ratio); }; Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN { dtheta: REAL _ IF param.imageSSize < param.imageFSize THEN 90 ELSE 0; brick: ImagerBrick.Brick _ ImagerBrick.BuildBrick[freq: param.sResolution/linesPerInch, angle: angle+dtheta, filter: DotScreen]; Imager.PutProp[dc, $CustomBrick, brick]; }; }; JaMImager.Painter[Paint, state]; }; SetCustomScreen: PROC[state: JaM.State] = { phase: INT _ JaM.PopInt[state]; dotsPerLine: INT _ JaM.PopInt[state]; linesPerBrick: INT _ JaM.PopInt[state]; brick: ImagerBrick.Brick _ NEW[ImagerBrick.BrickRep[dotsPerLine*linesPerBrick]]; Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN Imager.PutProp[dc, $CustomBrick, brick]; }; brick.fSize _ dotsPerLine; brick.sSize _ linesPerBrick; brick.phase _ phase; FOR i: INT DECREASING IN [0..dotsPerLine*linesPerBrick) DO brick[i] _ JaM.PopReal[state]; ENDLOOP; JaMImager.Painter[Paint, state]; }; SetAISScreen: PROC[state: JaM.State] = { angle: REAL _ JaM.PopReal[state]; imagesPerInch: REAL _ JaM.PopReal[state]; aisName: ROPE _ JaM.PopRope[state]; pixelMap: ImagerPixelMaps.PixelMap _ ImagerAISUtil.PixelMapFromAIS[aisName].pixelMap; maxPixel: CARDINAL _ Basics.BITSHIFT[1, Basics.BITSHIFT[1, pixelMap.refRep.lgBitsPerPixel]] - 1; mult: REAL _ 1.0/maxPixel; AISScreen: PROC [x, y: REAL] RETURNS [fvalue: REAL] ~ { sr: REAL _ (1-y)/2.0*pixelMap.sSize; fr: REAL _ (1+x)/2.0*pixelMap.fSize; f: CARDINAL _ Real.Fix[fr]; s: CARDINAL _ Real.Fix[sr]; RETURN [pixelMap.GetPixel[f, s]*mult] }; Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN { dtheta: REAL _ IF param.imageSSize < param.imageFSize THEN 90 ELSE 0; brick: ImagerBrick.Brick _ ImagerBrick.BuildBrick[freq: param.sResolution/imagesPerInch, angle: angle+dtheta, filter: AISScreen]; Imager.PutProp[dc, $CustomBrick, brick]; }; }; JaMImager.Painter[Paint, state]; }; OpenPlatemakerPD: PROC[state: JaM.State] = { name: ROPE = JaM.PopRope[state]; param: ImagerPD.PDFileDescription _ PlateMakerParam[name]; context: Imager.Context _ Imager.Create[$PD, param]; Imager.PutProp[context, $PDParam, param]; JaMImagerContexts.AddContext[state, context, PDCallMe, $PD]; context.ScaleT[0.0254/72]; }; PDCallMe: JaMImagerContexts.CallMe ~ {IF command = initdc THEN {context.Reset; context.ScaleT[0.0254/72]}}; OpenVersatecPD: PROC[state: JaM.State] = { name: ROPE = JaM.PopRope[state]; param: ImagerPD.PDFileDescription _ VersatecParam[name]; context: Imager.Context _ Imager.Create[$PD, param]; Imager.PutProp[context, $PDParam, param]; JaMImagerContexts.AddContext[state, context, PDCallMe, $PD]; context.ScaleT[0.0254/72]; }; OpenColorVersatecPD: PROC[state: JaM.State] = { name: ROPE = JaM.PopRope[state]; param: ImagerPD.PDFileDescription _ ColorVersatecParam[name]; context: Imager.Context _ Imager.Create[$PD, param]; Imager.PutProp[context, $PDParam, param]; JaMImagerContexts.AddContext[state, context, PDCallMe, $PD]; context.ScaleT[0.0254/72]; }; OpenHornetPD: PROC[state: JaM.State] = { name: ROPE = JaM.PopRope[state]; param: ImagerPD.PDFileDescription _ ImagerPD.Hornet[name]; context: Imager.Context _ Imager.Create[$PD, param]; Imager.PutProp[context, $PDParam, param]; JaMImagerContexts.AddContext[state, context, PDCallMe, $PD]; context.ScaleT[0.0254/72]; }; OpenRavenPD: PROC[state: JaM.State] = { name: ROPE = JaM.PopRope[state]; param: ImagerPD.PDFileDescription _ ImagerPD.Raven[name]; context: Imager.Context _ Imager.Create[$PD, param]; Imager.PutProp[context, $PDParam, param]; JaMImagerContexts.AddContext[state, context, PDCallMe, $PD]; context.ScaleT[0.0254/72]; }; NewToner: PROC[state: JaM.State] = { Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN { [] _ Imager.SpecialOp[dc, $NewToner, NIL]; }; }; JaMImager.Painter[Paint, state]; }; NewPage: PROC[state: JaM.State] = { Paint: PROC [dc: Context] = { param: ImagerPD.PDFileDescription _ NARROW[Imager.GetProp[dc, $PDParam]]; IF param # NIL THEN { [] _ Imager.SpecialOp[dc, $NewPage, NIL]; }; }; JaMImager.Painter[Paint, state]; }; ClosePD: PROC[state: JaM.State] = { dc: Context _ JaMImagerContexts.RemoveContext[state, $PD]; IF dc # NIL THEN [] _ Imager.SpecialOp[dc, $Close, NIL]; }; lastInt: REAL ~ 2147483647.0; Trunc: PROC[state: JaM.State] = { r: REAL = JaM.PopReal[state]; IF ABS[r] > lastInt THEN {JaM.PushReal[state, r]} ELSE JaM.PushInt[state, Real.Fix[r]]; }; Round: PROC[state: JaM.State] = { r: REAL = JaM.PopReal[state]; IF ABS[r] > lastInt THEN {JaM.PushReal[state, r]} ELSE JaM.PushInt[state, Real.RoundLI[r]]; }; Floor: PROC[state: JaM.State] = { r: REAL = JaM.PopReal[state]; IF ABS[r] > lastInt THEN {JaM.PushReal[state, r]} ELSE { i: INT _ Real.RoundLI[r]; WHILE i >= r DO i_i-1 ENDLOOP; WHILE i < r DO i_i+1 ENDLOOP; JaM.PushInt[state, i]; }; }; Ceil: PROC[state: JaM.State] = { r: REAL = JaM.PopReal[state]; i: INT _ Real.RoundLI[r]; IF ABS[r] > lastInt THEN {JaM.PushReal[state, r]} ELSE { i: INT _ Real.RoundLI[r]; WHILE i <= r DO i_i+1 ENDLOOP; WHILE i > r DO i_i-1 ENDLOOP; JaM.PushInt[state, i]; }; }; MakeBitArray: PROC[state: JaM.State] = { bits: PACKED ARRAY [0..1024) OF [0..1]; columns: INT _ JaM.PopInt[state]; rows: INT _ JaM.PopInt[state]; FOR i: INT DECREASING IN [0..columns*rows) DO bits[i] _ JaM.PopInt[state]; ENDLOOP; TRUSTED {JaM.Push[state, Imager.MakePixelArrayFromBits[@bits, columns, columns, rows]]}; }; MaskPixel: PROC[state: JaM.State] = { pa: ImagerBasic.PixelArray _ NARROW[JaM.Pop[state]]; Paint: PROC [dc: Context] = { dc.MaskPixel[pa]; }; JaMImager.Painter[Paint, state]; }; PixelArrayFromAC: PROC[state: JaM.State] = { char: CHAR _ JaM.PopRope[state].Fetch[0]; acName: ROPE _ JaM.PopRope[state]; fontKey: UFPressFontReader.FontKey _ [UFFileManager.KeyOf[acName], 0]; pa: ImagerBasic.PixelArray _ UFPressFontReader.GetCharRaster[fontKey, char]; JaM.Push[state, pa]; }; deviceType: ATOM _ $Ideal; NSRSetFont: PROC[state: JaM.State] = { rotation: REAL _ JaM.PopReal[state]; size: REAL _ JaM.PopReal[state]; name: ROPE _ JaM.PopRope[state]; font: Font.FONT _ Font.Create[name, Imager.Concat[Imager.Scale[size], Imager.Rotate[rotation]], deviceType]; Paint: PROC [dc: Context] = { dc.SetFont[font]; }; JaMImager.Painter[Paint, state]; }; Show: PROC[state: JaM.State] = { text: ROPE _ JaM.PopRope[state]; Paint: PROC [dc: Context] = { dc.ShowCharacters[text]; }; JaMImager.Painter[Paint, state]; }; Ddt: PROC[state: JaM.State] = { any: REF _ JaM.Pop[state]; context: Imager.Context _ NIL; Paint: PROC [dc: Context] = { IF context = NIL THEN context _ dc; }; RaiseError: PROC ~ {ERROR}; JaMImager.Painter[Paint, state]; RaiseError[! ABORTED => CONTINUE]; }; ImagerReset: PROC[state: JaM.State] = { Paint: PROC [dc: Context] = { brick: REF _ Imager.GetProp[dc, $CustomBrick]; dc.Reset; dc.ScaleT[0.0254/72]; Imager.PutProp[dc, $CustomBrick, brick]; }; JaMImager.Painter[Paint, state]; }; RegisterImager: PUBLIC PROC [state: JaM.State] = { JaM.Register[state, ".move", Move]; JaM.Register[state, ".trans", Trans]; JaM.Register[state, ".setxy", SetXY]; JaM.Register[state, ".setxyrel", SetXYRel]; JaM.Register[state, ".makegray", MakeGray]; JaM.Register[state, ".black", Black]; JaM.Register[state, ".white", White]; JaM.Register[state, ".makestipple", MakeStipple]; JaM.Register[state, ".setcolor", SetColor]; JaM.Register[state, ".setsampledcolor", SetSampledColor]; JaM.Register[state, ".setsampledblack", SetSampledBlack]; JaM.Register[state, ".makesampledblack", MakeSampledBlack]; JaM.Register[state, ".setsampledblackident", SetSampledBlackIdent]; JaM.Register[state, ".concatT", ConcatT]; JaM.Register[state, ".makeT", MakeT]; JaM.Register[state, ".makeTranslate", Translate]; JaM.Register[state, ".makeScale", Scale]; JaM.Register[state, ".makeScale2", Scale2]; JaM.Register[state, ".makeRotate", Rotate]; JaM.Register[state, ".invert", Invert]; JaM.Register[state, ".makebitarray", MakeBitArray]; JaM.Register[state, ".maskpixel", MaskPixel]; JaM.Register[state, ".pixelarrayfromac", PixelArrayFromAC]; JaM.Register[state, ".conicto", ConicTo]; JaM.Register[state, ".arcto", ArcTo]; JaM.Register[state, ".getcp", GetCP]; JaM.Register[state, ".setstrokewidth", SetStrokeWidth]; JaM.Register[state, ".setstrokeend", SetStrokeEnd]; JaM.Register[state, ".setnoimage", SetNoImage]; JaM.Register[state, ".maskfill", MaskFill]; JaM.Register[state, ".maskstroke", MaskStroke]; JaM.Register[state, ".maskstrokeclosed", MaskStrokeClosed]; JaM.Register[state, ".maskrectangle", MaskRectangle]; JaM.Register[state, ".maskvector", MaskVector]; JaM.Register[state, ".startunderline", StartUnderline]; JaM.Register[state, ".maskunderline", MaskUnderline]; JaM.Register[state, ".setamplifyspace", SetAmplifySpace]; JaM.Register[state, ".setpriorityimportant", SetPriorityImportant]; JaM.Register[state, ".correctmask", CorrectMask]; JaM.Register[state, ".correctspace", CorrectSpace]; JaM.Register[state, ".dosave", DoSave]; JaM.Register[state, ".dosaveall", DoSaveAll]; JaM.Register[state, ".correct", Correct]; JaM.Register[state, ".setcorrectmeasure", SetCorrectMeasure]; JaM.Register[state, ".setcorrecttolerance", SetCorrectTolerance]; JaM.Register[state, ".setcorrectshrink", SetCorrectShrink]; JaM.Register[state, ".space", Space]; JaM.Register[state, ".istate", IState]; JaM.Register[state, ".anytorope", AnyToRope]; JaM.Register[state, ".openhornetpd", OpenHornetPD]; JaM.Register[state, ".openplatemakerpd", OpenPlatemakerPD]; JaM.Register[state, ".openravenpd", OpenRavenPD]; JaM.Register[state, ".openversatecpd", OpenVersatecPD]; JaM.Register[state, ".opencolorversatecpd", OpenColorVersatecPD]; JaM.Register[state, ".newtoner", NewToner]; JaM.Register[state, ".newpage", NewPage]; JaM.Register[state, ".closepd", ClosePD]; JaM.Register[state, ".nsrsetfont", NSRSetFont]; JaM.Register[state, ".show", Show]; JaM.Register[state, ".ddt", Ddt]; JaM.Register[state, ".setlinescreen", SetLineScreen]; JaM.Register[state, ".setdotscreen", SetDotScreen]; JaM.Register[state, ".setcustomscreen", SetCustomScreen]; JaM.Register[state, ".setaisscreen", SetAISScreen]; JaM.Register[state, ".imagerreset", ImagerReset]; JaM.Register[state, ".trunc", Trunc]; JaM.Register[state, ".round", Round]; JaM.Register[state, ".floor", Floor]; JaM.Register[state, ".ceil", Ceil]; }; END. k ªImagerJaM.mesa Copyright (C) 1984, Xerox Corporation. All rights reserved. Michael Plass, July 12, 1984 3:17:01 pm PDT Maureen Stone April 6, 1984 2:22:00 pm PST. Êj˜J™J™J˜J˜—šžœœ˜-Jšœ4˜4Jšžœœ>˜IJšœœœ!˜>J˜J˜—šž œœ˜*Jšœ˜Jšœ˜Jšžœœ<˜GJšœ ˜ J˜J˜—šž œœ˜'Jšœ˜Jšœ˜Jšžœœ)˜4Jšœ ˜ J˜J˜—šžœœ˜+Jšžœœ%˜0Jšœ ˜ J˜J˜—šž œœ˜*Jšœœ˜Jšœœ˜šžœœ˜Jšœ˜Jšœ˜—Jšœ ˜ J˜J˜—šžœœ˜,Jšœœ˜Jšžœœ)˜4Jšœ ˜ J˜J˜—šžœœ˜1Jšœœ˜ Jšžœœ.˜9Jšœ ˜ J˜J˜—šž œœ˜(Jšžœœ"˜-Jšœ ˜ J˜J˜—šž œœ˜)Jšœ˜Jšžœœ&˜1Jšœ ˜ J˜J˜—šžœœ˜#Jšœœ˜J˜4Jšžœœ˜&Jšœ/˜/Jšœ œ˜"šœœœ5˜CJšœœ˜šœœ˜Jšœ˜Jšœ˜—Jšœœ˜šœ@œœ˜\Jšœ1˜1šœœœ˜)Jšœ˜Jšœœ˜šœœ˜Jšœ˜J˜—J˜—Jšœ˜Jš˜—J˜—Jšœ˜Jšœ˜J˜J˜—šž œœ˜&Jšœœ˜J˜4Jšžœœ˜&Jšœ/˜/Jšœ œ˜"šœœœ5˜CJšœœ˜šœœ˜Jšœ˜Jšœ˜—Jšœœ˜šœ@œœ˜\Jšœ1˜1šœœœ˜)Jšœ˜Jšœœ˜šœœ˜Jšœ˜J˜—J˜—Jšœ˜Jš˜—J˜—Jšœ˜Jšœ˜J˜J˜—šžœœ˜$Jšœœ˜J˜4Jšžœœ˜&Jšœ/˜/Jšœ œ˜"šœœœ5˜CJšœœ˜šœœ˜Jšœ˜Jšœ˜—Jšœœ˜šœ@œœ˜\Jšœ1˜1šœœœ˜)Jšœ˜Jšœœ˜šœœ˜Jšœ˜J˜—J˜—Jšœ˜Jš˜—J˜—Jšœ˜Jšœ˜J˜J˜—šžœœ˜.Jšœ˜Jšžœœ+˜6Jšœ ˜ J˜J˜—šžœœ˜0Jšœ˜Jšžœœ-˜8Jšœ ˜ J˜J˜—šžœœ˜-Jšœœ˜Jšžœœ*˜5Jšœ ˜ J˜J˜—šžœœ˜"Jšœœ˜Jšžœœ˜*Jšœ ˜ J˜J˜—šžœœ˜#Jš œœœœœ˜šžœœ˜Jšœœ˜Jšœ˜Jšœ˜—Jšœ ˜ Jšœœ˜#J˜J˜—šž œœ˜&Jšœœ˜Jš œœœœœ˜Jšœœ ˜Jšœ˜Jšœœ˜#J˜J˜—šœ5˜5Jšœ œ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ œ˜Jšœ ˜ Jšœ˜J˜—šœ3˜3Jšœ œ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜Jšœ œ˜Jšœ ˜ Jšœ˜J˜—šžœœ œœ(˜UJšœœ5˜@Jšœ˜J˜J˜—šž œœ œœ(˜SJšœœ3˜>Jšœ˜J˜J˜—šžœœ œœ(˜XJšœœ3˜>Jšœ˜Jšœ˜J˜J˜—šž œœ˜)Jšœœ˜!Jšœœ˜(šžœœ˜Jšœ$œ˜Išœ œœ˜Jš œœœ%œœ˜EJšœ˜Jšœ(˜(Jšœ˜—Jšœ˜—Jšœ ˜ J˜J˜—šž œœ˜(Jšœœ˜!Jšœœ˜(Jšœœœœ˜1š ž œœœœ œ˜7Jšœœ˜#Jšœœ˜#Jšœ˜Jšœ˜—šžœœ˜Jšœ$œ˜Išœ œœ˜Jš œœœ%œœ˜EJšœ€˜€Jšœ(˜(Jšœ˜—Jšœ˜—Jšœ ˜ J˜J˜—šžœœ˜+Jšœœ˜Jšœ œ˜%Jšœœ˜'Jšœœ2˜Pšžœœ˜Jšœ$œ˜IJšœ œœ)˜