PHP | ImagickDraw getStrokeAntialias() Function
The ImagickDraw::getStrokeAntialias() function is an inbuilt function in PHP which is used to get 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::getStrokeAntialias( void )
Parameters: This function doesn’t accept any parameter.
Return Value: This function returns an bool value containing the stroke antialias setting. TRUE means enabled and FALSE means disabled.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::getStrokeAntialias() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ;
echo $strokeAntilias ;
?>
|
Output:
true
Program 2:
<?php
$draw = new ImagickDraw();
$draw ->setStrokeAntialias(false);
$strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ;
echo $strokeAntilias ;
?>
|
Output:
false
Program 3:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, 'black' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'cyan' );
$draw ->setStrokeWidth(1);
$draw ->setStrokeColor( 'red' );
$draw ->setFontSize(40);
$strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ;
$draw ->annotation(50, 100, 'The stroke antialias here is ' . $strokeAntialias );
$draw ->setStrokeAntialias(false);
$strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ;
$draw ->annotation(50, 200, 'The stroke antialias here is ' . $strokeAntialias );
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.getstrokeantialias.php
Last Updated :
17 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...