- 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_square_block (expr bottom_left, top_right) =
- save x,y;
+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;
+