PHP | ImagickDraw setStrokeAntialias() Function
Last Updated :
17 Dec, 2019
The ImagickDraw::setStrokeAntialias() function is an inbuilt function in PHP which is used to set the current stroke antialias setting. Stroked outlines are antialiased (enabled) by default. Alias is just a noise or distortion in the stroke.
Syntax:
bool ImagickDraw::setStrokeAntialias( bool $stroke_antialias)
Parameters: This function accepts a single parameter $stroke_antialias which holds the antialias setting.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::setStrokeAntialias() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$draw ->setStrokeAntialias(false);
$strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ;
echo $strokeAntilias ;
?>
|
Output:
false
Program 2:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, 'yellow' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'cyan' );
$draw ->setStrokeWidth(1);
$draw ->setStrokeColor( 'green' );
$draw ->setFontSize(70);
$draw ->setStrokeAntialias(false);
$draw ->annotation(50, 200, 'GeeksforGeeks' );
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.setstrokeantialias.php
Share your thoughts in the comments
Please Login to comment...