php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27385 GD: Eliptical fills don't work with translucent colours
Submitted: 2004-02-24 17:51 UTC Modified: 2004-03-15 08:09 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: nih at phlux dot co dot uk Assigned:
Status: Wont fix Package: GD related
PHP Version: 4CVS, 5CVS (2004-02-24) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nih at phlux dot co dot uk
New email:
PHP Version: OS:

 

 [2004-02-24 17:51 UTC] nih at phlux dot co dot uk
Description:
------------
The elliptical drawing tools in the GD library that offer a fill function do not correctly render the fill when using a translucent colour. It would appear that the fill is drawn by a series of lines from the centre point to each pixel around the edge of the ellipse or arc, thus pixels near the centre are drawn over many times, thus increasing the effective alpha of those pixels.

Reproduce code:
---------------
<?php

$img = imagecreatetruecolor(100, 100);
imageantialias($img, FALSE);
$blue = imagecolorallocatealpha($img, 0, 0, 255, 50);

imagefilledarc($img, 5, 5, 170, 170, 0, 85, $blue, 4);

header("Content-type: image/png");
imagepng($img);
imagedestroy($img);

?>

Expected result:
----------------
There should be a PNG image output of an arc of a 170px diameter going from a bearing of 090 to a bearing of 175 in 50% transparent pure RGB blue (0, 0, 255).

Actual result:
--------------
The transparency isn't correct, the closer towards the centre of the arc the pixel is, the lower it's transparency (I'm almost certain it's because they are being redrawn over and over).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-24 18:14 UTC] derick@php.net
Did you use the bundled GD library or the external one. (In short: what is your configure line?)
 [2004-02-24 18:30 UTC] nih at phlux dot co dot uk
I used the bundled GD library.
 [2004-03-15 08:09 UTC] pajoye@php.net
hello,

This is a known problem of the gd arcs functions. It's due to the ellipse approximation which is based on the radius angle and not  on the x/y positions. That means that the filled lines can be drawn many times. A complete rewrite of this funciton is required, something like what is done in imagefilledellipse.

pierre
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC