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 success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::popPattern() function in PHP:
Program 1:
| <?php  Â// Create a new imagick object $imagick= newImagick();  Â// Create a image on imagick object $imagick->newImage(800, 250, 'white');  Â// Create a new imagickDraw object $draw= newImagickDraw();  Â// Push the pattern $draw->pushPattern("MyPattern", 0, 0, 50, 50); for($x= 0; $x< 50; $x+= 10) {     for($y= 0; $y< 50; $y+= 5) {         $X= $x+ (($y/ 10) % 10);         $draw->rectangle($X, $y, $X+ 5, $y+ 5);     } }  Â// Pop the pattern $draw->popPattern();  Â// Set the fill Opacity $draw->setFillOpacity(0);  Â// Set the fill pattern URL $draw->setFillPatternURL('#MyPattern');  Â// Draw a rectangle $draw->rectangle(0, 0, 900, 900);  Â// 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  Â// Create a new imagick object $imagick= newImagick();  Â// Create a image on imagick object $imagick->newImage(800, 250, 'white');  Â// Create a new imagickDraw object $draw= newImagickDraw();  Â// Push the pattern $draw->pushPattern("MyPattern", 0, 0, 50, 50); for($x= 0; $x< 50; $x+= 10) {     for($y= 0; $y< 50; $y+= 5) {         $X= $x+ (($y/ 10) % 10);         $draw->circle($X, $y, $X, $y+1);     } }  Â// Pop the pattern $draw->popPattern(); // Set the fill Opacity $draw->setFillOpacity(0);  Â// Set the fill pattern URL $draw->setFillPatternURL('#MyPattern');  Â// Draw a rectangle $draw->rectangle(0, 0, 900, 900);  Â// 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.poppattern.php
 
				 
					



