]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-macros.mf
patch::: 1.3.10.jcn2
[lilypond.git] / mf / feta-macros.mf
index 01a314f985eb34d61a4b17931a81db6015ff28f3..e0b10ca4479455eaff7a4cde80d1994933d190eb 100644 (file)
@@ -17,6 +17,14 @@ def treq =
 enddef;
 
 
+def draw_staff(expr first, last, offset)=
+       pickup pencircle scaled stafflinethickness;
+       for i:= first step 1 until last:
+               draw (- interline, (i + offset) * interline) .. (4 interline,( i+ offset)* interline);
+       endfor
+       enddef;
+
+
 %
 % Transforms
 %
@@ -100,6 +108,27 @@ def distorted_ellipse(expr a,b,err_y,err_x,super) =
        superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
        enddef;
 
+% stolen from feta-eindelijk, but still
+% FIXME: too high
+def draw_block (expr bottom_left, top_right) =
+       pickup pencircle scaled blot_diameter;
+
+       begingroup;
+       save x,y;
+       bot y1 = ypart bottom_left;
+       top y2 = ypart top_right;
+       y3 = y2;
+       y4 = y1;
+
+       rt x1 = xpart top_right;
+       x2 = x1;
+       lft x3 = xpart bottom_left;
+       x4 = x3;
+
+       filldraw z1--z2--z3--z4--cycle;
+       endgroup;
+       enddef;
+
 def draw_brush(expr a,w,b,v) =
        save x,y;
        z1=a; z2=b;
@@ -113,6 +142,25 @@ def draw_brush(expr a,w,b,v) =
        fill z3r{z3r-z5l}..z4l..{z5r-z3l}z3l..z5r{z5r-z3l}..z6l..{z3r-z5l}z5l..cycle;
 enddef;
 
+def draw_flare(expr pos,alpha,beta,line,flare) =
+       begingroup;
+       clearxy;
+       penpos1(line,180+beta+alpha);
+       z1r=pos;
+       penpos2(flare,180+beta+alpha);
+       z2=z3;
+       penpos3(flare,0+alpha);
+       z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta);
+       z4=z2r-line*dir(alpha);
+       penlabels(1,2,3,4);
+       pickup pencircle;
+       save t; t=0.833;
+       fill z1r{dir(alpha)}..z3r{dir(180+alpha-beta)}..z2l{dir(alpha+180)}
+               ..z3l{dir(180+alpha+beta)}..tension t
+               ..z4{dir(180+alpha+beta)}..z1l{dir(alpha+180)}..cycle;
+       endgroup;
+       enddef;
+
 def brush(expr a,w,b,v) =
        begingroup;
        draw_brush(a,w,b,v);    
@@ -120,16 +168,10 @@ def brush(expr a,w,b,v) =
        endgroup;
 enddef;
 
-def draw_rounded_path(expr p, thick) =
-       push_pen(currentpen);
-       fill p;
-       pickup pencircle scaled thick;
-       draw p;
-       currentpen := pop_pen;
-enddef;
-
-%
 %
+% Draw a (rest) crook, starting at thickness STEM in point A,
+% ending a ball W to the left, diameter BALLDIAM
+% ypart of the center of the ball is BALLDIAM/4 lower than ypart A
 %
 def balled_crook(expr a, w, balldiam, stem) =
 begingroup;
@@ -160,3 +202,25 @@ def xy_mirror_char =
        currentpicture := currentpicture scaled -1;
        set_char_box(charwd, charbp, charht, chardp);
 enddef;
+
+%
+% center_factor: typically .5, the larger, the larger the radius of the bulb
+% radius factor: how much the bulb curves inward
+%
+def draw_bulb(expr turndir, zl, zr, bulb_rad, radius_factor)=
+       begingroup;
+       clearxy;
+       save rad, ang;
+
+       ang = angle(zr-zl);
+       z0 = zr + bulb_rad * (zl-zr)/length(zr -zl);
+       rad =  bulb_rad;
+
+       z1 = z0 + radius_factor* rad * dir(ang + turndir* 100);
+       z2 = z0 + rad * dir(ang  + turndir*300);
+       labels(0,1,2);
+       fill zr{dir (ang + turndir* 90)} .. z1 .. z2 -- cycle;
+
+       endgroup
+enddef;