Project

General

Profile

Bug #14537 » class.t3lib_stdgraphic.php-t3_380b1-reducecolor.patch

Administrator Admin, 2005-05-09 13:48

View differences:

class.t3lib_stdgraphic.php 2005-04-07 15:44:03.552021800 +0200
'jpg' => '',
'jpeg' => '',
'gif' => '-colors 64',
'png' => '-colors 64'
'png' => '-colors 65536'
);
var $NO_IMAGE_MAGICK = '';
var $V5_EFFECTS = 0;
......
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
$this->makeEffect($im, Array('value'=>'colors=256')); // Reduce colors to 256 - make SURE that IM is working then!
// Masi: is it safe to reduce to that many colours?
$this->makeEffect($im, Array('value'=>'colors=65536')); // Reduce colors to 256 - make SURE that IM is working then!
} else {
imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
}
......
// NiceText is calculated
if (!$conf['niceText']) {
// Font Color is reserved:
$this->reduceColors($im,256, 200);
if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') {
$this->reduceColors($im,256, 200);
}
$Fcolor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
// antiAliasing is setup:
$Fcolor = ($conf['antiAlias']) ? $Fcolor : -$Fcolor;
......
$conf['offset']=$cords[0].','.$cords[1];
$cords = $this->objPosition($conf,$workArea,Array($cords[2],$cords[3]));
$cols=$this->convertColor($conf['color']);
$this->reduceColors($im,256, 255);
if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') {
$this->reduceColors($im,256, 255);
}
$tmpColor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
imagefilledrectangle($im, $cords[0], $cords[1], $cords[0]+$cords[2]-1, $cords[1]+$cords[3]-1, $tmpColor);
}
......
$commands.=' -flop';
break;
case 'colors':
$commands.=' -colors '.t3lib_div::intInRange($value,2,255);
$commands.=' -colors '.t3lib_div::intInRange($value,2,65535);
break;
case 'shear':
$commands.=' -shear '.t3lib_div::intInRange($value,-90,90);
......
if ($this->ImageGif($this->im, $file)) {
// ImageMagick operations
if($this->setup['reduceColors']) {
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255));
if ($ext == 'gif')
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255));
else
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,65535));
t3lib_div::gif_compress($file,''); // Compress with IM (lzw) or GD (rle) (Workaround for the absence of lzw-compression in GD)
} else {
t3lib_div::gif_compress($file, 'IM'); // Compress with IM! (adds extra compression, LZW from ImageMagick) (Workaround for the absence of lzw-compression in GD)
(5-5/10)