PHP | ImagickDraw setStrokeDashArray() Function Last Updated : 20 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setStrokeDashArray() function is an inbuilt function in PHP which is used to set the pattern of dashes and gaps used to stroke paths. In case of odd number of values, the list of values is repeated to yield an even number of values. To remove an existing dash array, pass a zero number_elements argument or null dash_array. Syntax: bool ImagickDraw::setStrokeDashArray( array $dashArray ) Parameters: This function accepts a single parameter $dashArray which holds the stroke dash. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::setStrokeDashArray() function in PHP: Program 1: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the stroke dash array $draw->setStrokeDashArray([80, 5, 2, 5, 15, 51, ]); // Get the stroke dash array $array = $draw->getStrokeDashArray(); print("<pre>".print_r($array, true)."</pre>"); ?> Output: Array ( [0] => 80 [1] => 5 [2] => 2 [3] => 5 [4] => 15 [5] => 51 ) Program 2: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // 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('black'); // Set the color of stroke $draw->setStrokeColor('cyan'); // Set the stroke dash array $draw->setStrokeDashArray([2, 1, 3]); // Draw a ellipse $draw->ellipse(400, 100, 150, 70, 60, 900); // 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.setstrokedasharray.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setStrokeAntialias() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw setStrokeAlpha() Function The ImagickDraw::setStrokeAlpha() function is an inbuilt function in PHP which is used to specify the opacity of stroked object outlines. Syntax: bool ImagickDraw::setStrokeAlpha( $opacity ) Parameters: This function accepts a single parameter opacity which is used to specify the transparency of str 2 min read PHP | ImagickDraw setStrokeWidth() Function The ImagickDraw::setStrokeWidth() function is an inbuilt function in PHP which is used to set the width of the stroke used to draw object outlines. Syntax: bool ImagickDraw::setStrokeWidth( $stroke_width ) Parameters: This function accepts a single parameter $stroke_width which is used to hold the v 2 min read PHP | ImagickDraw setStrokeDashOffset() Function The ImagickDraw::setStrokeDashOffset() function is an inbuilt function in PHP which is used to set the offset into the dash pattern to start the dash. Syntax: bool ImagickDraw::setStrokeDashOffset( float $dash_offset ) Parameters: This function accepts a single parameter $dash_offset which holds the 2 min read PHP | ImagickDraw setStrokeOpacity() Function The ImagickDraw::setStrokeOpacity() function is an inbuilt function in PHP which is used to specify the opacity of stroked object outlines. The value of opacity lies between 0 to 1. Syntax: bool ImagickDraw::setStrokeOpacity( $stroke_opacity ) Parameters: This function accepts a single parameter $st 2 min read PHP | ImagickDraw setStrokeAntialias() Function 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 2 min read PHP | ImagickDraw setStrokeColor() Function The ImagickDraw::setStrokeColor() function is an inbuilt function in PHP which is used to set the color used for stroking object outlines. Syntax: bool ImagickDraw::setStrokeColor( $stroke_pixel ) Parameters: This function accepts a single parameter $stroke_pixel which is used to hold the color valu 2 min read Like