PHP | GmagickDraw settextdecoration() Function
The GmagickDraw ::settextdecoration() function is an inbuilt function in PHP that is used to specify the decoration to be applied when annotating with text.
Syntax:
public GmagickDraw::settextdecoration( $decoration ) : GmagickDraw
Parameters: This function accepts a single parameter $decoration which is used to hold the value of DECORATION_ constant. The list of DECORATION_ constants is given below:
- Gmagick ::DECORATION_NO (integer)
- Gmagick ::DECORATION_UNDERLINE (integer)
- Gmagick ::DECORATION_OVERLINE (integer)
- Gmagick ::DECORATION_LINETHROUGH (integer)
Return Value: This function returns the GmagickDraw object on success Below programs illustrate the GmagickDraw ::settextdecoration() function in PHP.
Program 1:
php
<?php
$draw = new GmagickDraw ();
$draw ->setFillColor( 'green' );
$draw ->setFontSize(60);
$draw ->setTextDecoration(4);
$draw ->annotation(50, 75, "GeeksForGeeks");
$gmagick = new Gmagick ();
$gmagick ->newImage(500, 160, 'white' );
$gmagick ->setImageFormat("png");
$gmagick ->drawImage( $draw );
header("Content-Type: image/png");
echo $gmagick ->getImageBlob();
?>
|
Output:
Program 2:
php
<?php
$draw = new GmagickDraw ();
$draw ->setFillColor( 'yellow' );
$draw ->setFontSize(20);
$draw ->setTextDecoration(3);
$draw ->annotation(50, 75, "A Computer Science Portal For Geeks!");
$gmagick = new Gmagick ();
$gmagick ->newImage(500, 160, 'black' );
$gmagick ->setImageFormat("png");
$gmagick ->drawImage( $draw );
header("Content-Type: image/png");
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: http://php.net/manual/en/gmagickdraw.settextdecoration.php
Last Updated :
27 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...