◆ __construct()
Creates a canvas object that writes to the image passed as a parameter
Shouldn't be used directly, use \WideImage\Image::getCanvas() instead.
- Paramètres
-
\WideImage\Image | $img | Image object |
◆ __call()
__call |
( |
|
$method, |
|
|
|
$params |
|
) |
| |
A magic method that allows you to call any PHP function that starts with "image".
This is a shortcut to call custom functions on the image handle.
Example: $img = WideImage::load('pic.jpg'); $canvas = $img->getCanvas(); $canvas->filledRect(10, 10, 20, 30, $img->allocateColor(0, 0, 0)); $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0));
◆ setFont()
Sets the active font. Can be an instance of \WideImage\Font\TTF, \WideImage\Font\PS, or \WideImage\Font\GDF.
- Paramètres
-
◆ useFont()
useFont |
( |
|
$file, |
|
|
|
$size = 12 , |
|
|
|
$color = 0 , |
|
|
|
$bgcolor = null |
|
) |
| |
Creates and sets the current font
The supported font types are: TTF/OTF, PS, and GDF. Font type is detected from the extension. If the $file parameter doesn't have an extension, TTF font is presumed.
Note: not all parameters are supported by all fonts.
- Paramètres
-
string | $file | Font file name (string) |
int | $size | Font size (supported for TTF/OTF and PS fonts, ignored for GDF) |
int | $color | Text color |
int | $bgcolor | Background color (supported only for PS font, ignored for TTF and PS) |
- Renvoie
- mixed One of the \WideImage\Font* objects
◆ writeText()
writeText |
( |
|
$x, |
|
|
|
$y, |
|
|
|
$text, |
|
|
|
$angle = 0 |
|
) |
| |
Write text on the image at specified position
You must set a font with a call to \WideImage\Canvas::setFont() prior to writing text to the image.
Smart coordinates are supported for $x and $y arguments, but currently only for TTF/OTF fonts.
Example: $img = WideImage::load('pic.jpg'); $canvas = $img->getCanvas(); $canvas->useFont('Verdana.ttf', 16, $img->allocateColor(255, 0, 0)); $canvas->writeText('right', 'bottom', 'www.website.com');
- Paramètres
-
int | $x | Left |
int | $y | Top |
string | $text | Text to write |
int | $angle | The angle, defaults to 0 |
◆ $font
◆ $handle
◆ $image
La documentation de cette classe a été générée à partir du fichier suivant :
- XoopsCore25-2.5.11-Beta1/htdocs/class/libraries/vendor/smottt/wideimage/lib/WideImage/Canvas.php