Friday, October 17, 2025
HomeLanguagesPHP | ImagickDraw getStrokeLineJoin() Function

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:




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


Output:

1 // Which corresponds to imagick::LINEJOIN_MITER

Program 2:




<?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;
?>


Output:

3 // Which corresponds to imagick::LINEJOIN_BEVEL

Program 3:




<?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();
?>


Output:

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS