You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
use v5.30;
|
|
|
|
# use Getopt::Long;
|
|
use SVG;
|
|
|
|
my $width = 400;
|
|
my $height = 300;
|
|
my $origin_x = 0;
|
|
my $origin_height = 100;
|
|
my $corner_radius = 25;
|
|
my $gap_start = 50;
|
|
my $gap_width = 50;
|
|
|
|
my $full_height = $height + $origin_height;
|
|
|
|
my $svg = SVG->new(width => $width, height => $full_height, viewBox => "0 0 $width $full_height");
|
|
|
|
my $path_string = "M $gap_start,$height";
|
|
$path_string .= L($origin_x,$full_height);
|
|
$path_string .= L($gap_start + $gap_width,$height);
|
|
$path_string .= L($width - $corner_radius, $height);
|
|
$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, $corner_radius, -$corner_radius);
|
|
$path_string .= l(0, -($height - 2*$corner_radius));
|
|
$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, -$corner_radius, -$corner_radius);
|
|
$path_string .= l(-($width - 2*$corner_radius),0);
|
|
$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, -$corner_radius, $corner_radius);
|
|
$path_string .= l(0, ($height - 2*$corner_radius));
|
|
$path_string .= a($corner_radius, $corner_radius, 0, 0, 0, $corner_radius, $corner_radius);
|
|
|
|
$path_string .= " Z";
|
|
my $path = $svg->path(d => $path_string, stroke => 'black', fill => 'white');
|
|
|
|
say $svg->render();
|
|
|
|
sub L { " L " . join(",", @_); }
|
|
sub l { " l " . join(",", @_); }
|
|
sub a { " a $_[0],$_[1] $_[2] $_[3] $_[4] $_[5],$_[6]"; }
|
|
|