home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1445 / yoyo.card < prev    next >
Encoding:
Text File  |  1990-12-28  |  6.2 KB  |  232 lines

  1. % @(#) $Header: yoyo.card,v 1.1 90/06/11 02:56:25 jef Exp $
  2. %
  3. % yoyo.card - Yoyodyne Propulsion Systems employee ID
  4. %
  5. % Copyright (C) 1990 by Jef Poskanzer.  All rights reserved.
  6.  
  7. /yoyo-boxheight cardheight cardmargin 2 mul sub photoheight sub 2 div def
  8. /yoyo-numwidth yoyo-boxheight diagoffsetfactor mul photowidth add def
  9. /yoyo-namewidth cardwidth cardmargin 3 mul sub yoyo-numwidth sub def
  10. /yoyo-logoheight photoheight cardmargin sub def
  11.  
  12. /yoyo-logodict 50 dict def
  13. /yoyo-logo { yoyo-logodict begin
  14.  
  15.     /r3 3 sqrt def        % useful constants
  16.     /r3d2 r3 2 div def
  17.  
  18.     /h  yoyo-logoheight  def    % height of triangle
  19.     /s  h r3d2 div  def        % side of triangle
  20.  
  21.     /so2  s 2 div  def
  22.     /h1  .07 h mul  def        % height of first horiz line - below PROPUL
  23.     /h2  .15 h mul  def        % height of second horiz line - below YOYO
  24.     /h3  .3 h mul  def        % height of third horiz line - above YOYO
  25.     /r1  .12 s mul  def        % radius of larger circle
  26.     /r1m  .95 r1 mul  def    % a little less than r1
  27.     /h4  .55 h mul  def        % height of center of circle
  28.     /h5  h4 r1 .7 mul add  def    % height of center of rocket wake
  29.     /r2  .06 s mul  def        % radius of smaller circle
  30.     /step  .03 s mul  def    % size of little steps
  31.     /rocketrot  -13  def        % angle of rocket and tail
  32.     /wakewidth  .01 s mul  def    % line width of rocket wake
  33.     /wakexsize  .30 s mul  def    % x size of rocket wake
  34.     /wakeysize  .4 r1 mul  def    % y size of rocket wake
  35.     /wake1ysize  1.30 wakeysize mul  def
  36.     /wake3ysize  .70 wakeysize mul  def
  37.  
  38.     /gray  .25  def
  39.  
  40.     1 setlinecap
  41.  
  42.     % Rocket wake part 2.
  43.     /rocketwake2 {
  44.     black setgray
  45.     wakewidth  setlinewidth
  46.     newpath
  47.     so2  h5  rocketrot  wakexsize  wakeysize  0  180  ellipser
  48.     stroke
  49.     } def
  50.  
  51.     % Dark triangle.
  52.     /darktriangle {
  53.     0  0  moveto
  54.     so2  h  lineto
  55.     s  0  lineto
  56.     0  0  lineto
  57.     fill
  58.     } def
  59.  
  60.     % White hollow.
  61.     /whitehollow {
  62.     white setgray
  63.     s  h1  moveto
  64.     so2  h1  lineto
  65.     so2  h2  lineto
  66.     .145 s mul neg  0  rlineto
  67.     0  1.5 h1 mul h2 sub  rlineto
  68.     .21 s mul  1.5 h1 mul  lineto
  69.     .21 s mul  h3  lineto
  70.     so2 r1 sub step sub  h4  lineto
  71.     so2 r1 add step add  h4  lineto
  72.     s .21 s mul sub  h3  lineto
  73.     s  h3  lineto
  74.     s  h1  lineto
  75.     fill
  76.     } def
  77.  
  78.     % Weird-shaped dark area.
  79.     /darkarea {
  80.     so2  h3  moveto
  81.     r1m neg step neg add  0  rlineto
  82.     0  step  rlineto
  83.     step  0  rlineto
  84.     0  h4 h3 sub step sub  rlineto
  85.     2 r1m mul  0 rlineto
  86.     0  h4 h3 sub step sub neg  rlineto
  87.     step  0  rlineto
  88.     0  step neg  rlineto
  89.     fill
  90.     } def
  91.  
  92.     % White circle.
  93.     /whitecircle {
  94.     white setgray
  95.     so2  h4  r1  0  360  arc
  96.     fill
  97.     } def
  98.  
  99.     % White circular bite.
  100.     /whitebite {
  101.     white setgray
  102.     s .13 s mul sub  h1 2 div r2 add  r2  0  360  arc
  103.     fill
  104.     } def
  105.  
  106.     % Rocket.
  107.     /rocket {
  108.     gsave
  109.     so2  h5  translate
  110.     rocketrot  rotate
  111.     0  wake3ysize neg  translate
  112.     newpath
  113.         .05 h mul  -.034 h mul  0  .17 h mul  .05 h mul  90  135  ellipser
  114.         .05 h mul   .034 h mul  0  .17 h mul  .05 h mul  225  270  ellipser
  115.     closepath
  116.     black setgray  fill
  117.     .06 h mul  0  0  .06 h mul  .035 h mul  0  360  ellipser
  118.     black setgray  fill
  119.     .06 h mul  0  0  .035 h mul  .040 h mul  0  360  ellipser
  120.     white setgray  fill
  121.     .07 h mul  0  0  .035 h mul  .040 h mul  0  360  ellipser
  122.     white setgray  fill
  123.     .08 h mul  0  0  .045 h mul  .045 h mul  0  360  ellipser
  124.     white setgray  fill
  125.     .030 h mul  0  0  .010 h mul  .010 h mul  0  360  ellipser
  126.     white setgray  fill
  127.     grestore
  128.     } def
  129.  
  130.     % Rocket wake part 3.
  131.     /rocketwake3 {
  132.     wakewidth  setlinewidth
  133.     newpath
  134.     so2  h5  rocketrot  wakexsize  wake3ysize  277  360  ellipser
  135.     stroke
  136.     } def
  137.  
  138.     % Rocket wake part 1.
  139.     /rocketwake1 {
  140.     newpath  .9 wakewidth mul  setlinewidth
  141.     so2  h5  rocketrot  wakexsize  wake1ysize  180  190  ellipser
  142.     stroke
  143.     newpath  .8 wakewidth mul  setlinewidth
  144.     so2  h5  rocketrot  wakexsize  wake1ysize  190  200  ellipser
  145.     stroke
  146.     newpath .7 wakewidth mul  setlinewidth
  147.     so2  h5  rocketrot  wakexsize  wake1ysize  200  210  ellipser
  148.     stroke
  149.     newpath .6 wakewidth mul  setlinewidth
  150.     so2  h5  rocketrot  wakexsize  wake1ysize  210  220  ellipser
  151.     stroke
  152.     newpath .5 wakewidth mul  setlinewidth
  153.     so2  h5  rocketrot  wakexsize  wake1ysize  220  230  ellipser
  154.     stroke
  155.     newpath .4 wakewidth mul  setlinewidth
  156.     so2  h5  rocketrot  wakexsize  wake1ysize  230  240  ellipser
  157.     stroke
  158.     newpath .3 wakewidth mul  setlinewidth
  159.     so2  h5  rocketrot  wakexsize  wake1ysize  240  250  ellipser
  160.     stroke
  161.     newpath .2 wakewidth mul  setlinewidth
  162.     so2  h5  rocketrot  wakexsize  wake1ysize  250  260  ellipser
  163.     stroke
  164.     newpath .1 wakewidth mul  setlinewidth
  165.     so2  h5  rocketrot  wakexsize  wake1ysize  260  270  ellipser
  166.     stroke
  167.     } def
  168.  
  169.     % Logo text.
  170.     /yoyotext {
  171.     black setgray
  172.     /off1  h2 h1 sub .2 mul  def
  173.     so2 off1 add   h2 off1 add  moveto
  174.     /Helvetica-Oblique findfont  h3 h2 sub  scalefont  setfont
  175.     (YOYODYNE) show
  176.     /offset  h2 h1 sub .2 mul  def
  177.     so2 off1 add  h1 off1 add  moveto
  178.     /Helvetica-Oblique findfont  h2 h1 sub  scalefont  setfont
  179.     (PROPULSION SYSTEMS) show
  180.     h 1.7 mul  h 0.85 mul  moveto
  181.     /Helvetica-Oblique findfont  h 0.12 mul  scalefont  setfont
  182.     ("The Future Begins) showright
  183.     h 1.7 mul  h 0.7 mul  moveto
  184.     (Tomorrow") showright
  185.     } def
  186.  
  187.     % Finally, actually draw something.
  188.     rocketwake2
  189.     gray setgray  darktriangle
  190.     whitehollow
  191.     gray setgray  darkarea
  192.     whitecircle
  193.     whitebite
  194.     rocket
  195.     black setgray  rocketwake3
  196.     black setgray  rocketwake1
  197.     yoyotext
  198.  
  199. end } def
  200.  
  201. /yoyo-info {
  202.     cardmargin  cardmargin yoyo-boxheight add  moveto
  203.     yoyo-namewidth yoyo-boxheight (NAME)
  204.       (John ) FirstName: 0 1 getinterval (. ) LastName:
  205.       strcat strcat strcat  diagbox
  206.     cardmargin  cardmargin  moveto
  207.     yoyo-namewidth yoyo-boxheight (SIGNATURE) ()  diagbox
  208.     cardwidth cardmargin sub yoyo-numwidth sub
  209.       cardmargin yoyo-boxheight add  moveto
  210.     yoyo-numwidth yoyo-boxheight (EMPLOYEE NO.)  4 randdigs  diagbox
  211.     cardwidth cardmargin sub yoyo-numwidth sub cardmargin  moveto
  212.     yoyo-numwidth yoyo-boxheight (ISSUE DATE) (Nov 1 1938)  diagbox
  213. } def
  214.  
  215. /yoyo-card {
  216.     cardstart
  217.     black setgray
  218.     0 setlinewidth
  219.     cardticks
  220.     cardwidth cardmargin sub photowidth sub
  221.       cardheight cardmargin sub photoheight sub  moveto
  222.     photowidth photoheight photo
  223.     gsave
  224.     cardmargin  cardheight cardmargin sub yoyo-logoheight sub  translate
  225.     yoyo-logo
  226.     grestore
  227.     yoyo-info
  228.     cardend
  229. } def
  230.  
  231. yoyo-card
  232.