JaMImagerImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, December 11, 1985 4:31:21 pm PST
Doug Wyatt, July 3, 1985 4:58:15 pm PDT
Tim Diebert: August 1, 1985 12:59:51 pm PDT
Rick Beach, January 18, 1986 12:05:03 pm PST
DIRECTORY
Imager,
ImagerBackdoor,
ImagerColor,
ImagerColorOperator,
ImagerFont,
ImagerPath,
ImagerPixelArray,
ImagerTransformation,
JaM,
JaMIDash,
JaMIPrivate,
Vector2 USING [VEC];
JaMImagerImpl: CEDAR PROGRAM
IMPORTS Imager, ImagerBackdoor, ImagerColor, ImagerColorOperator, ImagerFont, ImagerPath, ImagerPixelArray, ImagerTransformation, JaM, JaMIDash, JaMIPrivate
EXPORTS JaMIPrivate
~ BEGIN OPEN JaM;
VEC: TYPE ~ Vector2.VEC;
PopVec:
PROC [self: State]
RETURNS [
VEC] ~ {
y: REAL ~ PopReal[self]; x: REAL ~ PopReal[self];
RETURN[[x, y]];
};
PopRectangle:
PROC [self: State]
RETURNS [Imager.Rectangle] ~ {
h: REAL ~ PopReal[self]; w: REAL ~ PopReal[self];
y: REAL ~ PopReal[self]; x: REAL ~ PopReal[self];
RETURN[[x, y, w, h]];
};
PopFont:
PROC [self: State]
RETURNS [ImagerFont.Font] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerFont.Font => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopTransformation:
PROC [self: State]
RETURNS [ImagerTransformation.Transformation] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerTransformation.Transformation => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopPixelArray:
PROC [self: State]
RETURNS [ImagerPixelArray.PixelArray] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerPixelArray.PixelArray => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopColor:
PROC [self: State]
RETURNS [ImagerColor.Color] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerColor.Color => RETURN[x];
x: ImagerColor.ConstantColor => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopColorOperator:
PROC [self: State]
RETURNS [ImagerColorOperator.ColorOperator] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerColorOperator.ColorOperator => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopTrajectory:
PROC [self: State]
RETURNS [ImagerPath.Trajectory] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerPath.Trajectory => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PopOutline:
PROC [self: State]
RETURNS [ImagerPath.Outline] ~ {
x: Any ~ Pop[self];
WITH x
SELECT
FROM
x: ImagerPath.Outline => RETURN[x];
ENDCASE => ERROR JaM.Error[WrongType];
};
PushVec:
PROC [self: State, v:
VEC] ~ {
PushReal[self, v.x]; PushReal[self, v.y];
};
PushRectangle:
PROC [self: State, r: ImagerTransformation.Rectangle] ~ {
PushReal[self, r.x]; PushReal[self, r.y];
PushReal[self, r.w]; PushReal[self, r.h];
};
PushFont:
PROC [self: State, x: ImagerFont.Font] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushTransformation:
PROC [self: State, x: ImagerTransformation.Transformation] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushColor:
PROC [self: State, x: ImagerColor.Color] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushColorOperator:
PROC [self: State, x: ImagerColorOperator.ColorOperator] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushPixelArray:
PROC [self: State, x: ImagerPixelArray.PixelArray] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushTrajectory:
PROC [self: State, x: ImagerPath.Trajectory] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
PushOutline:
PROC [self: State, x: ImagerPath.Outline] ~ {
IF x#NIL THEN Push[self, x]
ELSE ERROR JaM.Error[WrongType];
};
GetContext:
PROC [self: State]
RETURNS [Imager.Context] ~ {
info: JaMIPrivate.Info ← JaMIPrivate.GetInfo[self];
IF info = NIL THEN ERROR;
IF info.ipenabled THEN RETURN [info.ipdc];
RETURN[info.vdc];
};
GetInfoFromState:
PROC [self: State]
RETURNS [JaMIPrivate.Info] ~ {
info: JaMIPrivate.Info ← JaMIPrivate.GetInfo[self];
IF info = NIL THEN ERROR;
RETURN[info];
};
ApplyDoSave:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
x: Any ~ Pop[self];
action: PROC ~ { Execute[self, x] };
Imager.DoSave[context, action];
};
ApplyDoSaveAll:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
x: Any ~ Pop[self];
action: PROC ~ { Execute[self, x] };
Imager.DoSaveAll[context, action];
};
ApplyDRound:
PUBLIC
PROC [self: State] ~ {
p: VEC ~ PopVec[self];
PushVec[self, ImagerTransformation.DRound[p]];
};
ApplyMakeT:
PUBLIC
PROC [self: State] ~ {
f: REAL ~ PopReal[self]; e: REAL ~ PopReal[self]; d: REAL ~ PopReal[self];
c: REAL ~ PopReal[self]; b: REAL ~ PopReal[self]; a: REAL ~ PopReal[self];
PushTransformation[self, ImagerTransformation.Create[a, b, c, d, e, f]];
};
ApplyOpenT:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
PushReal[self, m.a]; PushReal[self, m.b]; PushReal[self, m.c];
PushReal[self, m.d]; PushReal[self, m.e]; PushReal[self, m.f];
};
ApplyTranslate:
PUBLIC
PROC [self: State] ~ {
t: VEC ~ PopVec[self];
PushTransformation[self, ImagerTransformation.Translate[t]];
};
ApplyRotate:
PUBLIC
PROC [self: State] ~ {
a: REAL ~ PopReal[self];
PushTransformation[self, ImagerTransformation.Rotate[a]];
};
ApplyScale:
PUBLIC
PROC [self: State] ~ {
s: REAL ~ PopReal[self];
PushTransformation[self, ImagerTransformation.Scale[s]];
};
ApplyScale2:
PUBLIC
PROC [self: State] ~ {
s: VEC ~ PopVec[self];
PushTransformation[self, ImagerTransformation.Scale2[s]];
};
ApplyConcat:
PUBLIC
PROC [self: State] ~ {
n: ImagerTransformation.Transformation ~ PopTransformation[self];
m: ImagerTransformation.Transformation ~ PopTransformation[self];
PushTransformation[self, ImagerTransformation.Concat[m, n]];
};
ApplyInvert:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
PushTransformation[self, ImagerTransformation.Invert[m]];
};
ApplyTransform:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
p: VEC ~ PopVec[self];
PushVec[self, m.Transform[p]];
};
ApplyTransformVec:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
v: VEC ~ PopVec[self];
PushVec[self, m.TransformVec[v]];
};
ApplyRoundXY:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
p: VEC ~ PopVec[self];
PushVec[self, m.RoundXY[p]];
};
ApplyRoundXYVec:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
v: VEC ~ PopVec[self];
PushVec[self, m.RoundXYVec[v]];
};
ApplyConcatT:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
m: ImagerTransformation.Transformation ~ PopTransformation[self];
Imager.ConcatT[context, m];
};
ApplyScaleT:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
s: REAL ~ PopReal[self];
Imager.ScaleT[context, s];
};
ApplyScale2T:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
s: VEC ~ PopVec[self];
Imager.Scale2T[context, s];
};
ApplyRotateT:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
a: REAL ~ PopReal[self];
Imager.RotateT[context, a];
};
ApplyTranslateT:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
t: VEC ~ PopVec[self];
Imager.TranslateT[context, t];
};
ApplyMove:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.Move[context];
};
ApplyTrans:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.Trans[context];
};
ApplySetXY:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetXY[context, PopVec[self]];
};
ApplySetXYRel:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetXYRel[context, PopVec[self]];
};
ApplySetXRel:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetXRel[context, PopReal[self]];
};
ApplySetYRel:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetYRel[context, PopReal[self]];
};
ApplyGetCP:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
PushVec[self, ImagerBackdoor.GetCP[context: context]];
};
ApplyGetCPRounded:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
PushVec[self, ImagerBackdoor.GetCP[context: context, rounded: TRUE]];
};
ApplyFindFont:
PUBLIC
PROC [self: State] ~ {
name: ROPE ~ PopRope[self];
PushFont[self, ImagerFont.Find[name]];
};
ApplyModifyFont:
PUBLIC
PROC [self: State] ~ {
m: ImagerTransformation.Transformation ~ PopTransformation[self];
font: ImagerFont.Font ~ PopFont[self];
PushFont[self, ImagerFont.Modify[font, m]];
};
ApplyScaleFont:
PUBLIC
PROC [self: State] ~ {
s: REAL ~ PopReal[self];
font: ImagerFont.Font ~ PopFont[self];
PushFont[self, ImagerFont.Scale[font, s]];
};
ApplySetFont:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
font: ImagerFont.Font ~ PopFont[self];
info: JaMIPrivate.Info ~ GetInfoFromState[self];
Imager.SetFont[context, font];
info.font ← font;
};
ApplyGetBoundingBox:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
font: ImagerFont.Font ~ GetInfoFromState[self].font;
extents: ImagerFont.Extents ~ ImagerFont.FontBoundingBox[font];
PushReal[self, extents.leftExtent]; PushReal[self, extents.descent];
PushReal[self, extents.rightExtent]; PushReal[self, extents.ascent];
};
ApplyGetTextBox:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
font: ImagerFont.Font ~ GetInfoFromState[self].font;
rope: ROPE ~ PopRope[self];
extents: ImagerFont.Extents ~ ImagerFont.RopeBoundingBox[font, rope];
PushReal[self, extents.leftExtent]; PushReal[self, extents.descent];
PushReal[self, extents.rightExtent]; PushReal[self, extents.ascent];
};
ApplySetAmplifySpace:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetAmplifySpace[context, PopReal[self]];
};
ApplyShowRope:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
rope: ROPE ~ PopRope[self];
Imager.ShowRope[context, rope];
};
ApplyShowXChar:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
lo: CARDINAL ~ PopInt[self];
hi: CARDINAL ~ PopInt[self];
xchar: ImagerFont.XChar ~ [set: hi, code: lo];
Imager.ShowXChar[context, xchar];
};
ApplyStartUnderline:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.StartUnderline[context];
};
ApplyMaskUnderline:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
h: REAL ~ PopReal[self]; dy: REAL ~ PopReal[self];
Imager.MaskUnderline[context, dy, h];
};
ApplyCorrectMask:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.CorrectMask[context];
};
ApplyCorrectSpace:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.CorrectSpace[context, PopVec[self]];
};
ApplySpace:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.Space[context, PopReal[self]];
};
ApplyAmplifiedSpace:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
x: REAL ~ PopReal[self];
amplifySpace: REAL ~ ImagerBackdoor.GetReal[context, $amplifySpace];
Imager.Space[context, x*amplifySpace];
};
ApplySetCorrectMeasure:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetCorrectMeasure[context, PopVec[self]];
};
ApplySetCorrectTolerance:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetCorrectTolerance[context, PopVec[self]];
};
ApplySetCorrectShrink:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetCorrectShrink[context, PopReal[self]];
};
ApplyCorrect:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
x: Any ~ Pop[self];
action: PROC ~ { Execute[self, x] };
Imager.Correct[context, action];
};
ApplyDontCorrect:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
saveCP: BOOL ~ PopBool[self];
x: Any ~ Pop[self];
action: PROC ~ { Execute[self, x] };
Imager.DontCorrect[context, action, saveCP];
};
ApplySetColor:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
color: ImagerColor.Color ~ PopColor[self];
Imager.SetColor[context, color];
};
ApplyMakeGray:
PUBLIC
PROC [self: State] ~ {
f: REAL ~ PopReal[self];
PushColor[self, Imager.MakeGray[f]];
};
ApplySetGray:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
f: REAL ~ PopReal[self];
Imager.SetGray[context, f];
};
ApplyMakeGrayLinearColorModel:
PUBLIC
PROC [self: State] ~ {
colorOperator: ImagerColorOperator.ColorOperator ~ ImagerColorOperator.GrayLinearColorModel[255, 0, 255];
PushColorOperator[self, colorOperator];
};
ApplyMakeRGBLinearColorModel:
PUBLIC
PROC [self: State] ~ {
colorOperator: ImagerColorOperator.ColorOperator ~ ImagerColorOperator.RGBLinearColorModel[255];
PushColorOperator[self, colorOperator];
};
ApplyMakePixelArrayFromAIS:
PUBLIC
PROC [self: State] ~ {
name: ROPE ~ PopRope[self];
PushPixelArray[self, ImagerPixelArray.FromAIS[name]];
};
ApplyMakePixelArrayJoin3AIS:
PUBLIC
PROC [self: State] ~ {
name3: ROPE ~ PopRope[self];
name2: ROPE ~ PopRope[self];
name1: ROPE ~ PopRope[self];
PushPixelArray[self, ImagerPixelArray.Join3AIS[name1, name2, name3]];
};
ApplyPixelArrayBounds:
PUBLIC
PROC [self: State] ~ {
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
r: ImagerTransformation.Rectangle ~ ImagerTransformation.TransformRectangle[pa.m, [0, 0, pa.sSize, pa.fSize]];
PushRectangle[self, r];
};
ApplyPixelArraySamplesPerPixel:
PUBLIC
PROC [self: State] ~ {
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
PushInt[self, pa.samplesPerPixel];
};
ApplyMakeSampledColor:
PUBLIC
PROC [self: State] ~ {
colorOperator: ImagerColorOperator.ColorOperator ~ PopColorOperator[self];
um: ImagerTransformation.Transformation ~ PopTransformation[self];
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
PushColor[self, ImagerColor.MakeSampledColor[pa, um, colorOperator]];
};
ApplyMakeSampledBlack:
PUBLIC
PROC [self: State] ~ {
clear: BOOL ~ PopBool[self];
um: ImagerTransformation.Transformation ~ PopTransformation[self];
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
PushColor[self, ImagerColor.MakeSampledBlack[pa, um, clear]];
};
ApplySetSampledColor:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
colorOperator: ImagerColorOperator.ColorOperator ~ PopColorOperator[self];
m: ImagerTransformation.Transformation ~ PopTransformation[self];
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
Imager.SetSampledColor[context, pa, m, colorOperator];
};
ApplySetSampledBlack:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
clear: BOOL ~ PopBool[self];
m: ImagerTransformation.Transformation ~ PopTransformation[self];
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
Imager.SetSampledBlack[context, pa, m, clear];
};
ApplyLastPoint:
PUBLIC
PROC [self: State] ~ {
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushVec[self, ImagerPath.LastPoint[t]];
};
ApplyMoveTo:
PUBLIC
PROC [self: State] ~ {
p: VEC ~ PopVec[self];
PushTrajectory[self, ImagerPath.MoveTo[p]];
};
ApplyLineTo:
PUBLIC
PROC [self: State] ~ {
p: VEC ~ PopVec[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.LineTo[t, p]];
};
ApplyLineToX:
PUBLIC
PROC [self: State] ~ {
x: REAL ~ PopReal[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.LineToX[t, x]];
};
ApplyLineToY:
PUBLIC
PROC [self: State] ~ {
y: REAL ~ PopReal[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.LineToY[t, y]];
};
ApplyCurveTo:
PUBLIC
PROC [self: State] ~ {
p3: VEC ~ PopVec[self];
p2: VEC ~ PopVec[self];
p1: VEC ~ PopVec[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.CurveTo[t, p1, p2, p3]];
};
ApplyConicTo:
PUBLIC
PROC [self: State] ~ {
r: REAL ~ PopReal[self];
p2: VEC ~ PopVec[self];
p1: VEC ~ PopVec[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.ConicTo[t, p1, p2, r]];
};
ApplyArcTo:
PUBLIC
PROC [self: State] ~ {
p2: VEC ~ PopVec[self];
p1: VEC ~ PopVec[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
PushTrajectory[self, ImagerPath.ArcTo[t, p1, p2]];
};
ApplyMakeOutline:
PUBLIC
PROC [self: State] ~ {
n: INT ~ PopInt[self];
outline: ImagerPath.Outline ~ NEW[ImagerPath.OutlineRep[n]];
FOR i: NAT DECREASING IN[0..outline.size) DO outline[i] ← PopTrajectory[self] ENDLOOP;
PushOutline[self, outline];
};
ApplyMaskFill:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
o: ImagerPath.Outline ~ PopOutline[self];
Imager.MaskFillOutline[context: context, outline: o];
};
ApplyMaskFillParity:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
o: ImagerPath.Outline ~ PopOutline[self];
Imager.MaskFillOutline[context: context, outline: o, parity: TRUE];
};
ApplySetStrokeWidth:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetStrokeWidth[context, PopReal[self]];
};
ApplySetStrokeEnd:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
ImagerBackdoor.SetInt[context, $strokeEnd, PopInt[self]];
};
ApplySetStrokeJoint:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
feature: INT ← PopInt[self];
one: [1..1] ~ ORD[LAST[Imager.StrokeJoint]]; -- bitch when this changes.
IF feature = 2 THEN feature ← 1; -- temporary, until bevel is implemented
ImagerBackdoor.SetInt[context, $strokeJoint, feature];
};
ApplyMaskStroke:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
Imager.MaskStrokeTrajectory[context: context, trajectory: t];
};
ApplyMaskStrokeClosed:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
Imager.MaskStrokeTrajectory[context: context, trajectory: t, closed: TRUE];
};
NarrowToReal:
PROC [any:
REF
ANY]
RETURNS [
REAL] ~ {
WITH any
SELECT
FROM
real: REF REAL => RETURN [real^];
int: REF INT => RETURN [int^];
ENDCASE => ERROR Error[WrongType, "wrong type (pattern array must be numeric)"];
};
ApplyMaskDashedStroke:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
length: REAL ~ PopReal[self];
offset: REAL ~ PopReal[self];
pattern: Array ~ PopArray[self];
pGet: PROC [i: INT] RETURNS [REAL] ~ { RETURN[NarrowToReal[AGet[pattern, i]]] };
t: ImagerPath.Trajectory ~ PopTrajectory[self];
path: ImagerPath.PathProc ~ { ImagerPath.MapTrajectory[trajectory: t,
moveTo: moveTo, lineTo: lineTo, curveTo: curveTo, conicTo: conicTo, arcTo: arcTo] };
JaMIDash.MaskDashedStroke[context: context, path: path, patternSize: pattern.length, pattern: pGet, offset: offset, length: length];
};
ApplyMaskFillTrajectory:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
Imager.MaskFillTrajectory[context: context, trajectory: t];
};
ApplyMaskFillTrajectoryParity:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
t: ImagerPath.Trajectory ~ PopTrajectory[self];
Imager.MaskFillTrajectory[context: context, trajectory: t, parity: TRUE];
};
ApplyMaskRectangle:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.MaskRectangle[context, PopRectangle[self]];
};
ApplyMaskBox:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
ymax: REAL ~ PopReal[self]; xmax: REAL ~ PopReal[self];
ymin: REAL ~ PopReal[self]; xmin: REAL ~ PopReal[self];
Imager.MaskBox[context, [xmin, ymin, xmax, ymax]];
};
ApplyMaskVector:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
p2: VEC ~ PopVec[self]; p1: VEC ~ PopVec[self];
Imager.MaskVector[context, p1, p2];
};
ApplyMaskPixel:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
pa: ImagerPixelArray.PixelArray ~ PopPixelArray[self];
Imager.MaskPixel[context, pa];
};
ApplySetPriorityImportant:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetPriorityImportant[context, PopBool[self]];
};
ApplySetNoImage:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
Imager.SetNoImage[context, PopBool[self]];
};
ApplyClipOutline:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
o: ImagerPath.Outline ~ PopOutline[self];
Imager.ClipOutline[context: context, outline: o];
};
ApplyExcludeOutline:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
o: ImagerPath.Outline ~ PopOutline[self];
Imager.ClipOutline[context: context, outline: o, exclude: TRUE];
};
ApplyClipRectangle:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
r: Imager.Rectangle ~ PopRectangle[self];
Imager.ClipRectangle[context: context, r: r];
};
ApplyExcludeRectangle:
PUBLIC
PROC [self: State] ~ {
context: Imager.Context ~ GetContext[self];
r: Imager.Rectangle ~ PopRectangle[self];
Imager.ClipRectangle[context: context, r: r, exclude: TRUE];
};
RegisterImager:
PUBLIC
PROC [self: State] ~ {
Register[self, ".dosave", ApplyDoSave];
Register[self, ".dosaveall", ApplyDoSaveAll];
Register[self, ".dround", ApplyDRound];
Register[self, ".maket", ApplyMakeT];
Register[self, ".opent", ApplyOpenT];
Register[self, ".translate", ApplyTranslate];
Register[self, ".rotate", ApplyRotate];
Register[self, ".scale", ApplyScale];
Register[self, ".scale2", ApplyScale2];
Register[self, ".concat", ApplyConcat];
Register[self, ".invert", ApplyInvert];
Register[self, ".transform", ApplyTransform];
Register[self, ".transformvec", ApplyTransformVec];
Register[self, ".roundxy", ApplyRoundXY];
Register[self, ".roundxyvec", ApplyRoundXYVec];
Register[self, ".concatt", ApplyConcatT];
Register[self, ".scalet", ApplyScaleT];
Register[self, ".scale2t", ApplyScale2T];
Register[self, ".rotatet", ApplyRotateT];
Register[self, ".translatet", ApplyTranslateT];
Register[self, ".move", ApplyMove];
Register[self, ".trans", ApplyTrans];
Register[self, ".setxy", ApplySetXY];
Register[self, ".setxyrel", ApplySetXYRel];
Register[self, ".setxrel", ApplySetXRel];
Register[self, ".setyrel", ApplySetYRel];
Register[self, ".getcp", ApplyGetCP];
Register[self, ".getcprounded", ApplyGetCPRounded];
Register[self, ".findfont", ApplyFindFont];
Register[self, ".modifyfont", ApplyModifyFont];
Register[self, ".scalefont", ApplyScaleFont];
Register[self, ".setfont", ApplySetFont];
Register[self, ".fontbox", ApplyGetBoundingBox];
Register[self, ".textbox", ApplyGetTextBox];
Register[self, ".setamplifyspace", ApplySetAmplifySpace];
Register[self, ".showrope", ApplyShowRope];
Register[self, ".showxchar", ApplyShowXChar];
Register[self, ".startunderline", ApplyStartUnderline];
Register[self, ".maskunderline", ApplyMaskUnderline];
Register[self, ".correctmask", ApplyCorrectMask];
Register[self, ".correctspace", ApplyCorrectSpace];
Register[self, ".space", ApplySpace];
Register[self, ".amplifiedspace", ApplyAmplifiedSpace];
Register[self, ".setcorrectmeasure", ApplySetCorrectMeasure];
Register[self, ".setcorrecttolerance", ApplySetCorrectTolerance];
Register[self, ".setcorrectshrink", ApplySetCorrectShrink];
Register[self, ".correct", ApplyCorrect];
Register[self, ".dontcorrect", ApplyDontCorrect];
Register[self, ".setcolor", ApplySetColor];
Register[self, ".makegray", ApplyMakeGray];
Register[self, ".setgray", ApplySetGray];
Register[self, ".graylinearcolormodel", ApplyMakeGrayLinearColorModel];
Register[self, ".rgblinearcolormodel", ApplyMakeRGBLinearColorModel];
Register[self, ".pixelarrayfromais", ApplyMakePixelArrayFromAIS];
Register[self, ".pixelarrayfrom3ais", ApplyMakePixelArrayJoin3AIS];
Register[self, ".pixelarraybounds", ApplyPixelArrayBounds];
Register[self, ".pixelarraysamplesperpixel", ApplyPixelArraySamplesPerPixel];
Register[self, ".makesampledcolor", ApplyMakeSampledColor];
Register[self, ".makesampledblack", ApplyMakeSampledBlack];
Register[self, ".setsampledcolor", ApplySetSampledColor];
Register[self, ".setsampledblack", ApplySetSampledBlack];
Register[self, ".lastpoint", ApplyLastPoint];
Register[self, ".moveto", ApplyMoveTo];
Register[self, ".lineto", ApplyLineTo];
Register[self, ".linetox", ApplyLineToX];
Register[self, ".linetoy", ApplyLineToY];
Register[self, ".curveto", ApplyCurveTo];
Register[self, ".conicto", ApplyConicTo];
Register[self, ".arcto", ApplyArcTo];
Register[self, ".makeoutline", ApplyMakeOutline];
Register[self, ".maskfill", ApplyMaskFill];
Register[self, ".maskfillparity", ApplyMaskFillParity];
Register[self, ".maskfilltrajectory", ApplyMaskFillTrajectory];
Register[self, ".maskfilltrajectoryparity", ApplyMaskFillTrajectoryParity];
Register[self, ".setstrokewidth", ApplySetStrokeWidth];
Register[self, ".setstrokeend", ApplySetStrokeEnd];
Register[self, ".setstrokejoint", ApplySetStrokeJoint];
Register[self, ".maskstroke", ApplyMaskStroke];
Register[self, ".maskstrokeclosed", ApplyMaskStrokeClosed];
Register[self, ".maskdashedstroke", ApplyMaskDashedStroke];
Register[self, ".maskrectangle", ApplyMaskRectangle];
Register[self, ".maskbox", ApplyMaskBox];
Register[self, ".maskvector", ApplyMaskVector];
Register[self, ".maskpixel", ApplyMaskPixel];
Register[self, ".setpriorityimportant", ApplySetPriorityImportant];
Register[self, ".setnoimage", ApplySetNoImage];
Register[self, ".clipoutline", ApplyClipOutline];
Register[self, ".excludeoutline", ApplyExcludeOutline];
Register[self, ".cliprectangle", ApplyClipRectangle];
Register[self, ".excluderectangle", ApplyExcludeRectangle];
};
END.