PHP | GmagickDraw getfillopacity() Function
Last Updated :
21 Jan, 2020
The GmagickDraw::getfillopacity() function is an inbuilt function in PHP which is used to get the opacity used when drawing using the fill color or fill texture. Fully opaque is 1 and fully transparent is 0.
Syntax:
float GmagickDraw::getfillopacity( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns a float value containing the opacity.
Exceptions: This function throws GmagickDrawException on error.
Below given programs illustrate the GmagickDraw::getfillopacity() function in PHP:
Used Image:
Program 1:
<?php
$draw = new GmagickDraw();
$fillOpacity = $draw ->getfillopacity();
echo $fillOpacity ;
?>
|
Output:
0 // Which is the default value
Program 2:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$draw = new GmagickDraw();
$draw ->setFillColor( '#0E0E0E' );
$draw ->rectangle(-10, -10, 800, 400);
$draw ->setFillColor( 'yellow' );
$draw ->setFontSize(20);
$draw ->setfillopacity(1);
$draw ->annotate(50, 30, 'The fill opacity here is '
. $draw ->getfillopacity());
$draw ->setfillopacity(0.5);
$draw ->annotate(50, 100, 'The fill opacity here is '
. $draw ->getfillopacity());
$gmagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagickdraw.getfillopacity.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...