a postscript/background question

wnk at uxc.cso.uiuc.edu wnk at uxc.cso.uiuc.edu
Fri May 4 00:02:00 AEST 1990




	I have started playing with postscript lately, and I figured
the best way to test out what I've learned is to make nifty backgrounds
for my 4D/20TG workstation.  Well the first thing I tried was to draw
a smiley face. (The code is included at the end of the article).  What
I found was that you can't set the line width, or do partial circles.
If you try, the login process dies, and you have to login with NOGRAPHICS
set and edit your startup.ps to remove the offending lines.  Now, I've tested
this same code with psview and printed it on a postscript printer, and it
works fine there.  I also discovered how to have psview draw to the background
instead of its window, which is what the code at the end of the note does.
However, when I put it in my startup.ps it bombs.  Could anyone give a novice
some insight as to what he's doing wrong?  Any help would be greatly
appreciated.

-----------------------------------------------------------------------------
%!
% "Smiley"

/doCircle			% draw a filled circle
 { 0 360 arc fill } def

/doArc				% draw an arc
 { 200 340 arc stroke } def

/DrawSmile {
   1.0 1.0 0 setrgbcolor	% set color to yellow
   500 400 300 doCircle		% draw face
   0 0 0 setrgbcolor		% set color to black
   400 520 25 doCircle		% draw eyes
   600 520 25 doCircle
   4 setlinewidth		% set line width
   500 350 150 doArc		% draw mouth as 140 degree arc
} bind def

/PaintRoot {
    gsave framebuffer setcanvas
    0 0.392 1 setrgbcolor	% set background color
    clippath fill		% fill background
    DrawSmile
    grestore
} def

PaintRoot

showpage
%EndOfFile

----------

Walter Kreiling
wnk at aquifer.las.uiuc.edu



More information about the Comp.sys.sgi mailing list