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 mentioned above and described below:
- $x: This parameter is used to hold the value of x coordinate.
- $y: This parameter is used to hold the value of y coordinate.
Return Value: This function returns TRUE on success.
Below program illustrates the ImagickDraw::point() function in PHP:
Program:
<?php
$draw = new \ImagickDraw();
$draw ->setFillColor( 'red' );
for ( $x = 0; $x < 10000; $x ++) {
$draw ->point(rand(0, 300), rand(0, 300));
}
$imagick = new \Imagick();
$imagick ->newImage(300, 300, 'white' );
$imagick ->setImageFormat( "png" );
$imagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: http://php.net/manual/en/imagickdraw.point.php
Last Updated :
28 Aug, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...