#!/usr/NeWS/bin/psh % % Date: Tue, 17 Jan 89 11:33:30 EST % To: NeWS-makers@brillig.umd.edu % Subject: Forcing NeWS *NOT* to interpolate colors canvases % From: alexis%yummy@gateway.mitre.org % % Is there a way to stop NeWS from interpolate between pixels of a % color canvas? I'm trying to draw something which I'd like to look % like a bunch of colored squares. If I use a color canvas, NeWS is % "helpful" and spends lots of time and energy interpolating. It's % all very pretty ... but it's very slow and not what I want. You % end up with star-bursts and colors where you never put them. % % As a quick example try running the following. It's quite pretty, % but first time you try it make the window SMALL (as in postage % stamp size). It's most interesting big, but it tends to break % due to the time it takes to compute (my sun 4 can do about a 5x5). % %%%%%%%%%%%% Try This Sample Code, It's Fun And Easy %%%%%%%%%%%%% /img 16 16 24 [16 0 0 -16 0 16] {random 0.5 gt {(\000)} {(\377)} ifelse} buildimage def /win framebuffer /new DefaultWindow send def { /PaintClient { ClientCanvas setcanvas clippath pathbbox scale pop pop random .5 lt { .5 .5 translate 360 random mul rotate -.5 -.5 translate } if img imagecanvas } def } win send /reshapefromuser win send /map win send %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Please don't tell me to: % a) make a canvas the same size that I'm going to display [one of the % whole reasons for using NeWS is so the window can be resized.] % b) draw actual squares [that's what I do now -- it works, but for % large images it's even slower than the above.] % c) go editing NeWS or any other fool thing. % % I just want a way to turn off this interpolation "feature" occasionally. % % Alexis P. Wieland % MITRE Corporation % 7525 Colshire Dr. % McLean, VA 22102 % (703) 883-7476 % alexis%yummy@gateway.mitre.org