📜  PHP | imagickdraw setTextAntialias()函数

📅  最后修改于: 2022-05-13 01:56:24.902000             🧑  作者: Mango

PHP | imagickdraw setTextAntialias()函数

ImagickDraw::setTextAntialias()函数是PHP中的一个内置函数,用于控制文本是否抗锯齿。默认情况下,文本是抗锯齿的。

句法:

bool ImagickDraw::setTextAntialias( $antiAlias )

参数:此函数接受单个参数$antiAlias ,该参数用于存储布尔信号,即 TRUE/FALSE。

返回值:此函数不返回任何值。

下面的程序说明了PHP中的ImagickDraw::setTextAntialias()函数:

方案一:

setFillColor('green');
  
// Set the font size
$draw->setFontSize(50);
  
// Set the Text Antialias
$draw->setTextAntialias(false);
  
// Set the text to be added
$draw->annotation(50, 75, "Gfg!");
  
// Create new Imagick object 
$imagick = new Imagick();
  
// Set the image dimensions
$imagick->newImage(500, 160, 'black');
  
// Set the image format
$imagick->setImageFormat("png");
  
// Draw the image
$imagick->drawImage($draw);
header("Content-Type: image/png");
  
// Display the image
echo $imagick->getImageBlob();
?>

输出:
setTextAntialias

方案二:

setFillColor('orange');
  
// Set the font size
$draw->setFontSize(50);
  
// Set the TextAntialias function
$draw->setTextAntialias(true);
  
// Set the text to be added
$draw->annotation(5, 75, "Gfg!");
  
// Set the TextAntialias function
$draw->setTextAntialias(false);
  
// Set the text to be added
$draw->annotation(105, 75, "Gfg!");
  
// Create new Imagick object
$imagick = new Imagick();
  
// Set the image dimensions
$imagick->newImage(300, 160, 'green');
  
// Set the image format
$imagick->setImageFormat("png");
  
// Draw the image
$imagick->drawImage($draw);
header("Content-Type: image/png");
  
// Display the image
echo $imagick->getImageBlob();
?>

输出:
setTextAntialias

参考: http: PHP。 PHP