- save round;
- round = floor min(roundness,xpart (top_right-bottom_left),
- ypart (top_right-bottom_left));
-
-
- pickup pencircle scaled round;
-
- begingroup;
- save x,y;
- z2+(round/2,round/2) = top_right;
- z4-(round/2,round/2) = bottom_left;
- y3 = y2;
- y4 = y1;
- x2 = x1;
- x4 = x3;
- fill bot z1 .. rt z1 --- rt z2 .. top z2 ---
- top z3 .. lft z3 --- lft z4 .. bot z4 --- cycle;
- endgroup;
- enddef;
-
-
-
- def draw_block (expr bottom_left, top_right) =
- draw_rounded_block (bottom_left, top_right, blot_diameter);
- enddef;
-
- def draw_gridline (expr bottom_left,top_right,thickness) =
- draw_rounded_block (bottom_left-(thickness/2,thickness/2),
- top_right+(thickness/2,thickness/2),
- thickness);
- enddef;
-
-
-def draw_brush(expr a,w,b,v) =
- save x,y;
- z1=a; z2=b;
- penpos3(w,angle(z2-z1)+90);
- penpos4(w,angle(z2-z1));
- penpos5(v,angle(z1-z2)+90);
- penpos6(v,angle(z1-z2));
+begingroup;
+ save size;
+ save x, y;
+
+ % Originally, there was `floor' instead of `round', but this is
+ % not correct because pens use `round' also.
+ size = round min (roundness,
+ xpart (top_right - bottom_left),
+ ypart (top_right - bottom_left));
+
+ z2 + (size / 2, size / 2) = top_right;
+ z4 - (size / 2, size / 2) = bottom_left;
+ y3 = y2;
+ y4 = y1;
+ x2 = x1;
+ x4 = x3;
+
+ pickup pencircle scaled size;
+
+ fill bot z1{right}
+ .. rt z1{up}
+ -- rt z2{up}
+ .. top z2{left}
+ -- top z3{left}
+ .. lft z3{down}
+ -- lft z4{down}
+ .. bot z4{right}
+ -- cycle;
+endgroup;
+enddef;
+
+
+def draw_block (expr bottom_left, top_right) =
+ draw_rounded_block (bottom_left, top_right, blot_diameter);
+enddef;
+
+
+def draw_square_block (expr bottom_left, top_right) =
+ save x, y;
+
+ x1 = xpart bottom_left;
+ y1 = ypart bottom_left;
+ x2 = xpart top_right;
+ y2 = ypart top_right;
+
+ fill (x1, y1)
+ -- (x2, y1)
+ -- (x2, y2)
+ -- (x1, y2)
+ -- cycle;
+enddef;
+
+
+def draw_gridline (expr bottom_left, top_right, thickness) =
+ draw_rounded_block (bottom_left - (thickness / 2, thickness / 2),
+ top_right + (thickness / 2, thickness / 2),
+ thickness);
+enddef;
+
+
+def draw_brush (expr a, w, b, v) =
+ save x, y;
+
+ z1 = a;
+ z2 = b;