🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #5994

Re: PS Humor

#5994
From: Steven Van Lerberghe 42468
Date: Tue, 14 May 1991 10:38
63 lines
3069 bytes
In article <2288@abvax.AB.Com> jaz@icd.ab.com (Jack A. Zucker) writes:
>From rec.humor.funny
>
>How many lines of sed code does it take to change a lightbulb?
>
>I don't know... but its only 74 in Postscript.
>
>
>| Jack A Zucker	                 {cwjcc,pyramid,decvax,uunet}!jaz@icd.ab.com |
>| Allen-Bradley Company, Inc.     or                       ICCGCC::ZUCKER    |
>| 747 Alpha Drive                 
>| Highland Hts., OH 44143         phone: (216) 646-4668   FAX: (216)
>646-4484 | 

%! This was my immediate reply to rec.humor.funny's PostScript humor.
%  Guess it won't be accepted. Less than 50 lines though!     Steven.
/bulb                         % draw a light-bulb with text `ID' in it
{gsave                        % called as:
translate rotate              % <orientation> <x-place> <y-place> bulb
0.5 0.5 scale                 %
/alfa 41.40962211 def         % some angle that puts the centers of
/sina alfa sin -2 mul def     % the necessary arcs at coordinates
                              % (0,0) (-1.5, -2*sine of alfa) (or:
newpath                       % -1.5, sina) and (1.5, sina) 
0.4 sina 0.1 270 360 arc      % rounded left-bottom corner
1.5 sina 1 180 180 alfa sub arcn % outline of buld
0 0 1 alfa neg 180 alfa add arc  % in three consecutive
-1.5 sina 1 alfa 0 arcn       % ...outline of bulb in three consec. arc
-0.4 sina 0.1 180 270 arc     % rounded right-bottom corner
closepath 0.925 setgray  fill % draw it in `almost-white'
                              %
newpath                       %
-0.4 sina 0.1 sub moveto      % and this draws the `fitting'
0 -0.45 rlineto
-0.35 sina 0.55 sub 0.05 180 270 arc
0.7 0 rlineto
0.35 sina 0.55 sub 0.05 270 360 arc
0 0.45 rlineto
closepath  0.5 setgray  fill  % ...partly in half-gray
                              %
newpath                       %
-0.3 sina 0.6 sub moveto      %
0.1 -0.1 rlineto 0.4 0 rlineto
0.3 sina 0.6 sub lineto       %
closepath  0 setgray  fill    % ...and partly in black
                              %
newpath  0.9775 setgray       % ...plus some `light rays'
0.025 setlinewidth
-45 rotate 1 1 7 {1.1 0 moveto
1.6 0 lineto 45 rotate pop} for
90 rotate stroke

newpath                       % this is the text `ID'
/Helvetica-Bold findfont      %
1 scalefont setfont           % ...set in the center
0 0 moveto  (ID) dup          % 
stringwidth pop 2 div neg -0.5 rmoveto
0.5 1 1 sethsbcolor show grestore } def % ...also in black

300 425 translate 150 150 scale
0 0 0 bulb                    % an example of a call

showpage
Technical Details
Message-ID: <2788@prles2.prl.philips.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!phigate!prle!prles2!prl.philips.nl!steven
References: <2288@abvax.AB.Com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!phigate!prle!prles2!prl.philips.nl!steven
From: steven@prl.philips.nl (Steven Van Lerberghe 42468)
Newsgroups: comp.lang.postscript
Subject: Re: PS Humor
Message-ID: <2788@prles2.prl.philips.nl>
Date: 14 May 91 10:38:55 GMT
References: <2288@abvax.AB.Com>
Sender: news@prles2.prl.philips.nl
Organization: none
Lines: 63