Project

General

Profile

Bug #14537 » 0000760-class.t3lib_stdgraphic.diff

Administrator Admin, 2005-02-24 20:26

View differences:

class.t3lib_stdgraphic.php Thu Feb 24 13:12:09 2005
var $cmds = Array (
'jpg' => '',
'jpeg' => '',
'gif' => '-colors 64',
'png' => '-colors 64'
'gif' => '', //no limit as gif supports 256 colors only anyway
'png' => '-colors 65536'
);
var $NO_IMAGE_MAGICK = '';
var $V5_EFFECTS = 0;
......
$theMask2 = $tmpStr.'_mask2.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
// prepare overlay image
$cpImg = $this->imageCreateFromGif($BBimage[3]);
$destImg = imagecreate($w,$h);
$destImg = imagecreatetruecolor($w,$h);
ImageColorAllocate($destImg, 0,0,0);
$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
$this->ImageGif($destImg, $theImage);
......
imageDestroy($destImg);
// prepare mask image
$cpImg = $this->imageCreateFromGif($BBmask[3]);
$destImg = imagecreate($w,$h);
$destImg = imagecreatetruecolor($w,$h);
ImageColorAllocate($destImg, 0,0,0);
$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
$this->ImageGif($destImg, $theMask);
......
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!
$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);
$this->reduceColors($im,65536, 65536);
$Fcolor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
// antiAliasing is setup:
$Fcolor = ($conf['antiAlias']) ? $Fcolor : -$Fcolor;
......
$newH = ceil($sF*imagesy($im));
// Make mask
$maskImg = imagecreate($newW, $newH);
$maskImg = imagecreatetruecolor($newW, $newH);
ImageColorAllocate($maskImg, 255,255,255);
$Fcolor = ImageColorAllocate($maskImg, 0,0,0);
if ($spacing || $wordSpacing) { // If any kind of spacing applys, we use this function:
......
$this->imageMagickExec($fileMask,$fileMask,$command);
// Make the color-file
$colorImg = imagecreate($w,$h);
$colorImg = imagecreatetruecolor($w,$h);
ImageColorAllocate($colorImg, $cols[0],$cols[1],$cols[2]);
$this->ImageGif($colorImg, $fileColor);
ImageDestroy($colorImg);
......
$fileMask = $tmpStr.'_mask.'.$this->gifExtension;
// BlurColor Image laves
$blurColImg = imagecreate($w,$h);
$blurColImg = imagecreatetruecolor($w,$h);
$bcols=$this->convertColor($conf['color']);
ImageColorAllocate($blurColImg, $bcols[0],$bcols[1],$bcols[2]);
$this->ImageGif($blurColImg, $fileColor);
ImageDestroy($blurColImg);
// The mask is made: BlurTextImage
$blurTextImg = imagecreate($w+$blurBorder*2,$h+$blurBorder*2);
$blurTextImg = imagecreatetruecolor($w+$blurBorder*2,$h+$blurBorder*2);
ImageColorAllocate($blurTextImg, 0,0,0); // black background
$txtConf['fontColor'] = 'white';
$blurBordArr = Array($blurBorder,$blurBorder);
......
if ($blurTextImg_tmp) { // if nothing went wrong we continue with the blurred mask
// cropping the border from the mask
$blurTextImg = imagecreate($w,$h);
$blurTextImg = imagecreatetruecolor($w,$h);
$this->imagecopyresized($blurTextImg, $blurTextImg_tmp, 0, 0, $blurBorder, $blurBorder, $w, $h, $w, $h);
ImageDestroy($blurTextImg_tmp); // Destroy the temporary mask
......
$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);
$this->reduceColors($im,65536, 65536);
$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);
......
$conf['offset']=$cords[0].','.$cords[1];
$cords = $this->objPosition($conf,$this->workArea,Array($cords[2],$cords[3]));
$newIm = imagecreate($cords[2],$cords[3]);
$newIm = imagecreatetruecolor($cords[2],$cords[3]);
$cols=$this->convertColor($conf['backColor']?$conf['backColor']:$this->setup['backColor']);
ImageColorAllocate($newIm, $cols[0],$cols[1],$cols[2]);
......
*/
function combineExec($input,$overlay,$mask,$output) {
if (!$this->NO_IMAGE_MAGICK) {
$cmd = $this->imageMagickPath.$this->combineScript.' -compose over '.$this->wrapFileName($input).' '.$this->wrapFileName($overlay).' '.$this->wrapFileName($mask).' '.$this->wrapFileName($output);
$cmd = $this->imageMagickPath.$this->combineScript.' -compose over -quality '.intval($gfxConf['im_jpg_quality']).' '.$this->wrapFileName($input).' '.$this->wrapFileName($overlay).' '.$this->wrapFileName($mask).' '.$this->wrapFileName($output);
$this->IM_commands[] = Array ($output,$cmd);
exec($cmd);
}
......
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));
$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)
......
// If non of the above:
$i = @getimagesize($sourceImg);
$im = imagecreate($i[0],$i[1]);
$im = imagecreatetruecolor($i[0],$i[1]);
ImageColorAllocate($im, 128,128,128);
return $im;
}
(2-2/10)