<<% JaMImager.JaM>> <> <<% last changed by Maureen Stone, January 17, 1984 4:46 pm>> <> <> (graphics) 256 .dict .def graphics .begin (.setcp) {.setxy}.cvx .def <<(.getcp) {.getcp} .cvx .def>> (.rmoveto) {.rsetpos}.cvx .def (twopop){.pop .pop}.cvx .def (TwoPop) { (twopop) .load .def } .cvx .def (.reddown) TwoPop (RedDown) { .reddown } .cvx .def (CtrlRedDown) TwoPop (ShiftRedDown) TwoPop (CtrlShiftRedDown) TwoPop (.redup) TwoPop (RedUp) { .redup } .cvx .def (CtrlRedUp) TwoPop (ShiftRedUp) TwoPop (CtrlShiftRedUp) TwoPop (.yellowdown) TwoPop (YellowDown) { .yellowdown } .cvx .def (CtrlYellowDown) TwoPop (ShiftYellowDown) TwoPop (CtrlShiftYellowDown) TwoPop (.yellowup) TwoPop (YellowUp) { .yellowup } .cvx .def (CtrlYellowUp) TwoPop (ShiftYellowUp) TwoPop (CtrlShiftYellowUp) TwoPop (.bluedown) TwoPop (BlueDown) { .bluedown } .cvx .def (CtrlBlueDown) TwoPop (ShiftBlueDown) TwoPop (CtrlShiftBlueDown) TwoPop (.blueup) TwoPop (BlueUp) { .blueup } .cvx .def (CtrlBlueUp) TwoPop (ShiftBlueUp) TwoPop (CtrlShiftBlueUp) TwoPop (.track) TwoPop (Track) { .track } .cvx .def (CtrlTrack) TwoPop (ShiftTrack) TwoPop (CtrlShiftTrack) TwoPop (.interrupt){.stop}.cvx .def <> (squareend) {0 .setstrokeend}.cvx .def (buttend) {1 .setstrokeend}.cvx .def (roundend) {2 .setstrokeend}.cvx .def <> (miteredjoint) {0 .setstrokejoint}.cvx .def (beveljoint) {1 .setstrokejoint}.cvx .def (roundjoint) {2 .setstrokejoint}.cvx .def <<>> <<>> <<>> (wh){white}0 .aget .def (gr){gray}0 .aget .def (bl){black}0 .aget .def (m){.touch .setcp}.cvx .def (t){.touch .translatet}.cvx .def (e){.erase}.cvx .def (box){.touch 2 .copy .touch .v2sub .maskrectangle}.cvx .def (cbox){.touch 2 .copy .touch .v2sub .cliprectangle .erase}.cvx .def (cxbox){.touch 2 .copy .touch .v2sub .cliprectangle .erase}.cvx .def (traj){.touch .moveto .exch 1 .sub {.touch .lineto}.cvx .rept}.cvx .def (area){traj 1 .makeoutline .maskfill}.cvx .def (carea){traj 1 .makeoutline .clipoutline .erase}.cvx .def (cxarea){traj 1 .makeoutline .clipoutline .erase}.cvx .def (stroke){round .setstrokeend traj .maskstroke}.cvx .def % round ends <<(dot){2 .copy .moveto 2 .copy .lineto}.cvx .def>> <<>> <<(spline){{.touch dot .knot}.cvx .rept .spline}.cvx .def>> <<(cspline){{.touch dot .knot}.cvx .rept .cspline}.cvx .def>> <<>> <<(curve){spline 2 .drawstroke}.cvx .def % round ends>> <<(ccurve){cspline .close .drawstrokeclosed}.cvx .def>> <<>> <<(blob){cspline .drawarea}.cvx .def>> <<(cblob){cspline .cliparea .erase}.cvx .def>> (spray)(.touch .translatet {120 {0 0 1000 0 .maskvector 3 .rotatet}.cvx .rept}.cvx .dosave).cvx .def (fox)(The quick brown fox jumps over the lazy dog.).def (hi){m (Hello).drawtext}.cvx .def (his){{.mouse .setxy (Hello).drawtext}.cvx .loop}.cvx .def (foxes){{.mouse .setxy fox .drawtext}.cvx .loop}.cvx .def (boxes){{.mouse .translatet -25 0 25 25 .maskrectangle}.cvx .loop}.cvx .def <<(draw){.touch 2 .copy {.mouse .v2exch .maskvector}.cvx .loop}.cvx .def>> <<>> <<(scribble) { (.track) { .drawto } .cvx .def (.reddown) { .setcp } .cvx .def } .cvx .def>> <<(unscribble) { (.track) { .pop .pop } .cvx .def (.reddown) { .pop .pop } .cvx .def } .cvx .def>> <<(grayof) (255.0 .div .grayof).cvx .def>> <<(showr) (1 0 0 .rgbcolor .drawimage).cvx .def>> <<(showg) (0 1 0 .rgbcolor .drawimage).cvx .def>> <<(showb) (0 0 1 .rgbcolor .drawimage).cvx .def>> <<%blue.ais redfile.ais greenfile.ais showimage>> <<(showimage) (0 0 .setcp .true .setopaque showg .false .setopaque showr showb .true .setopaque).cvx .def>> <<>> <<%display the 8 bits/pixel colormap>> <<(map8) (.initdc (cindex) 0 .def 16 (onerow -30 16 .mul 30 .translatet).cvx .rept).cvx .def>> <<%display the 4 bits/pixel colormap>> <<(map4) ((cindex) 0 .def onerow).cvx .def>> <<(cindex) 0 .def>> <<(onerow) (16 (cindex onebox 30 0 .translatet cindex 1 .add (cindex) .exch .store).cvx .rept).cvx .def>> <<(onebox) (.getmapvalue .rgbcolor 0 0 30 30 .drawbox).cvx .def>> %define some color names % .black, .white, .red, .green, .blue, .magenta, .cyan, .yellow, .gray all defined in JaMIColorImpl (black){.black}.cvx .def (white){.white}.cvx .def (gray){.gray}.cvx .def (red){.red}.cvx .def (green){.green}.cvx .def (blue){.blue}.cvx .def (magenta){.magenta}.cvx .def (cyan){.cyan}.cvx .def (yellow){.yellow}.cvx .def (darkBrown) {0.075 .5 0.3 .hsvcolor} .cvx .def (brown) {0.075 .5 .5 .hsvcolor} .cvx .def (tan) {.075 .4 .8 .hsvcolor} .cvx .def (darkRed) {0.0 1.0 0.4 .hsvcolor} .cvx .def (lightRed) {0 .5 1 .hsvcolor} .cvx .def (orange) {0.075 1.0 1.0 .hsvcolor} .cvx .def (darkYellow) {.167 1 .5 .hsvcolor} .cvx .def (lightYellow) {0.167 .6 1.0 .hsvcolor} .cvx .def (darkGreen) {0.333 1.0 0.4 .hsvcolor} .cvx .def (lightGreen) {0.333 0.5 1.0 .hsvcolor} .cvx .def (darkBlue) {0.67 1.0 0.5 .hsvcolor} .cvx .def (lightBlue) {0.67 0.4 1.0 .hsvcolor} .cvx .def (purple) {0.776 1 .8 .hsvcolor} .cvx .def (darkPurple){purple}.cvx .def (violet) {0.776 .5 .8 .hsvcolor} .cvx .def (pink) {0.833 0.4 1.0 .hsvcolor} .cvx .def (darkGray) {0.0 0.0 0.3 .hsvcolor} .cvx .def (darkGray) {0.0 0.0 0.3 .hsvcolor} .cvx .def (lightGrey) {0.0 0.0 0.77 .hsvcolor} .cvx .def (lightGrey) {0.0 0.0 0.77 .hsvcolor} .cvx .def (.drawtext) {.showrope} .cvx .def (.fromais) {.pixelarrayfromais} .cvx .def (.join3ais) {.pixelarrayfrom3ais} .cvx .def <<>> <<(.drawais) {.fromais 1.0 .scale .graylinearcolormodel .setsampledcolor} .cvx .def>> <<(.drawcolor) {.join3ais 1.0 .scale .rgblinearcolormodel .setsampledcolor} .cvx .def>> (.setpacolor) { <<% >> .dup .pixelarraysamplesperpixel 3 .eq {.rgblinearcolormodel}.cvx {.graylinearcolormodel}.cvx .ifelse 1.0 .scale .exch .setsampledcolor } .cvx .def (.drawpa) { <<% >> {.dup .setpacolor .pixelarraybounds .maskrectangle}.cvx .dosave }.cvx .def (.arraymaskstroke) { <<% [ ... ] >> {.maskstroke}.cvx .arrayforall }.cvx .def (.arraymaskstrokeclosed) { <<% [ ... ] >> {.maskstrokeclosed}.cvx .arrayforall }.cvx .def (.arraymaskfill) { <<% [ ... ] >> .mark .exch {}.cvx .arrayforall .cnttomrk .makeoutline .maskfill .pop }.cvx .def (.arrayclipoutline) { <<% [ ... ] >> .mark .exch {}.cvx .arrayforall .cnttomrk .makeoutline .clipoutline .pop }.cvx .def (.arrayexcludeoutline) { <<% [ ... ] >> .mark .exch {}.cvx .arrayforall .cnttomrk .makeoutline .excludeoutline .pop }.cvx .def (.show) {.showrope} .cvx .def (.drawarea) {.setcolor 1 .makeoutline .maskfill}.cvx .def (.drawstroke) {.pop .pop .setcolor .maskstroke}.cvx .def (.drawbox){.maskrectangle}.cvx .def (.drawimage) {.exch .setcolor .drawais} .cvx .def (.drawbox){4 .copy .pop .pop .v2sub .v2neg .maskrectangle}.cvx .def (.nsrsetfont) {.rotate .exch .scale .concat .exch .findfont .exch .modifyfont .setfont} .cvx .def (.setpos){.setxy}.cvx .def (.writeinterpresspages) { (WIPPB) .exch .def % save array of page bodies % name and preamble already on the stack {(page ).print .dup .print ( . . .) .print .dup 1 .sub WIPPB .exch .aget .cvx .exec (done) = WIPPB .length .eq }.cvx .writeinterpress }.cvx .def (.printtouch) {.touch 2 .copy .exch ( ).print .print ( ).print .print ( ).print}.cvx .def (.printmoveto) {(.moveto ).print .moveto}.cvx .def (.printlineto) {(.lineto ).print .lineto}.cvx .def