]> git.donarmstrong.com Git - lilypond.git/blobdiff - ps/music-drawing-routines.ps
* lily/include/grob-info.hh (class Grob_info): make data member
[lilypond.git] / ps / music-drawing-routines.ps
index c7c0956e4473fed219cf4a98207bd6115b5ccb50..a2e74c35bfc238f5f4b4fd37985bee978982c8b9 100644 (file)
@@ -3,12 +3,38 @@
 % Functions for direct and embedded PostScript
 
 
+%% TODO: use dicts or prefixes to prevent namespace pollution.
+
 /pdfmark where
 {pop} {userdict /pdfmark /cleartomark load put} ifelse
 
+% from adobe tech note 5002. 
+/BeginEPSF { %def
+    /b4_Inc_state save def % Save state for cleanup
+    /dict_count countdictstack def % Count objects on dict stack
+    /op_count count 1 sub def % Count objects on operand stack
+    userdict begin % Push userdict on dict stack
+    /showpage { } def % Redefine showpage, { } = null proc
+    0 setgray 0 setlinecap % Prepare graphics state
+    1 setlinewidth 0 setlinejoin
+    10 setmiterlimit [ ] 0 setdash newpath
+    /languagelevel where % If level not equal to 1 then
+    {pop languagelevel % set strokeadjust and
+    1 ne % overprint to their defaults.
+      {false setstrokeadjust false setoverprint
+      } if
+    } if
+} bind def
+
 
-% llx lly urx ury command
-/mark_file_line
+/EndEPSF { %def
+  count op_count sub {pop} repeat % Clean up stacks
+  countdictstack dict_count sub {end} repeat
+  b4_Inc_state restore
+} bind def 
+
+% llx lly urx ury URI
+/mark_URI
 {
     /command exch def
     /ury exch def
@@ -131,8 +157,9 @@ bind def
        } ifelse
 } bind def
 
-/draw_polygon % x(n) y(n) x(n-1) y(n-1) ... x(1) y(1) n blot
+/draw_polygon % x(n) y(n) x(n-1) y(n-1) ... x(1) y(1) n blot fill
 {
+       /fillp exch def
        /blot exch def
 
        0 setlinecap
@@ -142,12 +169,12 @@ bind def
        /points exch def
        2 copy
        moveto
-       1 1 points {pop lineto} for
-       currentdict /testing known {
-               %% outline only, for testing:
-               stroke
+       1 1 points { pop lineto } for
+       closepath 
+       fillp {
+               gsave stroke grestore fill
        }{
-               closepath gsave stroke grestore fill
+               stroke
        } ifelse
 } bind def
 
@@ -258,6 +285,17 @@ bind def
        0 360 arc closepath fill stroke
 } bind def
 
+/draw_circle % R T F
+{
+       /filled exch def
+       setlinewidth
+       dup 0 moveto
+       0 exch 0 exch
+       0 360 arc closepath
+       gsave stroke grestore
+       filled { fill } if 
+} bind def
+
 /draw_white_dot % x1 y2 R
 {
 %      0 360 arc fill stroke