X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ps%2Fmusic-drawing-routines.ps;h=b665aff49a98416b292921c35f73a48ee74aec36;hb=f2d6ea6c952ab8f8651f95cdc1bc45716e4d3cc8;hp=952cd490654394d822aca87f2bd9b55cc6484905;hpb=4478a4f00c0958af4964af412fa9e0e050569fe0;p=lilypond.git diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index 952cd49065..b665aff49a 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -2,22 +2,20 @@ % % Functions for direct and embedded PostScript -/blot-diameter { lilypondpaperblotdiameter } bind def - -% fucking redhat xdvi patch. -/skeel { scale } bind def +/blot-diameter { lilypondpaperblotdiameter } bind def /set_tex_dimen { cvr def } bind def + + /euclidean_length { 1 copy mul exch 1 copy mul add sqrt } bind def -/skeel { scale } bind def % FIXME. translate to middle of box. % Nice rectangle with rounded corners /draw_box % breapth width depth height @@ -52,6 +50,18 @@ } ifelse } bind def + +/draw_symmetric_x_triangle % h w th +{ + setlinewidth + 0 0 moveto + dup 0 lineto + 2 div + exch lineto + 0 0 lineto + stroke +} bind def + /draw_round_box % breapth width depth height blot { /blot exch def @@ -111,6 +121,26 @@ } ifelse } bind def +/draw_polygon % x(n) y(n) x(n-1) y(n-1) ... x(1) y(1) n blot +{ + /blot exch def + + 0 setlinecap + blot setlinewidth + 1 setlinejoin + + /points exch def + 2 copy + moveto + 1 1 points {pop lineto} for + currentdict /testing known { + %% outline only, for testing: + stroke + }{ + closepath gsave stroke grestore fill + } ifelse +} bind def + /draw_repeat_slash % width slope thick { 1 setlinecap @@ -184,12 +214,15 @@ % this is for drawing slurs. /draw_bezier_sandwich % thickness controls -{ +{ + % round ending and round beginning + 1 setlinejoin 1 setlinecap setlinewidth moveto curveto lineto - curveto + curveto + closepath gsave fill grestore @@ -226,6 +259,50 @@ } bind def +% a b c d subvec == a-c b-d +/subvec { + 3 2 roll exch sub + 3 1 roll + sub exch +} bind def + + +% centre? zzwidth zzheight thickness x0 y0 x1 y1 +/draw_zigzag_line { + newpath + 6 dict begin + + 4 2 roll % zzuw zzh th x1 y1 x0 y0 + 2 copy + moveto + subvec % zzuw zzh th dx dy + + 2 copy euclidean_length /l exch def + l div /uy exch def + l div /ux exch def + setlinewidth + /zzh exch def + l exch div round /n exch def + n 0 gt { %if + /zzw l n 2 mul div def + { + uy zzh mul 2 div ux zzh mul -2 div rmoveto + } if + 1 1 n { + ux zzw mul uy zzh mul sub + uy zzw mul ux zzh mul add + rlineto + ux zzw mul uy zzh mul add + uy zzw mul ux zzh mul sub + rlineto + } bind for + }{ %else + pop + ux l mul uy l mul rlineto + } ifelse + stroke + end +} bind def /bracket_traject {