La función ImagickDraw::getStrokeAntialias() es una función incorporada en PHP que se utiliza para obtener la configuración de antialias de trazo actual. Los contornos trazados están suavizados (habilitados) de forma predeterminada. Alias es solo un ruido o distorsión en el trazo.
Sintaxis:
bool ImagickDraw::getStrokeAntialias( void )
Parámetros: Esta función no acepta ningún parámetro.
Valor de retorno: esta función devuelve un valor bool que contiene la configuración de antialias de trazo. VERDADERO significa habilitado y FALSO significa deshabilitado.
Excepciones: esta función lanza ImagickException en caso de error.
Los siguientes programas ilustran la función ImagickDraw::getStrokeAntialias() en PHP:
Programa 1:
<?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Get the stroke antialias $strokeAntialias = $draw->getStrokeAntialias() ? 'true' : 'false'; echo $strokeAntilias; ?>
Producción:
true
Programa 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; ?>
Producción:
false
Programa 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(); ?>
Producción:
Referencia: https://www.php.net/manual/en/imagickdraw.getstrokeantialias.php