You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to add antialiasing to all drawing methods. The imageantialias method states it works for lines and ellipses, but it doesn't support alpha components.
I would prefer a solution that works for all shapes, although it may not be possible without writing our own shape methods (prefer not to do). This may simply be a limitation of GD.
Arc
Ellipse
Line
Polygon
Rounded rectangle
Supports $thickness
Supports $alpha (transparency)
The text was updated successfully, but these errors were encountered:
I experimented with the zoom trick and the line method today. The results were good, but extremely slow and memory intensive. Here's a sample for anyone who wants to play with it:
publicfunctionline($x1, $y1, $x2, $y2, $color, $thickness = 1) {
// Create a new image $zoom times the original's size$zoom = 4;
$new = newSimpleImage();
$new->fromNew($this->getWidth() * $zoom, $this->getHeight() * $zoom, 'transparent');
$color = $new->allocateColor($color);
// Set thicknessimagesetthickness($new->image, $thickness * $zoom);
imageline($new->image, $x1 * $zoom, $y1 * $zoom, $x2 * $zoom, $y2 * $zoom, $color);
// Now scale it down and lay it on top of the original to produce an antialias effect$new->resize($this->getWidth(), $this->getHeight());
$this->overlay($new);
$new->__destruct();
return$this;
}
You can change $zoom. 1 = no zoom, 2 = 2x zoom, etc. Here's what 1 - 4 look like (download to see full size image):
Given the slow speed and memory usage, I don't think the zoom trick will be a good candidate for supporting antialiasing. 😭
I'd love to add antialiasing to all drawing methods. The
imageantialias
method states it works for lines and ellipses, but it doesn't support alpha components.I would prefer a solution that works for all shapes, although it may not be possible without writing our own shape methods (prefer not to do). This may simply be a limitation of GD.
$thickness
$alpha
(transparency)The text was updated successfully, but these errors were encountered: