[libGD] #79 [Comment added] arc's are drawn incorrectly (plus regression in 2.0.35RC2)

[email protected] (libGD) Wed, 09 May 2007 03:44:40 +0000
Newsgroups php.gd.bugs
Message-ID <[email protected]>
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#79 - arc's are drawn incorrectly (plus regression in 2.0.35RC2)
User who did this - Colen Garoutte-Carson (Colen)

----------
<code>
$im = new GD::Image($width, $height, 1);
$im->alphaBlending(0);
$im->saveAlpha(1);
$transparent = $im->colorAllocateAlpha(0,0,0,127);
$im->fill(0,0,$transparent);
$im->setAntiAliased($red);
$im->setThickness(6);
@prevpts = ( $center, $center + $radius );
for ($i=0;$i<=360;$i++)
{
	@newpts = &RotatePointAroundOrigin($center, $center, $center, $center + $radius, $i);
	$im->line($prevpts[0], $prevpts[1], $newpts[0], $newpts[1], gdAntiAliased);
	@prevpts = @newpts;
}
</code>

This is what I used to generate test2.png.  I see the same affect with arcs, but this demonstrates that lines are affected as well.  When output to a PNG image, there are 2 problems:

1) The lines are anti-aliased against the wrong background color.  If you view the image over a white background, you will see that the lines were anti-aliased against black (instead of anti-aliased using alpha, such as text rendered by stringFT would be).  If you set the thickness to 1, you will see the same problem.  This is a problem with anti-aliased lines (with thickness==1) and alpha transparency, and is not related to thickness >1 or arc's.

2) Angled lines are rendered differently than horizontal and vertical lines.  In some conditions, you are are using the requested thickness and not anti-aliasing.  In other conditions, you are anti-aliasing, but reducing the thickness to 1.  Since my drawning code is independant of the output format, my suggestion would be to always disable anti-aliasing and use the requested thickness, when thickness >1 is requested.  That would be the closest to the desired effect, and would make the image look more consistent across output formats.  

 - Colen


----------

More information can be found at the following URL:
http://bugs.libgd.org/?do=details&task_id=79#comment252

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.