PHP | ImagickDraw setTextDecoration() Function
Last Updated :
30 Aug, 2019
The ImagickDraw::setTextDecoration() function is an inbuilt function in PHP which is used to specify the decoration to be applied when annotating with text.
Syntax:
bool ImagickDraw::setTextDecoration( $decoration )
Parameters: This function accepts a single parameter $decoration which is used to hold the value of DECORATION_ constant.
The list of DECORATION_ constants are given below:
- imagick::DECORATION_NO (integer)
- imagick::DECORATION_UNDERLINE (integer)
- imagick::DECORATION_OVERLINE (integer)
- imagick::DECORATION_LINETROUGH (integer)
Return Value: This function does not return any value.
Below programs illustrate the ImagickDraw::setTextDecoration() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$draw ->setFillColor( 'green' );
$draw ->setFontSize(60);
$draw ->setTextDecoration(4);
$draw ->annotation(50, 75, "GeeksForGeeks" );
$imagick = new Imagick();
$imagick ->newImage(500, 160, 'white' );
$imagick ->setImageFormat( "png" );
$imagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$draw = new ImagickDraw();
$draw ->setFillColor( 'yellow' );
$draw ->setFontSize(20);
$draw ->setTextDecoration(3);
$draw ->annotation(50, 75, "A Computer Science Portal For Geeks!" );
$imagick = new Imagick();
$imagick ->newImage(500, 160, 'black' );
$imagick ->setImageFormat( "png" );
$imagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: http://php.net/manual/en/imagickdraw.settextdecoration.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...