diff options
Diffstat (limited to 'common/Util/CairoUtil.py')
-rw-r--r-- | common/Util/CairoUtil.py | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/common/Util/CairoUtil.py b/common/Util/CairoUtil.py index 7918210..57a05ce 100644 --- a/common/Util/CairoUtil.py +++ b/common/Util/CairoUtil.py @@ -8,7 +8,7 @@ def get_gdk_color(str_color): result, color = Gdk.Color.parse(str_color) return color -def draw_round_rect(ctx, x, y, width, height, radio=10): +def draw_round_rect(ctx, x, y, width, height, radio=20): # Move to A ctx.move_to(x + radio, y) # Straight line to B @@ -30,15 +30,39 @@ def draw_round_rect(ctx, x, y, width, height, radio=10): ctx.curve_to(x, y, x, y, x + radio, y) def draw_drum_mask(ctx, x, y, size): - side = size / 3 + side = size / 4 ctx.move_to(x + side, y) ctx.new_path() - ctx.line_to(x + side * 2, y) + ctx.line_to(x + size - side, y) ctx.line_to(x + size, y + side) - ctx.line_to(x + size, y + side * 2) - ctx.line_to(x + side * 2, y + size) + ctx.line_to(x + size, y + size - side) + ctx.line_to(x + size - side, y + size) ctx.line_to(x + side, y + size) - ctx.line_to(x, y + side * 2) + ctx.line_to(x, y + size - side) ctx.line_to(x, y + side) ctx.line_to(x + side, y) ctx.close_path() + +def draw_loop_mask(ctx, x, y, width, height, radio=20): + # Move to A + ctx.move_to(x, y) + # Straight line to B + ctx.line_to(x + width - radio, y) + # Curve to C, Control points are both at Q + ctx.curve_to(x + width, y, x + width, y, x + width, y + radio) + # Move to D + ctx.line_to(x + width, y + height - radio) + # Curve to E + ctx.curve_to(x + width, y + height, x + width, y + height, + x + width - radio, y + height) + # Line to F + ctx.line_to(x, y + height) + radio = radio / 3 + # Curve to G + ctx.curve_to(x - radio, y + height, + x + radio, y + height, + x + radio, y + height - radio) + # Line to H + ctx.line_to(x + radio, y + radio) + # Curve to A + ctx.curve_to(x + radio, y, x, y, x - radio, y) |