<> <> <> <> <<>> <> DIRECTORY Convert, FS, Imager, ImagerColor, ImagerColorFns, ImagerFont, ImagerInterpress, ImagerPath, Interpress, IO, NectarineAids, Real, Rope, TerminalIO, UserCredentials; NectarineAidsImpl: CEDAR PROGRAM IMPORTS Convert, FS, Imager, ImagerColorFns, ImagerFont, ImagerInterpress, ImagerPath, Interpress, IO, Real, Rope, TerminalIO, UserCredentials EXPORTS NectarineAids ~ BEGIN OPEN Imager, ImagerInterpress; ROPE: TYPE ~ Rope.ROPE; Font: TYPE ~ ImagerFont.Font; margin: REAL _ 5.0; -- in mm width: REAL _ 0.5; -- in mm radius: REAL _ 10.0; regularFace: Font _ ImagerFont.Find ["Xerox/PressFonts/Modern-MRR", substituteQuietly]; boldFace: Font _ ImagerFont.Find ["Xerox/PressFonts/Modern-BRR", substituteQuietly]; italicFace: Font _ ImagerFont.Find ["Xerox/PressFonts/Modern-MIR", substituteQuietly]; ComposeFrame: PROC [caption: ROPE] ~ BEGIN <> <7.0>Commands>gbbFrame.Interpress; Echo SendIPMaster -h Foo -c 1 ///Temp/Temp-gbb.Interpress>> lc: Context; -- local context name: ROPE ~ "[]<>7.0>Commands>gbbFrame.Interpress"; master: ImagerInterpress.Ref ~ ImagerInterpress.Create [name]; fontI: Font ~ italicFace.Scale [3.0]; t: ImagerPath.Trajectory; midPoint: REAL ~ radius * 0.7071068; compl: REAL ~ radius - midPoint; SetPage: PROC ~ BEGIN bottomLeft: VEC ~ [0.0 + margin, 0.0 + margin]; bottomRight: VEC ~ [215.9 - margin, 0.0 + margin]; topRight: VEC ~ [215.9 - margin, 279.4 - margin]; topLeft: VEC ~ [0.0 + margin, 279.4 - margin]; pos, next: VEC; lc.SetStrokeWidth [width]; lc.SetFont [fontI]; pos _ [bottomLeft.x + 30.0 + 3.0, bottomLeft.y]; lc.SetXY [pos]; lc.ShowRope [caption]; pos.x _ pos.x + 3.0 + ImagerFont.RopeEscapement [fontI, caption].x; t _ ImagerPath.MoveTo [pos]; pos.x _ bottomRight.x - radius; t _ t.LineTo [pos]; next _ bottomRight; next.y _ next.y + radius; pos _ [pos.x + midPoint, pos.y + compl]; t _ t.ArcTo [pos, next]; pos _ topRight; pos.y _ pos.y - radius; t _ t.LineTo [pos]; next _ topRight; next.x _ next.x - radius; pos _ [pos.x - compl, pos.y + midPoint]; t _ t.ArcTo [pos, next]; pos _ topLeft; pos.x _ pos.x + radius; t _ t.LineTo [pos]; next _ topLeft; next.y _ next.y - radius; pos _ [pos.x - midPoint, pos.y - compl]; t _ t.ArcTo [pos, next]; pos _ bottomLeft; pos.y _ pos.y + radius; t _ t.LineTo [pos]; next _ bottomLeft; next.x _ next.x + radius; pos _ [pos.x + compl, pos.y - midPoint]; t _ t.ArcTo [pos, next]; pos _ [bottomLeft.x + 30.0 , bottomLeft.y]; t _ t.LineTo [pos]; lc.MaskStrokeTrajectory [t] END; DrawToIP: PROC [context: Imager.Context] ~ {lc _ context; context.DoSave [SetPage]}; master.DeclareFont [fontI]; master.DoPage [action: DrawToIP, scale: 0.001]; -- millimetres master.Close [] END; -- ComposeFrame AFrame: PROC ~ BEGIN <> lc: Context; -- local context name: ROPE ~ "[]<>7.0>Commands>AFrame.Interpress"; master: ImagerInterpress.Ref ~ ImagerInterpress.Create [name]; SetPage: PROC ~ BEGIN lc.SetStrokeWidth [0.0]; lc.MaskVector [[0.0, 0.0], [215.9, 0.0]]; lc.MaskVector [[215.9, 0.0], [215.9, 279.4]]; lc.MaskVector [[215.9, 279.4], [0.0, 279.4]]; lc.MaskVector [[0.0, 279.4], [0.0, 0.0]] END; DrawToIP: PROC [context: Imager.Context] ~ {lc _ context; context.DoSave [SetPage]}; master.DoPage [action: DrawToIP, scale: 0.001]; -- millimetres master.Close [] END; -- AFrame MakeCircle: PROC [c: VEC, r: REAL] RETURNS [circle: ImagerPath.Trajectory] ~ BEGIN <<... at center c with radius r.>> IF (r < 0) THEN ERROR; IF (r = 0) THEN RETURN [NIL]; circle _ ImagerPath.MoveTo [[c.x+r, c.y]]; circle _ circle.ArcTo [[c.x-r, c.y], [c.x+r, c.y]] END; -- MakeCircle ComposeCenterAndCropMarks: PUBLIC PROC [context: Context _ NIL] ~ BEGIN <> <> lc: Context; -- local context master: ImagerInterpress.Ref; name: ROPE ~ "[]<>7.0>Commands>CenterAndCropMarks.Interpress"; cmykBlack: Color ~ ImagerColorFns.ColorFromCMYK [[1.0, 1.0, 1.0, 1.0]]; cm: REAL ~ 10.0; halfCm: REAL ~ 5.0; strokeWidth: REAL ~ 0.2; bb: Rectangle ~ [x: 0.0, y: 0.0, w: 215.9, h: 279.4]; SetPage: PROC ~ BEGIN lc.SetStrokeJoint [miter]; lc.SetStrokeEnd [butt]; lc.SetStrokeWidth [strokeWidth]; lc. SetColor [cmykBlack]; <> <> lc.MaskVector [[bb.x+bb.w/2.0, bb.y-cm], [bb.x+bb.w/2.0, bb.y-1.0]]; lc.MaskVector [[bb.x+bb.w+1.0, bb.y+bb.h/2.0], [bb.x+bb.w+cm, bb.y+bb.h/2.0]]; lc.MaskVector [[bb.x+bb.w/2.0, bb.y+bb.h+cm], [bb.x+bb.w/2.0, bb.y+bb.h+1.0]]; lc.MaskVector [[bb.x-cm, bb.y+bb.h/2.0], [bb.x-1.0, bb.y+bb.h/2.0]]; <> <> lc.MaskVector [[bb.x-1.0, bb.y], [bb.x-cm, bb.y]]; lc.MaskVector [[bb.x+bb.w+cm, bb.y], [bb.x+bb.w+1.0, bb.y]]; <> lc.MaskVector [[bb.x+bb.w, bb.y-1.0], [bb.x+bb.w, bb.y-cm]]; lc.MaskVector [[bb.x+bb.w, bb.y+bb.h+cm], [bb.x+bb.w, bb.y+bb.h+1.0]]; <> lc.MaskVector [[bb.x+bb.w+1.0, bb.y+bb.h], [bb.x+bb.w+cm, bb.y+bb.h]]; lc.MaskVector [[bb.x-1.0, bb.y+bb.h], [bb.x-cm, bb.y+bb.h]]; <> lc.MaskVector [[bb.x, bb.y+bb.h+1.0], [bb.x, bb.y+bb.h+cm]]; lc.MaskVector [[bb.x, bb.y-1.0], [bb.x, bb.y-cm]]; <> <> <> <> <> END; -- SetPage DrawToIP: PROC [context: Imager.Context] ~ {lc _ context; context.DoSave [SetPage]}; IF (context = NIL) THEN BEGIN master _ ImagerInterpress.Create [name]; master.DeclareColorOperator [ImagerColorFns.NewColorOperatorCMYK [1000]]; master.DeclareColor [cmykBlack]; master.DoPage [action: DrawToIP, scale: 0.001]; -- millimetres master.Close [] END ELSE {lc _ context; context.DoSave [SetPage]} END; -- ComposeCenterAndCropMarks ComposeRegisterMarks: PUBLIC PROC [creator: ROPE _ NIL, process: BOOL _ TRUE, context: Context _ NIL] ~ BEGIN <> <> lc: Context; -- local context master: ImagerInterpress.Ref; name: ROPE ~ "[]<>7.0>Commands>RegisterMarks.Interpress"; creatorLabel: ROPE; blackBlack: Color ~ ImagerColorFns.ColorFromCMYK [[0.0, 0.0, 0.0, 1.0]]; cmykBlack: Color ~ ImagerColorFns.ColorFromCMYK [[1.0, 1.0, 1.0, 1.0]]; cyan: Color ~ ImagerColorFns.ColorFromCMYK [[1.0, 0.0, 0.0, 0.0]]; magenta: Color ~ ImagerColorFns.ColorFromCMYK [[0.0, 1.0, 0.0, 0.0]]; yellow: Color ~ ImagerColorFns.ColorFromCMYK [[0.0, 0.0, 1.0, 0.0]]; cm: REAL ~ 10.0; halfCm: REAL ~ 5.0; strokeWidth: REAL ~ 0.2; bb: Rectangle ~ [x: 0.0, y: 0.0, w: 215.9, h: 279.4]; large: Font ~ regularFace.Scale [cm]; small: Font ~ regularFace.Scale [halfCm]; SetPage: PROC ~ BEGIN x, y: REAL; circle: ImagerPath.Trajectory; inkC, inkM, inkY, inkK: ROPE; SetCross: PROC [x, y: REAL] ~ BEGIN <> lc.MaskRectangle [[x: x, y: y+halfCm, w: cm, h: strokeWidth]]; lc.MaskRectangle [[x: x+halfCm, y: y, w: strokeWidth, h: cm]] END; -- SetCross lc.SetStrokeJoint [miter]; lc.SetStrokeEnd [butt]; lc.SetStrokeWidth [strokeWidth]; lc. SetColor [cmykBlack]; lc.SetFont [small]; <> <> lc.MaskVector [[bb.x+bb.w/2.0, bb.y-cm], [bb.x+bb.w/2.0, bb.y-1.0]]; lc.MaskVector [[bb.x+bb.w+1.0, bb.y+bb.h/2.0], [bb.x+bb.w+cm, bb.y+bb.h/2.0]]; lc.MaskVector [[bb.x+bb.w/2.0, bb.y+bb.h+cm], [bb.x+bb.w/2.0, bb.y+bb.h+1.0]]; lc.MaskVector [[bb.x-cm, bb.y+bb.h/2.0], [bb.x-1.0, bb.y+bb.h/2.0]]; <> <> lc.MaskVector [[bb.x-1.0, bb.y], [bb.x-cm, bb.y]]; lc.MaskVector [[bb.x+bb.w+cm, bb.y], [bb.x+bb.w+1.0, bb.y]]; <> lc.MaskVector [[bb.x+bb.w, bb.y-1.0], [bb.x+bb.w, bb.y-cm]]; lc.MaskVector [[bb.x+bb.w, bb.y+bb.h+cm], [bb.x+bb.w, bb.y+bb.h+1.0]]; <> lc.MaskVector [[bb.x+bb.w+1.0, bb.y+bb.h], [bb.x+bb.w+cm, bb.y+bb.h]]; lc.MaskVector [[bb.x-1.0, bb.y+bb.h], [bb.x-cm, bb.y+bb.h]]; <> lc.MaskVector [[bb.x, bb.y+bb.h+1.0], [bb.x, bb.y+bb.h+cm]]; lc.MaskVector [[bb.x, bb.y-1.0], [bb.x, bb.y-cm]]; <> <> <> <> <> <> circle _ MakeCircle [[-halfCm+1.0, -halfCm+1.0], halfCm]; SetCross [-cm+1.0, -cm+1.0]; lc.MaskStrokeTrajectory [circle]; circle _ MakeCircle [[bb.x+bb.w+halfCm, -halfCm+1.0], halfCm]; SetCross [bb.x+bb.w, -cm+1.0]; lc.MaskStrokeTrajectory [circle]; circle _ MakeCircle [[bb.x+bb.w+halfCm, bb.y+bb.h+halfCm-1.0], halfCm]; SetCross [bb.x+bb.w, bb.y+bb.h-1.0]; lc.MaskStrokeTrajectory [circle]; circle _ MakeCircle [[-halfCm+1.0, bb.y+bb.h+halfCm-1.0], halfCm]; SetCross [-cm+1.0, bb.y+bb.h-1.0]; lc.MaskStrokeTrajectory [circle]; <> x _ cm; y _ bb.y + bb.h + 1.0; lc.SetColor [cyan]; lc.MaskRectangle [[x: x, y: y, w: cm, h: halfCm]]; lc.SetColor [magenta]; x _ x + 1.2 * cm; lc.MaskRectangle [[x: x, y: y, w: cm, h: halfCm]]; lc.SetColor [yellow]; x _ x + 1.2 * cm; lc.MaskRectangle [[x: x, y: y, w: cm, h: halfCm]]; lc.SetColor [blackBlack]; x _ x + 1.2 * cm; lc.MaskRectangle [[x: x, y: y, w: cm, h: halfCm]]; lc.SetColor [cmykBlack]; lc.SetXY [[x + 1.5 * cm, y]]; lc.ShowRope ["100%"]; <> <> <> <> <> <> <> <> <> <> <> <