%! % Test out plane window % This test class operates as follows: % 1.The user creates the window % 2. The user gives a bitmap to the window using SetBackGround % 3. the user pans/scrolls over the image using the scroll bars % Note that if dithering is invoked (by zoom in/out), % and the image is complicated, then the refresh time will be very slow. /testclass PlaneWindow [] classbegin /Background null def /ZoomFactor 2 def /SetBackGround { % imagefilename => - (load file into /BackGround) readcanvas pause % get actual image /BackGround exch def } def /PaintClient { /PaintClient super send PaintBackGround } def /PaintBackGround { % - => - gsave ClientCanvas setcanvas minX neg minY neg translate PlaneWidth PlaneHeight scale BackGround null ne { BackGround imagecanvas pause } if grestore } def /Enlarge { ScaleX ZoomFactor mul ScaleY ZoomFactor mul SetPlaneScale } def /Reduce { ScaleX ZoomFactor div ScaleY ZoomFactor div SetPlaneScale } def /Normal { 1.0 1.0 SetPlaneScale } def /ClientMenu [ (Center) {/CenterPlane testwin send} (Zoom Normal) {/Normal testwin send} (Zoom Out) {/Reduce testwin send} (Zoom In) {/Enlarge testwin send} ] /new DefaultMenu send store classend def /testwin framebuffer /new testclass send def % set location and shape of the window % Make it a 1192/2 by 900/2 window located at location (400,400) 400 400 1192 2 div 900 2 div /reshape testwin send % Make the plane window with x coordinates ranging over 0 -> 1192 % and y coordinates ranging over 0 -> 900 % (note, this is same as framebuffer size, so no dithering occurs, % so screen rewrite speed is fast) % Origin of the plane window will be at the origin of the view. 0 0 1152 900 /SetPlaneSize testwin send % Fill in the path for some image in the following string (NEWSHOME) getenv (%/smi/Catalyst/Miscellaneous) sprintf /SetBackGround testwin send /map testwin send