PHP | ImagickDraw pop() Function Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::pop() function is an inbuilt function in PHP which is used to destroy the current ImagickDraw in the stack and returns the previously pushed ImagickDraw. For every pop() function there must have already been an equivalent push() function. Syntax: bool ImagickDraw::pop( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns TRUE on success. Below programs illustrate the ImagickDraw::pop() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Create an image on imagick object $imagick->newImage(800, 250, 'white'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the fill color $draw->setFillColor('blue'); // Set the font size $draw->setFontSize(70); // Push $draw->push(); // Annotate a text $draw->annotation(250, 70, 'Hello'); // Pop $draw->pop(); // Set the fill color for new object $draw->setFillColor('green'); // Annotate a text $draw->annotation(250, 170, 'World'); // 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 stroke color $draw->setStrokeColor('red'); // Set the fill color $draw->setFillColor('blue'); // Set the stroke width $draw->setStrokeWidth(5); // Set the font size $draw->setFontSize(72); // Push $draw->push(); // Translate the object $draw->translate(50, 50); // Draw a circle $draw->circle(250, 70, 250, 130); // Pop because we want to draw a new // circle with new properties. $draw->pop(); // Set the stroke color for new object $draw->setStrokeColor('violet'); // Set the fill color for new object $draw->setFillColor('green'); // Draw a new circle $draw->circle(250, 70, 250, 130); // 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.pop.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw point() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw popDefs() Function The ImagickDraw::popDefs() function is an inbuilt function in PHP which is used to terminate a definition list. These are usually used to define draw commands which should be safely processed earlier for the sake of efficiency. This command has no impact on the looks of the draw commands. Syntax: bo 2 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 polygon() Function The ImagickDraw::polygon() function is an inbuilt function in Imagick library in PHP which is used to draw a polygon using the specified array of coordinates. Syntax: bool ImagickDraw::polygon( $coordinates ) Parameters: This function accepts single parameter $coordinates of array type. It is used 2 min read PHP | ImagickDraw popPattern() Function The ImagickDraw::popPattern() function is an inbuilt function in PHP which is used to terminate a pattern definition which contains a design to be applied. Syntax: bool ImagickDraw::popPattern( void ) Parameters:This function doesnât accepts any parameter. Return Value: This function returns TRUE on 2 min read 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 setFont() Function The ImagickDraw::setFont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: bool ImagickDraw::setFont( $font_name ) Parameters: This function accepts a single parameter $font_name which is used to hold the value of font na 2 min read Like