Bodick@CIS.UPENN.EDU (Andre Marquis) (10/02/87)
I wish to display 24-bit images using NeWS. The following code works on an
8-bit (color) display, but not on a 1-bit display (much is copied from
$NEWSHOME/bin/showimage):
/win framebuffer /new DefaultWindow send def
0 0 480 512 /reshape win send %Image is 512x480 pixels
(/usr/NeWS/smi/mona-smile-hires.im8) readcanvas /pic exch def
win begin
/PaintClient {
ClientCanvas setcanvas clippath pathbbox scale pop pop
pic imagecanvas } def
end
/map win send
If "mona-smile.im8" (8-bit image) is substituted for "mona-smile-hires.im8"
(24-bit image), the above code works. I assume someone just didn't have
time to cover all the possibilities.
So, 24->8 works, 8->1 works and 24->1 doesn't work. Is there going to be
future support for 16 or 32 bit images? After all, pixrects supports 16 and
32 bits, but not 24. (24 can be faked, but I had to write my own pr_get and
pr_put to do it. How did you people at Sun make the *-hires files?)
The dithering routines do an excellent job. Now, is there any way to the
the pixel data off the canvas and in to a file once it has been dithered? I
want to be able to pull images up quickly in sequence without having to
retain all the canvases. (Think of a remote machine with prodigious storage
and a server with little.) Can NeWS recognize that an image has the same
depth as the display, the same colormap and the same dimensions as the
canvas so something like a pr_load directly to screen memory will work?
Currently I capture a 24-bit image, compress it to 8-bits using error
diffusion, save that to a file and then display the final result on the
screen under SunView with my own colormap. I would prefer to capture the
24-bit image, have NeWS dither it to its colormap and save that result.
That would make image retrieval as fast as possible (on equivalent display
devices). NeWS is a little show in dithering images with my colormap and
the results are not perfect -- apparent resolution is lost because of the
color changes.
Any thoughts anyone?
Andre Marquis
Department of Pathology and Lab Medicine
2 Gibson Building
Hospital of the University of Pennsylvania
3600 Spruce Street
Philadelphia, PA 19106
(215)662-6886
bodick@cis.upenn.edu
"Occasionally a pixel is a good thing."