DIRECTORY Basics, Imager, ImagerBackdoor, ImagerColorOperator, ImagerSmooth, ImagerTerminal, InterminalBackdoor, ImagerPixelMap, JaM, JaMIPrivate, MickeyMouse, PrincOps, PrincOpsUtils, Real, Rope, Terminal; JaMMickeyMouseImpl: CEDAR MONITOR IMPORTS Imager, ImagerBackdoor, ImagerColorOperator, ImagerSmooth, ImagerTerminal, InterminalBackdoor, ImagerPixelMap, JaM, JaMIPrivate, MickeyMouse, PrincOpsUtils, Real, Terminal ~ BEGIN ApplyCreate: PROC [self: JaM.State] ~ { file: Rope.ROPE _ JaM.PopRope[self]; ref: MickeyMouse.Ref _ MickeyMouse.Create[file]; JaM.Push[self, ref]; }; ApplyDrawFrame: PROC [self: JaM.State] ~ { GetContext: PROC [self: JaM.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]; }; Action: PROC ~ { Imager.ScaleT[context, 1.0/Imager.metersPerPoint]; MickeyMouse.DrawFrame[ref, context] }; ref: MickeyMouse.Ref _ NARROW[JaM.Pop[self]]; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; context: Imager.Context ~ GetContext[self]; Imager.DoSaveAll[context, Action]; }; ApplyDrawSmoothFrame: PROC [self: JaM.State] ~ { ref: MickeyMouse.Ref ~ NARROW[JaM.Pop[self]]; colorContext: Imager.Context _ ImagerTerminal.ColorContext[InterminalBackdoor.terminal, TRUE]; IF colorContext # NIL THEN { Action: PROC [context: Imager.Context] ~ { Imager.ScaleT[context, 1.0/Imager.metersPerPoint]; MickeyMouse.DrawFrame[ref, context] }; r: Imager.Rectangle ~ ImagerBackdoor.GetBounds[colorContext]; width: NAT ~ Real.Round[r.w]; height: NAT ~ Real.Round[r.h]; pa: Imager.PixelArray _ ImagerSmooth.MakePixelArray[action: Action, sSize: height, fSize: width, components: LIST[$Red, $Green, $Blue], viewToPixel: ImagerSmooth.LikeScreen[height]]; Imager.SetSampledColor[context: colorContext, pa: pa, m: NIL, colorOperator: ImagerColorOperator.RGBLinearColorModel[255]]; Imager.MaskRectangle[colorContext, r]; }; }; GetByteMap: PROC [f: Terminal.FrameBuffer] RETURNS [ImagerPixelMap.PixelMap] ~ TRUSTED { RETURN [ImagerPixelMap.CreateFrameBuffer[pointer: f.base, words: f.vm.words, lgBitsPerPixel: 3, rast: f.wordsPerLine, lines: f.height, ref: f]] }; scratchRep: REF ImagerPixelMap.PixelMapRep _ NIL; FreeScratchRep: ENTRY PROC [t: REF ImagerPixelMap.PixelMapRep] ~ { scratchRep _ t }; GetScratchRep: ENTRY PROC RETURNS [t: REF ImagerPixelMap.PixelMapRep] ~ { t _ scratchRep; scratchRep _ NIL; }; GetScratchPM: PROC [sSize, fSize: NAT] RETURNS [ImagerPixelMap.PixelMap] ~ { RETURN [ImagerPixelMap.Reshape[refRep: GetScratchRep[], lgBitsPerPixel: 3, bounds: [0, 0, sSize, fSize]]] }; blink: BOOL _ TRUE; ApplyDrawFullFrame: PROC [self: JaM.State] ~ { ref: MickeyMouse.Ref ~ NARROW[JaM.Pop[self]]; vt: Terminal.Virtual ~ InterminalBackdoor.terminal; IF Terminal.GetColorMode[vt].full THEN { rg: Terminal.FrameBuffer ~ Terminal.GetColorFrameBufferA[vt]; b: ImagerPixelMap.PixelMap ~ GetByteMap[Terminal.GetColorFrameBufferB[vt]]; t: ImagerPixelMap.PixelMap ~ GetScratchPM[sSize: b.sSize, fSize: b.fSize]; context: Imager.Context ~ ImagerSmooth.Create[pixelMap: t, component: $Blue, viewToPixel: ImagerSmooth.LikeScreen[b.sSize], initialScale: 1, change: NIL, changeData: NIL]; Proc: PROC ~ { Imager.ScaleT[context, 1.0/Imager.metersPerPoint]; MickeyMouse.DrawFrame[ref, context] }; UnpackToRG: PROC [which: [0..1]] ~ TRUSTED { bbTableSpace: PrincOps.BBTableSpace; bb: PrincOps.BBptr ~ PrincOpsUtils.AlignedBBTable[@bbTableSpace]; bb^ _ [ dstBpl: rg.wordsPerLine*Basics.bitsPerWord, srcDesc: [srcBpl[t.refRep.rast*Basics.bitsPerWord]], height: rg.height, width: 8, flags: [direction: forward, disjoint: TRUE, disjointItems: TRUE, gray: FALSE, srcFunc: null, dstFunc: null] ]; FOR j: NAT IN [0..rg.width) DO bb^.src _ [word: t.refRep.pointer+j/Basics.bytesPerWord, bit: 8*(j MOD Basics.bytesPerWord)]; bb^.dst _ [word: rg.base+j, bit: which*8]; PrincOpsUtils.BITBLT[bb]; ENDLOOP; }; ImagerPixelMap.Fill[t, [0, 0, t.sSize, t.fSize], CARDINAL.LAST]; ImagerSmooth.SetComponent[context, $Red]; Imager.DoSaveAll[context, Proc]; IF blink THEN Terminal.SetVisibility[vt, none]; UnpackToRG[0]; ImagerPixelMap.Fill[t, [0, 0, t.sSize, t.fSize], CARDINAL.LAST]; ImagerSmooth.SetComponent[context, $Green]; Imager.DoSaveAll[context, Proc]; UnpackToRG[1]; ImagerPixelMap.Fill[t, [0, 0, t.sSize, t.fSize], CARDINAL.LAST]; ImagerSmooth.SetComponent[context, $Blue]; Imager.DoSaveAll[context, Proc]; ImagerPixelMap.Transfer[dest: b, source: t]; IF blink THEN Terminal.SetVisibility[vt, all]; FreeScratchRep[t.refRep]; }; }; ApplyNextFrame: PROC [self: JaM.State] ~ { ref: MickeyMouse.Ref _ NARROW[JaM.Pop[self]]; MickeyMouse.NextFrame[ref]; }; RegisterMickeyMouse: PUBLIC PROC [self: JaM.State] ~ { JaM.Register[self, ".mickeymousemakehandle", ApplyCreate]; JaM.Register[self, ".mickeymousedrawframe", ApplyDrawFrame]; JaM.Register[self, ".mickeymousedrawsmoothframe", ApplyDrawSmoothFrame]; JaM.Register[self, ".mickeymousedrawfullframe", ApplyDrawFullFrame]; JaM.Register[self, ".mickeymousenextframe", ApplyNextFrame]; }; Init: PROC [] RETURNS [] ~ { JaM.RegisterInit["JaMMickeyMouseImpl", RegisterMickeyMouse]; }; Init[]; END. όJaMMickeyMouseImpl.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. Last edited by: Mik Lamming - April 25, 1986 3:51:20 pm PST Michael Plass, September 9, 1986 1:57:05 pm PDT -- called with (JaMMickeyMouseImpl) .callinit Κf˜™Icodešœ Οmœ7™BK™;K™/—K˜KšΟk œΕ˜ΞK˜K˜šΠlnœž ˜!Kšžœ¬˜³šœž˜K˜——šΟn œžœ˜'Kšœ žœ˜$Kšœ0˜0Kšœ˜K˜K˜—š œžœ˜*š  œžœžœ˜?Kšœ3˜3Kšžœžœžœžœ˜Kšžœžœžœ ˜*Kšžœ ˜K˜K˜—šΟbœžœ˜Jšœ2˜2Jšœ#˜#Jšœ˜J˜—Kšœžœ˜-Kšœ3˜3K˜+Jšœ"˜"K˜K˜—š œžœ˜0Kšœžœ˜-JšœXžœ˜^šžœžœžœ˜šΠbnœžœ˜*Jšœ2˜2Jšœ#˜#Jšœ˜—Jšœ=˜=Jšœžœ˜Jšœžœ˜JšœmžœE˜ΆJšœ9žœ?˜{Kšœ&˜&Kšœ˜—K˜K˜—š  œžœžœžœ˜XKšžœ‰˜Kšœ˜K˜—Kšœ žœžœ˜1š œžœžœžœ2˜TK˜—š   œžœžœžœžœ ˜IK˜Kšœ žœ˜Kšœ˜K˜—š  œžœžœžœ˜LKšžœc˜iKšœ˜K˜—Kšœžœžœ˜š œžœ˜.Kšœžœ˜-Jšœ3˜3šžœ žœ˜(Kšœ=˜=KšœK˜KKšœJ˜JKšœ•žœžœ˜«š œžœ˜Jšœ2˜2Jšœ#˜#Jšœ˜—š  œžœžœ˜,K˜$KšœA˜Ašœ˜Kšœ+˜+Kšœ4˜4Kšœ˜Kšœ ˜ Kšœ&žœžœžœ˜kK˜—šžœžœžœž˜KšœCžœ˜]Kšœ*˜*Kšœžœ˜Kšžœ˜—Kšœ˜—Kšœ1žœžœ˜@Kšœ)˜)Kšœ ˜ Kšžœžœ"˜/Kšœ˜Kšœ1žœžœ˜@Kšœ+˜+Kšœ ˜ Kšœ˜Kšœ1žœžœ˜@Kšœ*˜*Kšœ ˜ K•StartOfExpansioni[dest: ImagerPixelMap.PixelMap, source: ImagerPixelMap.PixelMap, function: ImagerPixelMap.Function]šœ,˜,Kšžœžœ!˜.Kšœ˜Kšœ˜—K˜K˜—š œžœ˜*Kšœžœ˜-Kšœ˜K˜K˜—š œžœžœ˜6Kšœ-™-Kšœ:˜:Kšœ<˜