ImagickDraw::setTextAntialias() 函數是 PHP 的內置函數,用於控製文本是否抗鋸齒。默認情況下,文本是抗鋸齒的。
用法:
bool ImagickDraw::setTextAntialias( $antiAlias )
參數:此函數接受單個參數 $antiAlias,用於存儲布爾信號,即 TRUE/FALSE。
返回值:此函數不返回任何值。
以下示例程序旨在說明 PHP 中的 ImagickDraw::setTextAntialias() 函數:
程序1:
<?php
// Create an ImagickDraw object
$draw = new ImagickDraw();
// Set the image filled color
$draw->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();
?>
輸出:
程序2:
<?php
// Create an ImagickDraw object
$draw = new ImagickDraw();
// Set the image filled color
$draw->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();
?>
輸出:
參考: http://php.net/manual/en/imagickdraw.settextantialias.php
相關用法
- PHP ImagickDraw getTextAlignment()用法及代碼示例
- PHP ImagickDraw polygon()用法及代碼示例
- PHP ImagickDraw roundRectangle()用法及代碼示例
- PHP ImagickDraw arc()用法及代碼示例
- PHP ImagickDraw circle()用法及代碼示例
- PHP ImagickDraw bezier()用法及代碼示例
- PHP ImagickDraw rectangle()用法及代碼示例
- PHP ImagickDraw line()用法及代碼示例
- PHP ImagickDraw point()用法及代碼示例
- PHP ImagickDraw skewX()用法及代碼示例
- PHP ImagickDraw setStrokeWidth()用法及代碼示例
- PHP ImagickDraw translate()用法及代碼示例
- PHP ImagickDraw setStrokeOpacity()用法及代碼示例
- PHP ImagickDraw setGravity()用法及代碼示例
- PHP ImagickDraw setFillColor()用法及代碼示例
- PHP ImagickDraw setFont()用法及代碼示例
- PHP ImagickDraw setFontStyle()用法及代碼示例
- PHP ImagickDraw setFontSize()用法及代碼示例
- PHP ImagickDraw setFontWeight()用法及代碼示例
- PHP ImagickDraw setStrokeMiterLimit()用法及代碼示例
- PHP ImagickDraw setFillOpacity()用法及代碼示例
- PHP ImagickDraw setTextDecoration()用法及代碼示例
- PHP ImagickDraw setTextUnderColor()用法及代碼示例
- PHP ImagickDraw setViewbox()用法及代碼示例
注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 PHP | ImagickDraw setTextAntialias() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。