PHP | GmagickDraw getfillopacity() Function

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   Â// Create a new GmagickDraw object  $draw= newGmagickDraw();     Â// Get the Fill Opacity  $fillOpacity= $draw->getfillopacity();  echo$fillOpacity;  ?>   | 
Output:
0 // Which is the default value
Program 2:
| <?php  Â// Create a new Gmagick object $gmagick= newGmagick('zambiatek.png');  Â// Create a GmagickDraw object $draw= newGmagickDraw();  Â// Set the color $draw->setFillColor('#0E0E0E');  Â// Draw rectangle for background $draw->rectangle(-10, -10, 800, 400);  Â// Set the fill color $draw->setFillColor('yellow');  Â// Set the font size $draw->setFontSize(20);  Â// Set the fill opacity $draw->setfillopacity(1);  Â// Annotate a text $draw->annotate(50, 30, 'The fill opacity here is '    . $draw->getfillopacity());  Â// Set the fill opacity $draw->setfillopacity(0.5);  Â// Annotate a text $draw->annotate(50, 100, 'The fill opacity here is '    . $draw->getfillopacity());  Â// Draw the image $gmagick->drawImage($draw);  Â// Display the output image header("Content-Type: image/png"); echo$gmagick->getImageBlob(); ?>  | 
Output:
Reference: https://www.php.net/manual/en/gmagickdraw.getfillopacity.php
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					



