PHP | GmagickDraw getstrokecolor() Function
The GmagickDraw::getstrokecolor() function is an inbuilt function in PHP which is used to get the color used for stroking object outlines.
Syntax:
ImagickPixel GmagickDraw::getstrokecolor( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns an GmagickPixel value containing the color.
Exceptions: This function throws GmagickDrawException on error.
Below given programs illustrate the GmagickDraw::getstrokecolor() function in PHP:
Program 1:
<?php
$draw = new GmagickDraw();
$strokeColor = $draw ->getstrokecolor()->getcolor();
echo $strokeColor ;
?>
|
Output:
rgb(0, 0, 0)
Program 2:
<?php
$draw = new GmagickDraw();
$draw ->setstrokecolor( '#4a76bd' );
$strokeColor = $draw ->getstrokecolor()->getcolor();
echo $strokeColor ;
?>
|
Output:
rgb(19018, 30326, 48573)
Used Image:
Program 3:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$draw = new GmagickDraw();
$draw ->setFillColor( '#0E0E0E' );
$draw ->rectangle(-10, -10, 800, 400);
$draw ->setFillColor( 'white' );
$draw ->setStrokeColor( 'red' );
$draw ->setstrokewidth(1);
$draw ->setFontSize(20);
$strokecolor = $draw ->getstrokecolor()->getcolor();
$draw ->annotate(50, 100,
'The stroke color here is ' . $strokecolor );
$gmagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagickdraw.getstrokecolor.php
Last Updated :
23 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...