◆ __construct()
Creates a canvas object that writes to the image passed as a parameter
Shouldn't be used directly, use \WideImage\Image::getCanvas() instead.
- Parameters
-
\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.
- Parameters
-
◆ 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.
- Parameters
-
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) |
- Returns
- 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');
- Parameters
-
int | $x | Left |
int | $y | Top |
string | $text | Text to write |
int | $angle | The angle, defaults to 0 |
◆ $font
◆ $handle
◆ $image
The documentation for this class was generated from the following file:
- C:/xoops2511b2/htdocs/class/libraries/vendor/smottt/wideimage/lib/WideImage/Canvas.php