diff --git a/src/Rasterization/Renderers/EllipseRenderer.php b/src/Rasterization/Renderers/EllipseRenderer.php index 7c026e2..9feee80 100644 --- a/src/Rasterization/Renderers/EllipseRenderer.php +++ b/src/Rasterization/Renderers/EllipseRenderer.php @@ -42,7 +42,7 @@ protected function prepareRenderParams(array $options, Transform $transform, ?Fo */ protected function renderFill($image, $params, int $color): void { - imagefilledellipse($image, $params['cx'], $params['cy'], $params['width'], $params['height'], $color); + imagefilledellipse($image, (int)round($params['cx']), (int)round($params['cy']), (int)round($params['width']), (int)round($params['height']), $color); } /** @@ -52,16 +52,10 @@ protected function renderStroke($image, $params, int $color, float $strokeWidth) { imagesetthickness($image, round($strokeWidth)); - $width = $params['width']; - if ($width % 2 === 0) { - $width += 1; - } - $height = $params['height']; - if ($height % 2 === 0) { - $height += 1; - } + $width = (int)round($params['width']) | 1; + $height = (int)round($params['height']) | 1; // imageellipse ignores imagesetthickness; draw arc instead - imagearc($image, $params['cx'], $params['cy'], $width, $height, 0, 360, $color); + imagearc($image, (int)round($params['cx']), (int)round($params['cy']), $width, $height, 0, 360, $color); } } diff --git a/src/Rasterization/Renderers/LineRenderer.php b/src/Rasterization/Renderers/LineRenderer.php index dcb4309..a31d3d4 100644 --- a/src/Rasterization/Renderers/LineRenderer.php +++ b/src/Rasterization/Renderers/LineRenderer.php @@ -51,6 +51,6 @@ protected function renderFill($image, $params, int $color): void protected function renderStroke($image, $params, int $color, float $strokeWidth): void { imagesetthickness($image, round($strokeWidth)); - imageline($image, $params['x1'], $params['y1'], $params['x2'], $params['y2'], $color); + imageline($image, (int)round($params['x1']), (int)round($params['y1']), (int)round($params['x2']), (int)round($params['y2']), $color); } }