postscript to rasterfile? (Scout's paint2.ps)
Don Hopkins
don at brillig.umd.edu
Sat Jan 7 18:00:37 AEST 1989
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 at brillig.umd.edu
% Subject: Re: Color PostScript screendump for NeWS
% From: campfire!scout at 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
More information about the Comp.sys.sun
mailing list