PHP ImagickDraw setFillColor () function

PHP

Syntax:
bool ImagickDraw::setFillColor ($fill_pixel)
Parameters: This function takes one parameter, $fill_pixel, which is used to store the pixel color value.Returned value:This function does not return any value.Below the program illustrate the ImagickDraw::setFillColor() functionin PHP:Program 1:  
// require_once (& # 39 ; path / vendor / autoload.php '); 
/ / Create an ImagickDraw object $draw = new ImagickDra w();  
// Set the opacity of the stroke $draw -> setStrokeOpacity (1);  
// Set stroke color $draw -> setStrokeColor ( 'Black' );  
// Set the opacity of the stroke $draw -> setStrokeOpacity (0.8);  
// Set stroke width $draw -> setStrokeWidth (10);  
// Establish a dashed line connection $draw -> setStrokeLineJoin (Imagick::LINEJOIN_ROUND);  
// Set fill color $draw -> setFillColor ( 'lightgreen' );  
// Set the miter travel limit $draw -> setStrokeMiterLimit (40 * 12); $points = [ [ 'x' = > 50 * 6, 'y' = > 10 * 5], [ 'x' = > 20 * 7, 'y' = > 30 * 5], [ 'x' = > 60 * 8, 'y' = > 50 * 5], [ 'x' = > 70 * 3, 'y' = > 15 * 5], ];  
// Draw a polygon $draw -> polygon ( $points );  
// Create a new imagick object $image = new Imagick();  
// Set image dimensions $image -> newImage (500, 300, 'white' );  
// Set image format $image -> setImageFormat ( "png" );  
// Draw image $image -> drawImage ( $draw ); header ( "Content-Type: image / png" );  
// Show image echo $image -> getImageBlob(); ?>
Output: Program 2:  
// require_once (' path / vendor / autoload.php '); 
// Create an ImagickDraw object $draw = new ImagickDraw();  
// Set stroke color $draw -> setStrokeColor ( 'Green' );  
// Set fill color $draw -> setFillColor ( 'Red' );  
// Set the stroke width $draw -> setStrokeWidth (7);  
// Draw a rectangle $draw -> rectangle (40, 30, 200, 260);  
// Create a new Imagick object $image = new Imagick();  
// Set image size $image -> newImage (300, 300, 'White' );  
// Set image format $image -> setImageFormat ( "png" );  
// Draw image $image -> drawImage ( $draw ); header ( "Content-Type: image / png" );  
// Show image echo $image -> getImageBlob(); ?>
Output: Link: http://php.net/manual/en/imagickdraw.setfillcolor.php



Get Solution for free from DataCamp guru