Project

General

Profile

Bug #32781 » transparent-backColor-fixes.diff

Georg Großberger, 2011-12-22 13:18

View differences:

t3lib/class.t3lib_stdgraphic.php
// preserve alpha transparency
if ($this->saveAlphaLayer) {
imagealphablending($destImg, FALSE);
imagesavealpha($destImg, TRUE);
$Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
imagefill($destImg, 0, 0, $Bcolor);
......
$cpImg = $this->imageCreateFromFile($BBmask[3]);
$destImg = imagecreatetruecolor($w, $h);
if ($this->saveAlphaLayer) {
imagealphablending($destImg, FALSE);
imagesavealpha($destImg, TRUE);
$Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
imagefill($destImg, 0, 0, $Bcolor);
......
function imagecopyresized(&$im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h) {
if ($this->imagecopyresized_fix) {
$im_base = imagecreatetruecolor(imagesx($im), imagesy($im)); // Make true color image
if ($this->saveAlphaLayer) {
$transparentColor = imagecolorallocatealpha($im_base, 0, 0, 0, 127);
imagefill($im_base, 0, 0, $transparentColor);
imagesavealpha($im_base, TRUE);
}
imagecopyresized($im_base, $im, 0, 0, 0, 0, imagesx($im), imagesy($im), imagesx($im), imagesy($im)); // Copy the source image onto that
imagecopyresized($im_base, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h); // Then copy the $cpImg onto that (the actual operation!)
$im = $im_base; // Set pointer
......
if (function_exists('imagecreatefrompng')) {
$imageHandle = imageCreateFromPng($sourceImg);
if ($this->saveAlphaLayer) {
imagealphablending($imageHandle, FALSE);
imagesavealpha($imageHandle, TRUE);
}
return $imageHandle;
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php
&& (empty($this->setup['format']) || $this->setup['format'] === 'png')) {
// Set transparency properties
imagealphablending($this->im, FALSE);
imagesavealpha($this->im, TRUE);
// Fill with a transparent background
(1-1/3)