ImagerDefaultImpl.mesa
Created April 8, 1983
Last Edit By:
Plass, April 8, 1983 7:38 pm
Last Edited by: Crow, May 28, 1983 4:39 pm
DIRECTORY Imager, ImagerDefault, Rope, Scaled;
ImagerDefaultImpl: CEDAR PROGRAM
IMPORTS Imager
EXPORTS Imager, ImagerDefault
= BEGIN OPEN ImagerDefault;
NotImplemented: PUBLIC ERROR = CODE;
NotImplementedForThisDevice: PUBLIC ERROR = CODE;
MaskStroke: PUBLIC PROC [context: Context, path: Path] = {
ERROR NotImplemented
};
MaskFill: PUBLIC PROC [context: Context, path: Path] = {
ERROR NotImplemented
};
MaskPixel: PUBLIC PROC [context: Context, pixelArray: PixelArray] = {
ERROR NotImplemented
};
MaskThinLine: PUBLIC PROC [context: Context, p0, p1: FixedVec] = {
ERROR NotImplemented
};
MaskThinStroke: PUBLIC PROC [context: Context, path: Path] = {
ERROR NotImplemented
};
MaskRectangle: PUBLIC PROC [context: Context, r: Rectangle] = {
ERROR NotImplemented
};
ClipArea: PUBLIC PROC [context: Context, path: Path, exclude: BOOLEAN] = {
ERROR NotImplemented
};
ClipRectangle: PUBLIC PROC [context: Context, r: Rectangle, exclude: BOOLEAN] = {
ERROR NotImplemented
};
TestRectangle: PUBLIC PROC [context: Context, r: Rectangle] RETURNS [Visibility] = {
ERROR NotImplemented
};
TestPoint: PUBLIC PROC [context: Context, p: FixedVec] RETURNS [BOOLEAN] = {
ERROR NotImplemented
};
MaskChar: PUBLIC PROC [context: Context, char: CHAR] = {
ERROR NotImplemented
};
MaskCharacters: PUBLIC PROC [context: Context, characters: REF, start: INT ← 0, length: INTLAST[INT]] = {
ERROR NotImplemented
};
MaskCharSeq: PUBLIC PROC [context: Context, length: NAT, charPtr: LONG POINTER TO CHAR, charIncrement: NAT, deltaXptr: LONG POINTER TO FIXED, deltaXincrement: NAT, deltaYptr: LONG POINTER TO FIXED, deltaYincrement: NAT] = {
ERROR NotImplemented
};
NewTransformation: PUBLIC PROC [context: Context] = {
ERROR NotImplemented
};
NewSource: PUBLIC PROC [context: Context] = {
ERROR NotImplemented
};
NewFont: PUBLIC PROC [context: Context] = {
ERROR NotImplemented
};
NewPage: PUBLIC PROC [context: Context] = {
ERROR NotImplemented
};
Destroy: PUBLIC PROC [context: Context] = {
ERROR NotImplemented
};
VideoInvertStroke: PUBLIC PROC [context: Context, path: Path] = {
ERROR NotImplementedForThisDevice
};
VideoInvertArea: PUBLIC PROC [context: Context, path: Path] = {
ERROR NotImplementedForThisDevice
};
VideoInvertPixels: PUBLIC PROC [context: Context, pixelArray: PixelArray] = {
ERROR NotImplementedForThisDevice
};
VideoInvertThinLine: PUBLIC PROC [context: Context, p0, p1: FixedVec] = {
ERROR NotImplementedForThisDevice
};
VideoInvertRectangle: PUBLIC PROC [context: Context, r: Rectangle] = {
ERROR NotImplementedForThisDevice
};
GetImage: PUBLIC PROC [context: Context] RETURNS [SampledSource] = {
ERROR NotImplementedForThisDevice
};
GetMutableImage: PUBLIC PROC [context: Context] RETURNS [SampledSource] = {
ERROR NotImplementedForThisDevice
};
MakeCompatibleContext: PUBLIC PROC [context: Context, boundary: Rectangle] RETURNS [Context] = {
ERROR NotImplementedForThisDevice
};
MaskConstantRuns: PUBLIC PROC [context: Context, sMin, sSize: CARDINAL, map: PROC[PROC[s, fMin, fSize: CARDINAL]]] = {
color: Imager.Color ← context.currentSource.constantSource;
RunProc: PROC[s, fMin, fSize: CARDINAL] = {
FOR f: CARDINAL IN [fMin..fMin+fSize] DO
context.procs.MaskSinglePixel[context, color, s, f];
ENDLOOP;
};
IF context.currentSource.sampledSource # NIL THEN ERROR;
map[RunProc];
};
MaskSampledRuns: PUBLIC PROC [context: Context, samples: SampleSequence, sMin, sSize: CARDINAL, map: PROC[PROC[s, fMin, fSize: CARDINAL]]] = {
sampledSource: Imager.SampledSource ← context.currentSource.sampledSource;
IF sampledSource = NIL THEN ERROR
ELSE {
colorModelRec: Imager.ColorModelRec ← Imager.FindColorModel[sampledSource.colorModel];
RunProc: PROC[s, fMin, fSize: CARDINAL] = {
FOR f: CARDINAL IN [fMin..fMin+fSize] DO
pixelValue: LONG CARDINAL ← samples.seq[f-fMin];
color: Imager.Color ← colorModelRec.colorModelProc[pixelValue, colorModelRec.colorModelData];
context.procs.MaskSinglePixel[context, color, s, f];
ENDLOOP;
};
map[RunProc];
};
};
MaskConstantPixels: PUBLIC PROC [context: Context, mask: PixelSequence, sMin, sSize: CARDINAL, map: PROC[PROC[s, fMin, fSize: CARDINAL]]] = {
color: Imager.Color ← context.currentSource.constantSource;
RunProc: PROC[s, fMin, fSize: CARDINAL] = {
FOR f: CARDINAL IN [fMin..fMin+fSize] DO
IF mask.seq[f-fMin] = 1 THEN context.procs.MaskSinglePixel[context, color, s, f];
ENDLOOP;
};
IF context.currentSource.sampledSource # NIL THEN ERROR;
map[RunProc];
};
MaskSampledPixels: PUBLIC PROC [context: Context, mask: PixelSequence, samples: SampleSequence, sMin, sSize: CARDINAL, map: PROC[PROC[s, fMin, fSize: CARDINAL]]] = {
sampledSource: Imager.SampledSource ← context.currentSource.sampledSource;
IF sampledSource = NIL THEN ERROR
ELSE {
colorModelRec: Imager.ColorModelRec ← Imager.FindColorModel[sampledSource.colorModel];
RunProc: PROC[s, fMin, fSize: CARDINAL] = {
FOR f: CARDINAL IN [fMin..fMin+fSize] DO
IF mask.seq[f-fMin] = 1 THEN {
pixelValue: LONG CARDINAL ← samples.seq[f-fMin];
color: Imager.Color ← colorModelRec.colorModelProc[pixelValue, colorModelRec.colorModelData];
context.procs.MaskSinglePixel[context, color, s, f];
};
ENDLOOP;
};
map[RunProc];
};
};
MaskSinglePixel: PUBLIC PROC [context: Context, pixelValue: Color, s, f: CARDINAL] = {
ERROR NotImplemented
};
DefaultProcs: PUBLIC PROC RETURNS [Procs] = {
RETURN [NEW[Imager.ProcsRec ← [
MaskStroke: ImagerDefault.MaskStroke,
MaskFill: ImagerDefault.MaskFill,
MaskThinLine: ImagerDefault.MaskThinLine,
MaskThinStroke: ImagerDefault.MaskThinStroke,
MaskRectangle: ImagerDefault.MaskRectangle,
ClipArea: ImagerDefault.ClipArea,
ClipRectangle: ImagerDefault.ClipRectangle,
TestRectangle: ImagerDefault.TestRectangle,
TestPoint: ImagerDefault.TestPoint,
MaskChar: ImagerDefault.MaskChar,
MaskCharacters: ImagerDefault.MaskCharacters,
MaskCharSeq: ImagerDefault.MaskCharSeq,
NewTransformation: ImagerDefault.NewTransformation,
NewSource: ImagerDefault.NewSource,
NewFont: ImagerDefault.NewFont,
NewPage: ImagerDefault.NewPage,
Destroy: ImagerDefault.Destroy,
VideoInvertStroke: ImagerDefault.VideoInvertStroke,
VideoInvertArea: ImagerDefault.VideoInvertArea,
VideoInvertPixels: ImagerDefault.VideoInvertPixels,
VideoInvertThinLine: ImagerDefault.VideoInvertThinLine,
VideoInvertRectangle: ImagerDefault.VideoInvertRectangle,
GetImage: ImagerDefault.GetImage,
GetMutableImage: ImagerDefault.GetMutableImage,
MakeCompatibleContext: ImagerDefault.MakeCompatibleContext,
MaskConstantRuns: ImagerDefault.MaskConstantRuns,
MaskSampledRuns: ImagerDefault.MaskSampledRuns,
MaskConstantPixels: ImagerDefault.MaskConstantPixels,
MaskSampledPixels: ImagerDefault.MaskSampledPixels,
MaskSinglePixel: ImagerDefault.MaskSinglePixel
]]];
};
END.