PHP | GmagickDraw gettextdecoration() Function
Last Updated :
29 Jan, 2020
The GmagickDraw::gettextdecoration() function is an inbuilt function in PHP which is used to get the decoration applied when annotating with text.
Syntax:
int GmagickDraw::gettextdecoration( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns an integer value corresponding to one of DECORATION constants.
List of DECORATION constants are given below:
- Gmagick::DECORATION_NO (0)
- Gmagick::DECORATION_UNDERLINE (1)
- Gmagick::DECORATION_OVERLINE (2)
- Gmagick::DECORATION_LINETROUGH (3)
Exceptions: This function throws GmagickDrawException on error.
Below given programs illustrate the GmagickDraw::gettextdecoration() function in PHP:
Program 1:
<?php
$draw = new GmagickDraw();
$textDecoration = $draw ->gettextdecoration();
echo $textDecoration ;
?>
|
Output:
0 // Which is the default value
Program 2:
<?php
$draw = new GmagickDraw();
$draw ->settextdecoration(3);
$textDecoration = $draw ->gettextdecoration();
echo $textDecoration ;
?>
|
Output:
3
Used Image:
Program 3:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$draw = new GmagickDraw();
$draw ->setFillColor( '#0E0E0E' );
$draw ->rectangle(-10, -10, 800, 400);
$draw ->setfontsize(30);
$draw ->setFillColor( 'white' );
$draw ->settextdecoration(2);
$textDecoration = $draw ->gettextdecoration();
$draw ->annotate(50, 100, 'The text decoration here is '
. $textDecoration );
$gmagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagickdraw.gettextdecoration.php
Share your thoughts in the comments
Please Login to comment...