XOOPS API 2.5.11 Beta1  UI v0.5
Réalisé par monxoops.fr
Référence de la classe Canvas

Fonctions membres publiques

 __construct ($img)
 
 setFont ($font)
 
 useFont ($file, $size=12, $color=0, $bgcolor=null)
 
 writeText ($x, $y, $text, $angle=0)
 
 __call ($method, $params)
 

Attributs protégés

 $handle = 0
 
 $image = null
 
 $font = null
 

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $img)

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$imgImage object

Documentation des fonctions membres

◆ __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()

setFont (   $font)

Sets the active font. Can be an instance of \WideImage\Font\TTF, \WideImage\Font\PS, or \WideImage\Font\GDF.

Paramètres
object$fontFont object to set for writeText()

◆ 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$fileFont file name (string)
int$sizeFont size (supported for TTF/OTF and PS fonts, ignored for GDF)
int$colorText color
int$bgcolorBackground 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$xLeft
int$yTop
string$textText to write
int$angleThe angle, defaults to 0

Documentation des champs

◆ $font

$font = null
protected

◆ $handle

$handle = 0
protected

◆ $image

$image = null
protected

La documentation de cette classe a été générée à partir du fichier suivant :