PHP | ImagickDraw pushClipPath() Function Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::pushClipPath() function is an inbuilt function in PHP which is used to starts a clip-path definition. Clip paths are used to creates a clipping region that decides which part of an image should be shown. Parts that are inside the region are shown, while those outside are hidden. Syntax: bool ImagickDraw::pushClipPath( string $clip_mask_id ) Parameters: This function accepts a single parameter $clip_mask_id which holds the name of the clip path. Return Value: This function returns TRUE on success. Below programs illustrate the ImagickDraw::pushClipPath() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'white'); // Create a new imagickDraw object $draw = new ImagickDraw(); // Set the stroke color $draw->setStrokeColor('blue'); // Set the fill color $draw->setFillColor('cyan'); // Set the stroke width $draw->setStrokeWidth(2); // Push the clip path $draw->pushClipPath('testClipPath'); // Create a rectangle which is // the area to be clipped $draw->rectangle(0, 0, 300, 300); // Pop the clip path $draw->popClipPath(); // Set the clip path $draw->setClipPath('testClipPath'); $draw->circle(150, 50, 300, 150); // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'white'); // Create a new imagickDraw object $draw = new ImagickDraw(); // Set the fill color $draw->setFillColor('green'); // Set the font size $draw->setFontSize(90); // Push the clip path $draw->pushClipPath('testClipPath'); // Create a circle which is // the area to be clipped $draw->circle(200, 200, 300, 300); // Pop the clip path $draw->popClipPath(); // Set the clip path $draw->setClipPath('testClipPath'); // Annotate a text $draw->annotation(115, 200, 'GeeksforGeeks'); // 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.pushclippath.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setClipUnits() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw popClipPath() Function The ImagickDraw::popClipPath() function is an inbuilt function in PHP which is used to terminate a clip-path definition. Clip paths are used to creates a clipping region that decides which part of an image should be shown. Parts that are inside the region are shown, while those outside are hidden. S 2 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 pushPattern() Function The ImagickDraw::pushPattern() function is an inbuilt function in PHP which is used to contain the definition of a named pattern. Everything between pushPattern() and popPattern() is the definition of pattern. Syntax: bool ImagickDraw::pushPattern( string $pattern_id, float $x, float $y, float $widt 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 point() Function The ImagickDraw::point() function is an inbuilt function in Imagick library of PHP which is used to draw a point. This function uses current stroke color and stroke thickness at the specified coordinates. Syntax: bool ImagickDraw::point( $x, $y ) Parameters: This function accepts two parameters as m 1 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 Like