Skip to content
Related Articles

Related Articles

Improve Article
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.


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:

// Create a new GmagickDraw object 
$draw = new GmagickDraw(); 
// Get the Fill Opacity 
$fillOpacity = $draw->getfillopacity(); 
echo $fillOpacity


0 // Which is the default value

Program 2:

// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
// Create a GmagickDraw object
$draw = new GmagickDraw();
// Set the color
// Draw rectangle for background
$draw->rectangle(-10, -10, 800, 400);
// Set the fill color
// Set the font size
// Set the fill opacity
// Annotate a text
$draw->annotate(50, 30, 'The fill opacity here is '
    . $draw->getfillopacity());
// Set the fill opacity
// Annotate a text
$draw->annotate(50, 100, 'The fill opacity here is '
    . $draw->getfillopacity());
// Draw the image
// Display the output image
header("Content-Type: image/png");
echo $gmagick->getImageBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :