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 // Create a new ImagickDraw object $draw = new ImagickDraw(); // Get the stroke antialias $strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ; echo $strokeAntilias ; ?> |
Output:
true
Program 2:
<?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Disable stroke antialias $draw ->setStrokeAntialias(false); // Get the stroke antialias $strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ; echo $strokeAntilias ; ?> |
Output:
false
Program 3:
<?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick ->newImage(800, 250, 'black' ); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the fill color $draw ->setFillColor( 'cyan' ); // Set the width of stroke $draw ->setStrokeWidth(1); // Set the color of stroke $draw ->setStrokeColor( 'red' ); // Set the font size $draw ->setFontSize(40); // Get the stroke antialias $strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ; // Annotate a text $draw ->annotation(50, 100, 'The stroke antialias here is ' . $strokeAntialias ); // Disable stroke antialias $draw ->setStrokeAntialias(false); // Get the stroke antialias $strokeAntialias = $draw ->getStrokeAntialias() ? 'true' : 'false' ; // Annotate a text $draw ->annotation(50, 200, 'The stroke antialias here is ' . $strokeAntialias ); // Render the draw commands $imagick ->drawImage( $draw ); // Show the output $imagick ->setImageFormat( 'png' ); header( "Content-Type: image/png" ); echo $imagick ->getImageBlob(); ?> |
Output:
Reference: https://www.php.net/manual/en/imagickdraw.getstrokeantialias.php