DIRECTORY IO USING [STREAM], Rope USING [ROPE], Terminal USING [BWCursorBitmap]; SirPress: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; pt: INT = (25400000/72)+1; -- a 72 per inch point, used for PARC fonts texpt: INT = 351460; -- a 72.27 per inch point, used for TEX fonts in: INT = 25400000; -- an inch mm: INT = 1000000; cm: INT = 10000000; mica: INT = 10000; -- a mica PrintingMode: TYPE = {normal, reverse, solid, transparent}; tShirt: PrintingMode = reverse; PressStateVector: TYPE; PressHandle: TYPE = REF PressStateVector; CursorObject: TYPE = REF CursorObjectRec; CursorObjectRec: TYPE = RECORD[ cursorProc: CursorProc, clientData: REF ANY ]; CursorProc: TYPE = PROC [clientData: REF ANY, bits: REF Terminal.BWCursorBitmap]; NewPressHandle: PROC [pressFileName: ROPE] RETURNS [PressHandle]; Create: PUBLIC PROC [ outputStream: STREAM, fileNameForHeaderPage: ROPE _ NIL, creatorName: ROPE _ NIL, printingMode: PrintingMode _ normal, cursorObject: CursorObject _ NIL] -- Starts making a new press file RETURNS [p: PressHandle]; SetPageSize: PUBLIC PROC [ -- applies for the current and following pages. Setting width bigger than hieght will result in landscape output. p: PressHandle, height: INT _ 110, width: INT _ 85, unit: INT _ in/10]; SetSpace: PUBLIC PROC [ p: PressHandle, xSpace: INT, ySpace: INT _ 0, unit: INT _ mica]; ResetSpace: PUBLIC PROC [p: PressHandle]; PutSpace: PUBLIC PROC [p: PressHandle]; SetColor: PUBLIC PROC [p: PressHandle, hue, saturation, brightness: INT]; SetHue: PUBLIC PROC [p: PressHandle, hue: INT]; SetSaturation: PUBLIC PROC [p: PressHandle, saturation: INT]; SetBrightness: PUBLIC PROC [p: PressHandle, brightness: INT]; SetFont: PUBLIC PROC [ p: PressHandle, family: ROPE, size: INT, face: INT _ 0, rotation: INT _ 0, unit: INT _ pt -- unit for size, in nanometers--]; PutText: PUBLIC PROC [ p: PressHandle, textString: ROPE, xCoordinateOfLeftEdge: INT, yCoordinateOfBaseline: INT, unit: INT _ mica]; PutTextHere: PUBLIC PROC [ p: PressHandle, textString: ROPE]; PutRectangle: PUBLIC PROC [ p: PressHandle, xstart, ystart, xlen, ylen: INT, unit: INT _ mica]; PutRectangleHere: PUBLIC PROC [p: PressHandle, xlen, ylen: INT, unit: INT _ mica]; WritePage: PUBLIC PROC [p: PressHandle]; ClosePress: PUBLIC PROC [p: PressHandle]; ScanLine: TYPE = RECORD [ pixels: SELECT coding: DotCoding FROM bitMap => [bit: PACKED SEQUENCE length: NAT OF [0..1]], packedMap => [bitWord: SEQUENCE length: NAT OF CARDINAL], bitSampled => [intensity: PACKED SEQUENCE length: NAT OF [0..2)], bitBitSampled=>[intensity: PACKED SEQUENCE length: NAT OF [0..4)], nybbleSampled=>[intensity: PACKED SEQUENCE length: NAT OF [0..16)], byteSampled => [intensity: PACKED SEQUENCE length: NAT OF [0..256)] ENDCASE ]; Direction: TYPE = MACHINE DEPENDENT {right(0), left(1), up(2), down(3)}; DotCoding: TYPE = {bitMap, bitSampled, bitBitSampled, nybbleSampled, byteSampled, packedMap}; BeginScannedRectangle: PROC [ p: PressHandle, x, y: INT, -- coordinate of lower left corner dotsPerLine: INT, numberOfLines: INT, width: INT _ -1, height: INT _ -1, unit: INT _ mica, nextLineDirection: Direction _ down, nextDotDirection: Direction _ right, coding: DotCoding _ bitMap, samplingProperties: SamplingProperties _ [omitted: TRUE] ]; SamplingProperties: TYPE = RECORD [ -- For fine control of the halftone screens omitted: BOOLEAN _ FALSE, screenAngle: INT _ 0, screenAmplitude: INT _ 100, screenFrequency: INT _ 85, minIntensity: INT _ 0, maxIntensity: INT _ 255 ]; ShowLine: PROC [p: PressHandle, s: REF ScanLine]; UnsafeShowLine: UNSAFE PROC [p: PressHandle, dataPointer: LONG POINTER]; EndScannedRectangle: PROC [p: PressHandle]; StartOutline: PUBLIC PROC [p: PressHandle]; PutMoveTo: PUBLIC PROC [p: PressHandle, x, y: INT, unit: INT _ mica]; PutDrawTo: PUBLIC PROC [p: PressHandle, x, y: INT, unit: INT _ mica]; PutCubic: PUBLIC PROC [p: PressHandle, x1, y1, x2, y2, x3, y3: REAL, unit: INT _ mica]; EndOutline: PUBLIC PROC [p: PressHandle]; FontCode: TYPE = NAT _ 0; GetFontCode: PUBLIC PROC [ p: PressHandle, family: ROPE, size: INT, face: INT _ 0, rotation: INT _ 0, unit: INT _ pt -- unit for size, in nanometers--] RETURNS [FontCode]; SetFontFromCode: PUBLIC PROC [p: PressHandle, f: FontCode]; Pipe: TYPE = REF PipeRec; NewPipe: PUBLIC PROC [maximumNumberOfSpacesInPipe: INT _ 200] RETURNS [Pipe]; OpenPipe: PUBLIC PROC [p: PressHandle, pipe: Pipe]; PipeChar: PUBLIC PROCEDURE [pipe: Pipe, c: CHARACTER] = INLINE {OPEN pipe^; i:NAT _ text.length; text.length _ i + 1; text[i] _ c}; PipePosition: PUBLIC PROCEDURE [pipe: Pipe, x: INTEGER] = INLINE BEGIN OPEN pipe^; i:NAT _ scount; scount_i+1; slist[i] _ [text.length, x] END; ClosePipe: PUBLIC PROCEDURE [ p: PressHandle, pipe: Pipe, y: INTEGER ]; PipeRec: TYPE = RECORD [text: REF TEXT _ NIL, scount: NAT _ 0, slist: SEQUENCE maxscount: NAT OF CharPtrAndPosition--couldntresistreadingthiscouldya--]; CharPtrAndPosition: TYPE = RECORD [charPtr: NAT, x: INTEGER]; END. Michael Plass, October 21, 1982 2:46 pm: Added SetSamplingProperties. Michael Plass, October 25, 1982 10:55 am: Fixed up formatting of source. Michael Plass, November 1, 1982 9:50 am: Removed Transaction import. Michael Plass, November 3, 1982 10:27 am: Replaced cursor proc with cursor object. Michael Plass, November 15, 1982 11:26 am: Added UnsafeShowLine. Michael Plass, November 16, 1982 10:49 am: Put portrait/landscape logic into SetPageSize. Michael Plass, November 15, 1983 10:25 am: Cedar 5.0 conversion. úSirPress.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by Michael Plass, March 12, 1985 1:26:32 pm PST Press File Interface Written by Michael Plass Implementation: SirPressImpl.mesa Interface adapted from the PressIO package written by Joe Maleson. Types and constants The following units are expressed in nanometers SirPress provides a thumbnail sketch of the page as it is built, which the client has the option of displaying as feedback for the user. Since the image is a 16 by 16 bitmap, it is called a cursor. The CursorObject provides a procedure to call, along with a REF to client data. A call with NIL is done at the end to reset the display. Basic operations Warning: resets the space size. Showing sampled images To allocate a new scan line variable, say, for instance, sl: REF bitMap ScanLine _ NEW[ScanLine[bitMap][128]]; this will give you a scan line 128 bits long. By using automatic dereferencing, you can say things like sl[20]_0 or sl[20]_1 to set the values of the elements. The packedBits variant is provided where efficiency is important; note the length must be specified in words, not bits, for this variant. Note that, although the press format allows scan lines to be any length, the implementation restricts the length to be a multiple of 16 bits. As an alternative, a client may send the scanlines by setting up a long pointer to the data and calling UnsafeShowLine. The number of bits per sample and the number of samples per scanline must be chosen so that each scanline ends up on a word boundary. Although unsafe, this is not really a very risky way of doing business, since the data pointed to is only read, never written. Showing outlined areas The remaining calls are for fast character-oriented output of text and glue. Opens a pipe that can subsequently be used with PipeChar to send a char at a time to the press file. While a pipe is open, the only operations allowed are PipeChar and PipePosition; in particular, you must close the pipe to change fonts. All positioning (incuding spacing) should be done using PipePosition. The position is always specified in micas. in micas; all chars on the same line This operation closes the pipe, adding its contents to the press file. Users shouldn't read past here. Êè– "Cedar" style˜šÏc ™ Icodešœ Ïmœ1™JšœŸœ Ÿœ2˜DJ˜—š   œŸœŸ œŸœŸ˜@J™*JšŸœŸœ˜JšœŸœ ˜J˜ J˜JšŸœ˜J˜—š  œŸœŸ œ˜J˜J˜ šœŸ˜ Jšœ$™$—Jšœ˜JšF™F—J˜—Jš™Jšœ ŸœŸœŸœŸœŸœ Ÿœ Ÿœ ŸœŸœ#œ˜˜Jš œŸœŸœ ŸœŸœ˜>J˜JšŸœ˜J˜J˜EJ˜HJ˜DJ˜RJšœ@˜@JšœY˜YJšœ@˜@—…—š'|