home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / Palettes / CircularSliderPalette / wraps.psw < prev   
Text File  |  1991-12-16  |  3KB  |  102 lines

  1. /*
  2.  *    Filename:    wraps.psw 
  3.  *    Created :    Sat Aug 24 21:25:44 1991
  4.  *    Author  :    Vince DeMarco
  5.  *        <vince@whatnxt.cuc.ab.ca>
  6.  *
  7.  *    Version 1.0.1
  8.  *
  9.  */
  10.  
  11.  
  12. defineps PSdrawCircSlider(float height; float width; float x; float y; float radius; float angle)
  13.  
  14.      gsave                          %% save the current graphics state 
  15.     
  16.      x 1.5 sub y translate          %% translate the current point to the center of the 
  17.                                     %% circle
  18.  
  19.      height width gt {              %% if the height is greater than the width then
  20.          1 height width div scale   %% scale the y by height / width
  21.      } if
  22.  
  23.      height width lt {              %% if height is less than the width then scale
  24.          width height div 1 scale   %% the x by width / height
  25.      } if
  26.  
  27.      %%%%%% Draw the background of the Circular Slider
  28.      newpath
  29.      0.33333 setgray
  30.      0.5 0.5 radius 0 360 arc
  31.      closepath
  32.      fill
  33.  
  34.      %%%%%% Draw the control portion of Circular Slider
  35.      0.5 setgray
  36.      newpath
  37.      x width div y height div moveto
  38.      0.5 0.5 radius 90 angle 90 sub neg arcn
  39.      closepath
  40.      fill
  41.  
  42.      %%%%%% stroke out an outline 
  43.      0 setgray
  44.      1 setlinewidth
  45.      0.5 0.5 radius 0 360 arc
  46.      matrix defaultmatrix setmatrix     %% create an empty 6x6 element unit matrix 
  47.                                         %% replace the currently created matrix with the
  48.                                         %% default matrix for the device then sets up that
  49.                                         %% matrix as the CTM
  50.                                         %% 
  51.                                         %% This is done so the stroked lines don't get 
  52.                                         %% wider because of the scaling
  53.      stroke
  54.  
  55.      grestore
  56.  
  57. endps
  58.  
  59. /*********************************
  60. defineps PSdrawRectangle(float x; float y; float width; float height)
  61.  
  62. %%% Draws a 3D looking (raised) rectangle
  63.      gsave
  64.  
  65.      0.66666 setgray
  66.      x y width height rectfill
  67.  
  68.      %%%%% left side and top
  69.      2 setlinewidth
  70.      1 setgray
  71.      x y moveto
  72.      0 height rlineto
  73.      width 0  rlineto
  74.      stroke
  75.  
  76.      %%%%% bottom and right light gray
  77.      1 setlinewidth
  78.      0.33 setgray
  79.      x 1 add y 2 add moveto
  80.      width 2 sub 0 rlineto
  81.      0 height 3 sub rlineto 
  82.      stroke
  83.  
  84.      %%%%%%%%%%%%%%%%%%%% bottom black 
  85.      1.5 setlinewidth
  86.      0 setgray
  87.      x  y  moveto
  88.      width 0 rlineto    
  89.      stroke
  90.  
  91.      %%%%%%%%%%%%%%%%%%%% right black
  92.      1 setlinewidth
  93.      0 setgray
  94.      x width add y  moveto
  95.      0 height rlineto
  96.      stroke
  97.  
  98.      grestore
  99. endps
  100.  
  101. **************************/
  102.