PHP | ImagickDraw getStrokeLineJoin() Function

The ImagickDraw::getStrokeLineJoin() function is an inbuilt function in PHP which is used to get the shape to be used at the corners of paths when they are stroked. This usually impacts the outer edges and turns of the stroke.

Syntax:

int ImagickDraw::getStrokeLineJoin( void )

Parameters: This function doesn’t accepts any parameters.

Return Value: This function returns an integer value corresponding to one of LINEJOIN constants.

List of LINEJOIN constants are given below:



  • imagick::LINEJOIN_UNDEFINED (0)
  • imagick::LINEJOIN_MITER (1)
  • imagick::LINEJOIN_ROUND (2)
  • imagick::LINEJOIN_BEVEL (3)

Exceptions: This function throws ImagickException on error.

Below programs illustrate the ImagickDraw::getStrokeLineJoin() function in PHP:

Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
    
// Get the stroke line join
$lineJoin = $draw->getStrokeLineJoin();
echo $lineJoin;
?>

chevron_right


Output:

1 // Which corresponds to imagick::LINEJOIN_MITER

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Set the stroke line join
$draw->setStrokeLineJoin(3);
  
// Get the stroke line join
$lineJoin = $draw->getStrokeLineJoin();
echo $lineJoin;
?>

chevron_right


Output:

3 // Which corresponds to imagick::LINEJOIN_BEVEL

Program 3:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
    
// 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 fill color
$draw->setFillColor('white');
    
// Set the color of stroke
$draw->setStrokeColor('blue');
  
// Set the stroke width
$draw->setStrokeWidth(4);
    
// Set the font size
$draw->setFontSize(25);
   
 // Set the stroke dash array
$draw->setStrokeDashArray([20]);
   
// Draw a rectangle
$draw->rectangle(100, 50, 225, 175);
    
// Annotate a text
$draw->annotation(10, 220, 'The strokeLineJoin here is '
        . $draw->getStrokeLineJoin());
   
// Set the stroke line join
$draw->setStrokeLineJoin(2);
    
// Draw a rectangle
$draw->rectangle(500, 50, 625, 175);
    
// Annotate a text
$draw->annotation(400, 220, 'The strokeLineJoin here is '
        . $draw->getStrokeLineJoin());
    
// Render the draw commands
$imagick->drawImage($draw);
    
// Show the output
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>

chevron_right


Output:

Reference: https://www.php.net/manual/en/imagickdraw.getstrokelinejoin.php




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.