PHP | ImagickDraw setClipRule() Function Last Updated : 23 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setClipRule() function is an inbuilt function in PHP which is used to set the polygon fill rule to be used by the clipping path. This usually doesn't have any impact on the final image but still provides different FILLRULE methods to complete the same task. Syntax: bool ImagickDraw::setClipRule( int $fill_rule ) Parameters: This function accepts a single parameter $fill_rule which holds an integer 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) Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::setClipRule() function in PHP: Program 1: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the clipRule $draw->setClipRule(imagick::FILLRULE_NONZERO); // Get clipRule echo $draw->getClipRule(); ?> Output: 2 // which corresponds to imagick::FILLRULE_NONZERO. Program 2: php highloght=12 <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(500, 250, 'green'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setClipRule(imagick::FILLRULE_EVENODD); $draw->setFontSize(24); $draw->annotation(160, 125, 'The clipRule is ' . $draw->getClipRule() . '.'); // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.setcliprule.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setClipPath() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw setFillRule() Function The ImagickDraw::setFillRule() function is an inbuilt function in PHP which is used to set the fill rule to use while drawing the polygons. Syntax: bool ImagickDraw::setFillRule( int $fill_rule ) Parameters: This function accepts a single parameter $fill_rule which holds an integer value correspondi 2 min read PHP | ImagickDraw setClipUnits() Function The ImagickDraw::setClipUnits() function is an inbuilt function in PHP which is used to set the interpretation of clip path units. Syntax: bool ImagickDraw::setClipUnits( int $clip_units ) Parameters: This function accept a single parameter $clip_units which is an integer value corresponding to one 1 min read PHP | ImagickDraw setClipPath() Function The ImagickDraw::setClipPath() function is an inbuilt function in PHP which is used to associate a named clipping path with the image. Only the areas drawn on by the clipping path will be modified as long as it remains in effect. Syntax: bool ImagickDraw::setClipPath( string $clip_mask ) Parameters: 2 min read PHP | ImagickDraw scale() Function The ImagickDraw::scale() function is an inbuilt function in PHP which is used to adjust the scaling factor to apply in the horizontal and vertical directions to the current coordinate space. Syntax: bool ImagickDraw::scale( $x, $y ) Parameters: This function accepts two parameter as mentioned above 2 min read PHP | ImagickDraw setViewbox() Function The ImagickDraw::setViewbox() function is an inbuilt function of PHP which is used to set the overall canvas size. This function set the overall canvas size to be recorded with the drawing vector data. It will be specified using the same size as the canvas image. Syntax:  bool ImagickDraw::setViewb 3 min read PHP | ImagickDraw setFillColor() Function The ImagickDraw::setFillColor() function is an inbuilt function in PHP which is used to set the fill color to be used for drawing. Syntax: bool ImagickDraw::setFillColor( $fill_pixel ) Parameters: This function accepts single parameter $fill_pixel which is used to hold the value of pixel color. Retu 2 min read Like