+

PHP GmagickDraw setstrokewidth () function

Syntax:
public GmagickDraw::setstrokewidth ($stroke_width): GmagickDraw
Parameters: This function takes one parameter, $stroke_width, which is used to store the value of the stroke width. This is a float.Returned value:This function returns a GmagickDraw object on success.The following programs illustrate the GmagickDraw::setstrokewidth() function in PHP :Program 1:  
// Create a new Gmagick object $draw = new GmagickDraw();  
// Set stroke color $draw -> setStrokeColor ( `Red` );  
// Set the fill color of the image $draw -> setFillColor ( `Green` );  
// Set the stroke width $draw -> setStrokeWidth (7);  
// Draw a circle $draw -> circle (250, 250, 100, 150);  
// Create a new Gmagick object $gmagick = new Gmagick();  
// Set image dimensions $gmagick -> newImage (500, 500, `White` );  
// Set image format $gmagick -> setImageFormat ( "png" );  
// Draw image $gmagick -> drawImage ( $draw ); header ( " Content-Type: image / png " );  
// Show image echo $gmagick -> getImageBlob(); ?>
Output: Program 2:
// Create a new Gmagick object $draw = new GmagickDraw();  
// Set stroke color $draw -> setStrokeColor ( `black` );  
// Set the fill color of the image $draw -> setFillColor ( `lightgreen` );  
// Set the stroke width $draw -> setStrokeWidth (0);  
// Draw a rectangle $draw -> rectangle (100, 100, 300, 300);  
// Set stroke width $draw -> setStrokeWidth (15);  
// Draw a rectangle $draw -> rectangle (400, 100, 600, 300);  
// Create a new Gmagick object $gmagick = new Gmagick();  
// Set image dimensions $gmagick -> newImage (800, 500, `White` );  
// Set image format $gmagick -> setImageFormat ( "png" );  
// Draw image $gmagick -> drawImage ( $draw ); header ( "Content-Type: image / png" );  
// Show image echo $gmagick -> getImageBlob(); ?>
Output: Link: http://php.net/manual/en/gmagickdraw.setstrokewidth.php
Get Solution for free from DataCamp guru