ImagerPDImpl.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Michael Plass, June 22, 1984 9:41:51 am PDT
Doug Wyatt, March 7, 1985 6:30:09 pm PST
DIRECTORY
Imager USING [Class, Context, ContextRep],
ImagerDevice USING [Device],
ImagerPD USING [PDParameters],
ImagerPDDevice USING [Create],
ImagerRaster USING [CreateClass],
ImagerRasterPrivate USING [CreateData, Data],
PDFileWriter USING [Create, DeviceCode, PDState],
Rope USING [ROPE];
ImagerPDImpl: CEDAR PROGRAM
IMPORTS ImagerPDDevice, ImagerRaster, ImagerRasterPrivate, PDFileWriter
EXPORTS ImagerPD
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
Context: TYPE ~ Imager.Context;
DeviceCode: TYPE ~ PDFileWriter.DeviceCode;
pdClass: Imager.Class ~ ImagerRaster.CreateClass[$PD];
Create: PUBLIC PROC[fileName: ROPE, printer: Printer] RETURNS[Context] ~ {
SELECT printer FROM
raven => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[raven].ORD,
sResolution: 300, fResolution: 300,
imageSSize: 300*8+300/2, imageFSize: 300*11, -- 8.5 by 11 inches
nColors: 1, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
hornet => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[hornet].ORD,
sResolution: 384, fResolution: 384,
imageSSize: 384*8+384/2, imageFSize: 384*11, -- 8.5 by 11 inches
nColors: 1, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
gnat => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[gnat].ORD,
sResolution: 384, fResolution: 384,
imageSSize: 384*11, imageFSize: 384*14, -- 11 by 14 inches
nColors: 1, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
plateMaker => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[mig].ORD,
sResolution: 880, fResolution: 880,
imageSSize: 880*11, imageFSize: 880*8+880/2, -- 11 by 8.5 inches
nColors: 1, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
reticleMaker => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[reticleMaker].ORD,
sResolution: 880, fResolution: 880,
imageSSize: 880*10, imageFSize: 880*10, -- 10 by 10 inches ???
nColors: 1, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
These are surely wrong.
puffin => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[puffin].ORD,
sResolution: 384, fResolution: 384,
imageSSize: 384*11, imageFSize: 384*8+384/2, -- 11 by 8.5 inches
nColors: 3, leftovers: TRUE, bandSSize: 16, maxLoadWords: 60000]];
colorVersatec => RETURN[CreateFromParameters[fileName: fileName,
deviceCode: DeviceCode[colorVersatec].ORD,
sResolution: 200, fResolution: 200,
imageSSize: 200*100, imageFSize: 200*40, -- 100 (arbitrary) by 40 inches
nColors: 4, leftovers: FALSE, bandSSize: 64, maxLoadWords: 100000]];
ENDCASE;
ERROR Imager.Error[[$unimplemented, "Unimplemented printer type."]];
};
CreateFromParameters: PUBLIC PROC[fileName: ROPE, deviceCode: CARDINAL,
sResolution, fResolution: CARDINAL, -- pixels per inch
imageSSize, imageFSize: CARDINAL, -- pixels
nColors: CARDINAL, leftovers: BOOL, bandSSize: NAT, maxLoadWords: INT] RETURNS[Context] ~ {
pdState: PDFileWriter.PDState ~ PDFileWriter.Create[
fileName: fileName,
deviceCode: VAL[deviceCode],
sResolution: sResolution,
fResolution: fResolution,
imageSSize: imageSSize,
imageFSize: imageFSize,
bandSSize: bandSSize,
leftOverMode: leftovers,
maxLoadWords: maxLoadWords
];
data.firstToner ← IF desc.nColors = 3 THEN 1 ELSE 0;
data.lastToner ← data.firstToner + desc.nColors - 1;
data.currentToner ← data.lastToner + 1;
device: ImagerDevice.Device ~ ImagerPDDevice.Create[pdState: pdState,
sSize: params.imageSSize, fSize: params.imageFSize,
sPixelsPerInch: params.sResolution, fPixelsPerInch: params.fResolution];
data: ImagerRasterPrivate.Data ~ ImagerRasterPrivate.CreateData[device];
RETURN[NEW[Imager.ContextRep ← [class: pdClass, data: data]]];
};
Close: PUBLIC PROC[context: Context] ~ {
WITH context.data SELECT FROM
data: ImagerRaster.Data => {
data.pdState.EndPage;
data.pdState.Close;
};
ENDCASE => ERROR Imager.Error[$Unimplemented];
};
NewPage: PUBLIC PROC[context: Context] ~ {
WITH context.data SELECT FROM
data: ImagerRaster.Data => {
data.pdState.EndPage;
Reset[context];
data.pdStatePriorityImportant ← 0;
};
ENDCASE => ERROR Imager.Error[$Unimplemented];
};
END.