Big brother

236 views
Skip to first unread message

Jeremy Huxtable

unread,
Jul 25, 1988, 10:43:13 AM7/25/88
to
Try this out on your NeWS server.....

%!
% eye.ps
%
% Jeremy Huxtable
%
% "Big Brother" implementation in PostScript.

% Create an Eyeball class from the Default window class.

/Eyeball DefaultWindow
dictbegin
/EyeX 0 def % Current eyeball position
/EyeY 0 def
/MouseEventMgr null def % Event manager
dictend
classbegin
/Transform {
initmatrix initclip
clippath pathbbox scale pop pop
.5 .5 translate
} def

/ShapeFrameCanvas {
gsave ParentCanvas setcanvas
FrameX FrameY translate
FrameWidth FrameHeight scale
.5 .5 .5 0 360 arc
.5 .5 .2 0 360 arc FrameCanvas setcanvasshape
grestore
} def

/PaintFrame { } def

/DrawFrame {
bordercolor setcolor clippath fill
0 0 .45 0 360 arc
backgroundcolor setcolor fill
} def

/ShapeClientCanvas { } def

/CreateClientCanvas { /ClientCanvas FrameCanvas newcanvas def } def

/PaintClient {
FrameCanvas setcanvas
damagepath clipcanvas
Transform DrawFrame clipcanvas
EyeX EyeY 0 painteyeball
} def

/PaintFocus { } def

/activate { % create event manager to watch the mouse.
FrameCanvas setcanvas
/MouseEventMgr [
MouseDragged
{
begin
EyeX EyeY 1 painteyeball
XLocation YLocation 0 painteyeball
/EyeX XLocation store
/EyeY YLocation store
currentdict
end
redistributeevent
}
null % Action
null % Canvas
eventmgrinterest
] forkeventmgr def
} def

/painteyeball { % x y colour =>
setgray
exch atan /angle exch def
angle cos .2 mul
angle sin .2 mul
Transform
.15 0 360 arc fill
} def

classend def

% Now actually create a pair of eyes.
/eyeball framebuffer /new Eyeball send def
100 700 16 16 /reshape eyeball send
/map eyeball send
/activate eyeball send
/eyeball framebuffer /new Eyeball send def
145 705 16 16 /reshape eyeball send
/map eyeball send
/activate eyeball send

Reply all
Reply to author
Forward
0 new messages