Toewe - 2015-12-29

It has long bothered me that the squared plot type has ragged corners on the ploted lines if the line width is greater than 1. The lines below were added/removed from the current (version 6.2.0) phplot.php file at line 8075 to accomplish truely square corners. There may be a more elegant method to accomplish the same result, but this works for me.

The basic idea is to extend the length of each end of each line by half the line width.

$fudge = intval( $this->line_widths[$idx] / 2 );
$fudge1 = ( $this->line_widths[$idx] % 2 == 0 ) ? $fudge-1 : $fudge;
$fudge2 = ( $y_mid > $y_now_pixels ) ? $fudge-1 : -$fudge;
$fudge3 = ( $y_mid > $y_now_pixels ) ? $fudge : -$fudge+1;
ImageLine($this->img, $lastx[$idx]-$fudge, $y_mid, $x_now_pixels+$fudge1, $y_mid, $style);
ImageLine($this->img, $x_now_pixels, $y_mid+$fudge2, $x_now_pixels, $y_now_pixels-$fudge3, $style);
// ImageLine($this->img, $lastx[$idx], $y_mid, $x_now_pixels, $y_mid, $style);
// ImageLine($this->img, $x_now_pixels, $y_mid, $x_now_pixels, $y_now_pixels, $style);