|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27582 ImageFillToBorder on alphablending image now loose alpha on fill color
Submitted: 2004-03-12 18:52 UTC Modified: 2006-01-06 15:30 UTC
Avg. Score:4.6 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:3 (60.0%)
From: panda dot management at free dot fr Assigned: pajoye (profile)
Status: Wont fix Package: GD related
PHP Version: 4.3.5RC4-dev Mar 14 2004 22:12:48 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: panda dot management at free dot fr
New email:
PHP Version: OS:


 [2004-03-12 18:52 UTC] panda dot management at free dot fr

ImageFillToBorder seems to act strangely (no output) when using alpha channel (?) on color and / or bordercolor values, on an alphablending image.

apache 2.0.48
php 4.3.4 / 4.3.5RC3
gd2 module loaded

Reproduce code:
$im = ImageCreateTrueColor(10, 10);
imagealphablending($im, true);
imagesavealpha($im, false);
$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
ImageFillToBorder($im, 5, 5, $bordercolor, $color);

Expected result:
Do work as supposed to, or output some error.

Actual result:
Actual result:
Browser hangs and output an alert "Document contains no data".
I'm not experienced enough to give you more debug details... but it obviously break something...

Additionnal comment:
The values that trigger the bug seems to be pretty much random.
You can reproduce the problem with:
  $bordercolor=ImageColorAllocateAlpha($im, 0, 254, 0, 0);
  $color = ImageColorAllocateAlpha($im, 0, 255, 255, 75);
Or even reproduce it with:
  $bordercolor=ImageColorAllocate($im, 0, 254, 0);
  $color = ImageColorAllocateAlpha($im, 0, 255, 255, 75);
(wich is much more logical on an alphablending image...)
But odly it works ok with:
  $bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 0);
  $color = ImageColorAllocateAlpha($im, 0, 255, 255, 75);

I can't find any coherence in the problematic values, except that they involve alpha channel.

If this is a doc problem, or if I missed something, please forgive this report...

Anyway, long life to php.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-14 21:47 UTC] panda dot management at free dot fr

Using PHP Version 4.3.5RC4-dev Mar 14 2004 22:12:48.

The first described bug is fixed, but we now loose the ability to use a fill color with an alpha channel.

$res=imagecreatetruecolor(100, 100);
imagealphablending($res, 1);
imagesavealpha($res, 0);
$border=imagecolorallocate($res, 150, 0, 0);
$back=imagecolorallocatealpha($res, 0, 255, 0, 100);
$fill=imagecolorallocatealpha($res, 255, 0, 0, 125);
// This fill the image with a very light layer of green
imagefill($res, 0, 0, $back);
// Draw a diagonal
imageline($res, 0, 0, 100, 100, $border);
// This should fill half with a very light layer of red
imagefilltoborder($res, 100, 50, $border, $fill);
imagepng($res, 'bugtest.png');
echo '<img src="bugtest.png"/>';

Actual result:
imagefilltoborder doesn't take the alpha channel of fill color into account.

Expected result:
imagefilltoborder (on alpha blending images) should use alpha channel on the color to fill, IMHO because:
- when using Non Alpha Blending images, it does.
- and imagefill on alphablending images does also.

Additionnal comment:

Thank you Pierre for the quick fix to the first bug!
Hope this sequel will find its solution soon.

See ya!
 [2004-03-15 03:19 UTC]

Sorry, this function does not work with blending mode. I was forced to desactivate it. Using a blending mode will result in an infinite loop and recursive calls with the current implementation (blending over endlessly). A second case where it fails is when you have a lot of small open segments (see ext/gd/tests/bug27852_1.phpt).

I cannot fix it before the next php4 and php5 (rc1) release. I have to rewrite the function.


 [2006-01-06 15:30 UTC]
Pierre said this is not fixable.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 30 16:01:24 2023 UTC