Thursday, September 4, 2025
HomeLanguagesPHP | ImagickDraw getFillRule() Function

PHP | ImagickDraw getFillRule() Function

The ImagickDraw::getFillRule() function is an inbuilt function in PHP which is used to get the fill rule used while drawing the polygons.

Syntax:

int ImagickDraw::getFillRule( void )

Parameters: This function doesn’t accepts any parameters.

Return Value: This function returns an integer value corresponding to one of FILLRULE constants.

List of FILLRULE constants are given below:

  • imagick::FILLRULE_UNDEFINED (0)
  • imagick::FILLRULE_EVENODD (1)
  • imagick::FILLRULE_NONZERO (2)

Exceptions: This function throws ImagickException on error.

Below programs illustrate the ImagickDraw::getFillRule() function in PHP:

Program 1:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Get the Fill Rule
$fillRule = $draw->getFillRule();
echo $fillRule;
?>


Output:

1 // Which is the default value corresponding to imagick::FILLRULE_EVENODD

Program 2:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Set the Fill Rule
$draw->setFillRule(2);
  
// Get the Fill Rule
$fillRule = $draw->getFillRule();
echo $fillRule;
?>


Output:

2 // Which corresponds to imagick::FILLRULE_NONZERO.

Reference: https://www.php.net/manual/en/imagickdraw.getfillrule.php

RELATED ARTICLES

Most Popular

Dominic
32263 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11857 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6696 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS