The GmagickDraw::setstrokewidth() function is an inbuilt function in PHP which is used to set the width of the stroke used to draw object outlines.
Syntax:
public GmagickDraw::setstrokewidth( $stroke_width ) : GmagickDraw
Parameters: This function accepts single parameter $stroke_width which is used to hold the value of stroke width. It is a float type value.
Return Value: This function returns the GmagickDraw object on success.
Below programs illustrate the GmagickDraw::setstrokewidth() function in PHP:
Program 1:
| <?php  Â// Create new Gmagick object  $draw= new\GmagickDraw ();  Â// Set the stroke Color $draw->setStrokeColor('Red');  Â// Set the image filled color  $draw->setFillColor('Green');  Â// Set the Stroke Width $draw->setStrokeWidth(7);  Â// Draw the Circle $draw->circle(250, 250, 100, 150);  Â// Create new Gmagick Object $gmagick= new\Gmagick ();  Â// Set the dimensions of image $gmagick->newImage(500, 500, 'White');  Â// Set the image format  $gmagick->setImageFormat("png");  Â// Draw the image  $gmagick->drawImage($draw);  Âheader("Content-Type: image/png");  Â// Display the image echo$gmagick->getImageBlob(); ?>  | 
Output:
Program 2:
| <?php // Create new Gmagick Object  $draw= newGmagickDraw ();  Â// Set the stroke color $draw->setStrokeColor('black');  Â// Set the image filled color  $draw->setFillColor('lightgreen');  Â// Set the Stroke Width $draw->setStrokeWidth(0);  Â// Draw the rectangle $draw->rectangle(100, 100, 300, 300);  Â// Set Stroke Width $draw->setStrokeWidth(15);  Â// Draw the rectangle $draw->rectangle(400, 100, 600, 300);  Â// Create new Gmagick Object  $gmagick= new\Gmagick ();  Â// Set the dimensions of image $gmagick->newImage(800, 500, 'White');  Â// Set the image format $gmagick->setImageFormat("png");  Â// Draw the image  $gmagick->drawImage($draw); header("Content-Type: image/png");  Â// Display the image  echo$gmagick->getImageBlob(); ?>  | 
Output:
Reference: http://php.net/manual/en/gmagickdraw.setstrokewidth.php
<!–
–>











 
                                    








Please Login to comment…