Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiled truecolor filling looses single color transparency #17349

Closed
cmb69 opened this issue Jan 3, 2025 · 0 comments
Closed

Tiled truecolor filling looses single color transparency #17349

cmb69 opened this issue Jan 3, 2025 · 0 comments

Comments

@cmb69
Copy link
Member

cmb69 commented Jan 3, 2025

Description

The following code:

<?php
$tile = imagecreatetruecolor(8, 8);
$red = imagecolorallocate($tile, 255, 0, 0);
imagefilledrectangle($tile, 0, 0, 7, 7, $red);
imagecolortransparent($tile, $red);

$im = imagecreatetruecolor(64, 64);
$bg = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 63, 63, $bg);
imagecolortransparent($im, $bg);
$fg = imagecolorallocate($im, 0, 0, 0);
imageellipse($im, 31, 31, 50, 50, $fg);
imagesettile($im, $tile);
imagealphablending($im, false);
imagefill($im, 31, 31, IMG_COLOR_TILED);

imagegif($im);

Resulted in this output with the bundled libgd:
fill-bad

But I expected this output instead (like with external libgd):
fill-good

PHP Version

PHP 8.3

Operating System

any

@cmb69 cmb69 self-assigned this Jan 3, 2025
cmb69 added a commit to cmb69/php-src that referenced this issue Jan 4, 2025
…ency

This is porting the relevant part of a previous upstream commit[1] to
align the behavior of our bundled libgd with upstream.  It should be
noted that this only works if the image actually has a transparent
color.

[1] <libgd/libgd@4770e2b>
@cmb69 cmb69 closed this as completed in 2c658f4 Jan 4, 2025
cmb69 added a commit that referenced this issue Jan 4, 2025
* PHP-8.3:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
cmb69 added a commit that referenced this issue Jan 4, 2025
* PHP-8.4:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant