[comp.sys.sun] postscript to rasterfile?

kusalik%SKLPL.USask.CA@cornellc.cit.cornell.edu (01/03/89)

We would like to convert some of the (demo) images which came with NeWS
into rasterfile format (so they can be displayed using things like
screenload or serve as a background for suntools).

We have tried the obvious route of loading the image in under NeWS and
then doing a screendump.  However, that leaves us with a window border
around the image.

Any ideas on how to get the rasterfile image without the border?  Any
pointers on other ways of converting the postscript to rasterfile?  Any
standard SUN utilities we're overlooking?  Any PD software available to
perform the task?  Input welcome on any of these questions.

        Tony Kusalik                    Department of Computational Science
        kusalik@sklpl.usask.ca          University of Sastachewan
        kusalik@sask.usask.ca           Saskatoon, Saskatchewan
        kusalik@sask.bitnet             S7N 0W0 Canada

[[ There's one that goes the other way:  rasterfile to PostScript.  An
alternative is to get "dumpregion" from the Sun-Spots archives and use
that to make a rasterfile of a selected region of the screen.  That way
you can get rid of the border.  "dumpregion.c" and "dumpregion.diff" are
both in the archives under "sun-source".  They can be retrieved via
anonymous FTP from the host "titan.rice.edu" or via the archive server.
For more information about the archive server, send a mail message
containing the word "help" to the address "archive-server@rice.edu".
--wnl ]]

don@brillig.umd.edu (Don Hopkins) (01/07/89)

Here's a simple NeWS program that you can use to grab regions of the
screen and write out raster files, to the file "/tmp/clip".

	-Don

%!
%
% Date: Wed, 21 Sep 88 10:30:16 EDT
% To: NeWS-makers@brillig.umd.edu
% Subject: Re: Color PostScript screendump for NeWS
% From: campfire!scout@sun.com  (David LaVallee)
% 
% Here's a little cut and paste and sketch program that uses the file
% /tmp/clip as its storage. NeWS stores the "clip" as a run-length
% encoded sun raster file (B+W or Color).
% 
% I have used this program to clip stuff for B+W and color raster
% printers, on a Sun with TRANSCRIPT software this is one way to
% print the rasterfile to a LaserWriter:
% 
% /usr/lib/rasfilters/convert.2 /tmp/clip | pssun | lpr
% 
% --Scoutly

%%NeWS1.1
%%author:	David A. LaVallee
%%title:	paint2

[/x0 /y0 /x1 /y1 /x /y /win /can] {null def} forall
/win framebuffer /new DefaultWindow send def
/reshapefromuser win send
{   /ClientMenu [
        (cut)
    {
        framebuffer createoverlay setcanvas getwholerect waitprocess aload pop
        framebuffer setcanvas points2rect rectpath (/tmp/clip) writescreen
    }
        (paste)
    {
        can createoverlay setcanvas getwholerect waitprocess aload pop
        can setcanvas points2rect gsave 4 2 roll translate scale
        {(/tmp/clip) readcanvas imagecanvas} stopped {pop} if grestore
    }
    ] /new DefaultMenu send def
} win send
/map win send
/can win /ClientCanvas get def
can /Retained true put

/paintit {0 setgray x1 y1 moveto x y lineto stroke} def

/setxy {
	/x1 x store /y1 y store
	begin /x XLocation store /y YLocation store end
} def

/paintbrush {
10 dict begin
    currentcursorlocation /y exch store /x exch store
    /x0 x store /y0 y store
    /x1 x store /y1 y store
    paintit
    [   null {currentprocess killprocess} /UpTransition null eventmgrinterest
	MouseDragged {setxy paintit} null null eventmgrinterest
    ] forkeventmgr pop
end
} def

/PaintEventMgr [
        PointButton {
                can setcanvas paintbrush
        } /DownTransition can eventmgrinterest
] forkeventmgr def