PHP | ImagickDraw setFillPatternURL() Function Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setFillPatternURL() function is an inbuilt function in PHP which is used to set the URL to use as a fill pattern for filling objects. The URL actually is a unique name of a pattern with a '#' before the name. Syntax: bool ImagickDraw::setFillPatternURL( string $fill_url ) Parameters: This function accepts a single parameter $fill_url which holds the URL. Return Value: This function returns TRUE on success. Below programs illustrate the ImagickDraw::setFillPatternURL() 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(); // Push the pattern $draw->pushPattern("MyPattern", 0, 0, 50, 50); $color = ['blue', 'black', 'cyan']; for ($x = 0; $x < 50; $x += 10) { for ($y = 0; $y < 50; $y += 5) { $draw->setFillColor($color[$y % 3]); $draw->circle($x, $y + 80, $x % 2, $y); } } // Pop the pattern $draw->popPattern(); // Set the fill Opacity $draw->setFillOpacity(0); // Set the fill pattern URL $draw->setFillPatternURL('#MyPattern'); // Draw a rectangle on which pattern is made $draw->rectangle(0, 0, 400, 400); // 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(); // Push the pattern $draw->pushPattern("MyPattern", 0, 0, 50, 50); for ($x = 0; $x < 50; $x += 10) { for ($y = 0; $y < 50; $y += 5) { $draw->rectangle($x, $y + 80, $x % 2, $y); } } // Pop the pattern $draw->popPattern(); // Set the fill Opacity $draw->setFillOpacity(0); // Set the fill pattern URL $draw->setFillPatternURL('#MyPattern'); // Draw a rectangle on which pattern is made $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.setfillpatternurl.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setStrokePatternURL() 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 setStrokePatternURL() Function The ImagickDraw::setStrokePatternURL() function is an inbuilt function in PHP which is used to set the pattern used for stroking object outlines. Syntax: bool ImagickDraw::setStrokePatternURL( string $stroke_url ) Parameters:This function accepts a single parameter $stroke_url which holds the URL of 2 min read PHP | ImagickDraw setFillOpacity() Function The ImagickDraw::setFillOpacity() function is an inbuilt function in PHP which is used to set the opacity to use when drawing using the fill color or fill texture.Syntax:Â bool ImagickDraw::setFillOpacity( $fillOpacity ) Parameters: This function accepts a single parameter $fillOpacity which is used 2 min read PHP | ImagickDraw setFillAlpha() Function The ImagickDraw::setFillAlpha() function is an inbuilt function in PHP which is used to set the opacity to use when drawing using the fill color or fill texture. Syntax: bool ImagickDraw::setFillAlpha( float $opacity ) Parameters: This function accepts a single parameter $opacity which holds the opa 2 min read PHP | ImagickDraw setClipRule() Function 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: 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 Like