PHP | ImagickDraw pushDefs() Function Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::pushDefs() function is an inbuilt function in PHP which is used to indicate that following commands create named elements for early processing. 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: bool ImagickDraw::pushDefs( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns TRUE on success. Below programs illustrate the ImagickDraw::pushDefs() 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, 'black'); // Create a new imagickDraw object $draw = new ImagickDraw(); // Set some properties of objects $draw->setFillColor('cyan'); $draw->setStrokeWidth(2); $draw->setFontSize(72); // Create a definition $draw->pushDefs(); $draw->setStrokeColor('white'); $draw->annotation(200, 100, 'GeeksforGeeks'); $draw->popDefs(); // Annotate a text $draw->annotation(200, 170, 'GeeksforGeeks'); // 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, 'black'); // Create a new imagickDraw object $draw = new ImagickDraw(); // Create a definition $draw->pushDefs(); $draw->setStrokeColor('white'); $draw->line(300, 200, 230, 23); $draw->popDefs(); // Draw a line $draw->line(230, 200, 310, 23); // 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.pushdefs.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw pop() 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 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 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 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 pop() Function 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 ) Parame 2 min read PHP | ImagickDraw pushClipPath() Function 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. Syn 2 min read Like