php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34020 ImagePolygon draws broken lines when using Antialiasing
Submitted: 2005-08-06 19:02 UTC Modified: 2015-04-15 13:29 UTC
Votes:5
Avg. Score:4.4 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: yorick at gmx dot ch Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.2.6 OS: *
Private report: No CVE-ID: None
 [2005-08-06 19:02 UTC] yorick at gmx dot ch
Description:
------------
ImagePolygon draws broken lines when Antialiasing is 
enabled. See example at http://
glassdbase.unibas.ch/test.php

Reproduce code:
---------------
<?php
$image = imagecreatetruecolor(500, 300);
$bg = imagecolorallocate($image, 0, 0, 0);
$col_poly = imagecolorallocate($image, 255, 255, 255);
$poly = array(35, 190, 42, 191, 45, 192, 48, 186, 51, 182, 63, 180, 78, 175, 91, 177, 115, 185,
		121, 184,
		131, 177,
		174, 133,
		201, 121,
		429, 60,
		435, 82,
		435, 260,
		35, 260
);
imageantialias($image, true);
imagepolygon($image, $poly, count($poly) / 2, $col_poly);
header("Content-type: image/png");
imagepng($image);
?> 

Expected result:
----------------
An antialiased polygon (=no interruption) as described 
in documentation.

Actual result:
--------------
See output of above example at http://
glassdbase.unibas.ch/test.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-06 19:06 UTC] pajoye@php.net
Blending does that. I will try to figure out how to fix that.

--Pierre
 [2005-08-06 19:13 UTC] yorick at gmx dot ch
If you need more examples let me know.

It's often happening at places where the 'curve' comes 
close to 45 degrees and is ascending. I know this might 
sound weird but I've seen tons of cases where these 2 
facts seem to be present.
 [2005-08-06 19:36 UTC] pajoye@php.net
I do not need more examples, as I said, it seems to be a blending problem, pixel are blended 2 times near the intersections.
 [2005-12-26 17:27 UTC] sniper@php.net
Assuming this happens also with PHP 5.
 [2015-04-15 13:29 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2015-04-15 13:29 UTC] cmb@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Fixed since at least GD 2.1.0
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 24 12:05:45 2022 UTC