sub _thick_line { my ($image, $thickness, $color, $x1, $y1, $x2, $y2) = @_; my $angle = atan2 $x2-$x1, $y2-$y1; my $mirror = atan2 $y1-$y2, $x2-$x1; # perpendicular angle my $dx = $thickness*sin($mirror)/2; my $dy = $thickness*cos($mirror)/2; $image->polygon( aa => 1, color => $color, points => [ [$x1 + $dx, $y1 + $dy], # top left [$x2 + $dx, $y2 + $dy], # top right [$x2 - $dx, $y2 - $dy], # bottom right [$x1 - $dx, $y1 - $dy], # bottom left ], ); }