-
-% 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
+/draw_partial_ellipse % filled connect x-radius y-radius startangle endangle thickness draw_partial_ellipse
+% Note that filled is not boolean to permit for different graylevels (ie for trill keys)
+{
+ gsave
+ currentpoint translate
+ /thickness exch def
+ /endangle exch def
+ /startangle exch def
+ /y_radius exch def
+ /x_radius exch def
+ /endrad x_radius y_radius mul
+ x_radius x_radius mul
+ endangle cos endangle cos mul mul
+ y_radius y_radius mul
+ endangle sin endangle sin mul mul add sqrt div def
+ /endangle endangle sin endrad mul y_radius div
+ endangle cos endrad mul x_radius div atan def
+ /startrad x_radius y_radius mul
+ x_radius x_radius mul
+ startangle cos startangle cos mul mul
+ y_radius y_radius mul
+ startangle sin startangle sin mul mul add sqrt div def
+ /startangle startangle sin startrad mul y_radius div
+ startangle cos startrad mul x_radius div atan def
+ /connect exch def
+ /filled exch def
+ /savematrix matrix currentmatrix def
+ thickness setlinewidth
+ x_radius y_radius scale
+ startangle cos startangle sin moveto
+ 0 0 1 startangle
+ startangle endangle eq { endangle 360 add } { endangle } ifelse
+ arc
+ connect {
+ startangle cos startangle sin moveto endangle cos endangle sin lineto }
+ if
+ savematrix setmatrix filled { stroke_and_fill } { stroke } ifelse
+ grestore