home *** CD-ROM | disk | FTP | other *** search
-
- /* This is not guarenteed to be efficient, it does the job.
- I am just learning, so if anything is really bad, please let me know */
-
- /* PSABdrawdiamond makes the assumption that the height will always
- be smaller than the width, which may not always be true... */
-
- defineps PSABdrawdiamond (float x; float y; float width; float height)
-
- % upper right dark gray edge
-
- /halfh height 2 div def
- /halfw width 2 div def
-
- newpath
- 1 setlinecap
- 1 setlinewidth
- .333 setgray
- x y moveto
- halfw height rmoveto
- halfh halfh neg rlineto
- stroke
-
-
- % lower left dark gray edge
-
- newpath
- .333 setgray
- x y moveto
- halfw 0 rmoveto
- halfh neg halfh rlineto
- stroke
-
- % white edge (upper right)
-
- newpath
- 1 setlinecap
- 1 setgray
- x y moveto
- halfw height rmoveto
- halfh neg halfh neg rlineto
- stroke
-
- % white shadow
-
- newpath
- .8 setgray
- x y moveto
- halfw 1 sub height rmoveto
- halfh neg halfh neg rlineto
- stroke
-
- % black edge (lower right)
-
- newpath
- 1 setlinecap
- 0 setgray
- x y moveto
- halfw 0 rmoveto
- halfh halfh rlineto
- stroke
-
- % low right shadow
-
- newpath
- .333 setgray
- x y moveto
- halfw 1 add 0 rmoveto
- halfh 1 sub halfh 1 sub rlineto
- stroke
-
- % the light gray rectangle inside the main one (10 10 scale and you'll see)
-
- newpath
- .667 setgray
- x y moveto
- halfw 1 rmoveto
- halfh 1 sub neg halfh 1 sub rlineto
- halfh 1 sub halfh 1 sub rlineto
- halfh 1 sub halfh 1 sub neg rlineto
- closepath
- stroke
-
- showpage
-
- endps
-
-
-
- /* Draws the black arrow. If direction is zero then it points to the
- left, else it points to the right. */
-
- defineps PSABdrawarrow (float x; float y; float width; float height;
- int direction; int enabled)
-
- % the inside black triangle (pointing right for this example)
-
- /halfh height 2 div def
- /halfw width 2 div def
- /ratio halfh 2 div 1 sub def
-
- % erase the middle rectangle
-
- newpath
- .667 setgray
- x y moveto
- halfw ratio rmoveto
- halfh ratio sub neg halfh ratio sub rlineto
- halfh ratio sub halfh ratio sub rlineto
- halfh ratio sub halfh ratio sub neg rlineto
- closepath
- fill
- stroke
-
- % draw the new black arrow depending on direction
-
- enabled 1 eq
- {
- newpath
- 0 setgray
- x y moveto
- halfw ratio rmoveto
- direction 0 eq
- { halfh ratio sub neg halfh ratio sub rlineto
- halfh ratio sub halfh ratio sub rlineto }
- { halfh ratio sub halfh ratio sub rlineto
- halfh ratio sub neg halfh ratio sub rlineto } ifelse
- closepath
- fill
- stroke
- } if
-
- showpage
-
- endps
-
-
-
- /* Just a little wrap to draw upside down just in case the view is flipped */
-
- defineps PSABflipme (float height)
-
- 1.0 -1.0 scale
- 0.0 height neg translate
-
- endps
-
-
-
- /* Assumes that you already have set a font */
-
- defineps PSABshowstring (float x; float y; float gray; char *str)
-
- gray setgray
- x y moveto
- (str) show
-
- endps
-
-