[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
[Code source] [Imprimer] [Statistiques]
Image_Canvas Canvas based creation of images to facilitate different output formats
Author: | Jesper Veggerby <pear.nosey@veggerby.dk> |
Copyright: | Copyright (C) 2003, 2004 Jesper Veggerby Hansen |
License: | http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 |
Version: | CVS: $Id: Canvas.php,v 1.7 2006/02/28 22:46:25 nosey Exp $ |
Poids: | 733 lignes (21 kb) |
Inclus ou requis: | 11 fois |
Référencé: | 0 fois |
Nécessite: | 1 fichier Image/Canvas/Tool.php |
Image_Canvas:: (34 méthodes):
Image_Canvas()
_getX()
_getY()
getWidth()
getHeight()
setLineThickness()
setLineColor()
setFill()
setFillColor()
setFillImage()
setGradientFill()
setFont()
setDefaultFont()
_reset()
reset()
drawEnd()
line()
addVertex()
addSpline()
polygon()
rectangle()
ellipse()
pieslice()
textWidth()
textHeight()
addText()
image()
setClipping()
startGroup()
endGroup()
show()
save()
toHtml()
factory()
Classe: Image_Canvas - X-Ref
Class for handling different output formatsImage_Canvas($params) X-Ref |
Create the canvas. Parameters available: 'width' The width of the graph on the canvas 'height' The height of the graph on the canvas 'left' The left offset of the graph on the canvas 'top' The top offset of the graph on the canvas param: array $params Parameter array |
_getX($x) X-Ref |
Get the x-point from the relative to absolute coordinates param: float $x The relative x-coordinate (in percentage of total width) return: float The x-coordinate as applied to the canvas |
_getY($y) X-Ref |
Get the y-point from the relative to absolute coordinates param: float $y The relative y-coordinate (in percentage of total width) return: float The y-coordinate as applied to the canvas |
getWidth() X-Ref |
Get the width of the canvas return: int The width |
getHeight() X-Ref |
Get the height of the canvas return: int The height |
setLineThickness($thickness) X-Ref |
Sets the thickness of the line(s) to be drawn param: int $thickness The actual thickness (in pixels) |
setLineColor($color) X-Ref |
Sets the color of the line(s) to be drawn param: mixed $color The color of the line |
setFill($fill) X-Ref |
Sets the style of the filling of drawn objects. This method gives simple access to setFillColor(), setFillImage() and setGradientFill() param: mixed $fill The fill style |
setFillColor($color) X-Ref |
Sets the color of the filling of drawn objects param: mixed $color The fill color |
setFillImage($filename) X-Ref |
Sets an image that should be used for filling param: string $filename The filename of the image to fill with |
setGradientFill($gradient) X-Ref |
Sets a gradient fill param: array $gradient Gradient fill options |
setFont($fontOptions) X-Ref |
Sets the font options. The $font array may have the following entries: 'name' The name of the font. This name must either be supported natively by the canvas or mapped to a font using the font-mapping scheme 'size' Size in pixels 'angle' The angle with which to write the text param: array $fontOptions The font options. |
setDefaultFont($fontOptions) X-Ref |
Sets the default font options. The $font array may have the following entries: 'name' The name of the font. This name must either be supported natively by the canvas or mapped to a font using the font-mapping scheme 'size' Size in pixels 'angle' The angle with which to write the text param: array $fontOptions The font options. |
_reset() X-Ref |
Resets the canvas. Includes fillstyle, linestyle, thickness and polygon |
reset() X-Ref |
Reset the canvas. Includes fillstyle, linestyle, thickness and polygon |
drawEnd($params) X-Ref |
Draw a line end Parameter array: 'x': int X point 'y': int Y point 'end': string The end type of the end 'angle': int [optional] The angle with which to draw the end param: array $params Parameter array |
line($params) X-Ref |
Draw a line Parameter array: 'x0': int X start point 'y0': int Y start point 'x1': int X end point 'y1': int Y end point 'end0': string [optional] The end type of end0 (the start) 'end1': string [optional] The end type of end1 (the end) 'size0': int [optional] The size of end0 'size1': int [optional] The size of end1 'color': mixed [optional] The line color param: array $params Parameter array |
addVertex($params) X-Ref |
Adds vertex to a polygon Parameter array: 'x': int X point 'y': int Y point 'url': string [optional] URL to link the vertex to (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'alt': string [optional] Alternative text to show in the image map (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'target': string [optional] The link target on the image map (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'mapsize': int [optional] The size of the "map", i.e. the size of the hot spot (must be used with 'map_vertices' in polygon() on a canvas that support image maps) param: array $params Parameter array |
addSpline($params) X-Ref |
Adds "splined" vertex to a polygon Parameter array: 'x': int X point 'y': int Y point 'p1x': int X Control point 1 'p1y': int Y Control point 1 'p2x': int X Control point 2 'p2y': int Y Control point 2 'url': string [optional] URL to link the vertex to (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'alt': string [optional] Alternative text to show in the image map (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'target': string [optional] The link target on the image map (must be used with 'map_vertices' in polygon() on a canvas that support image maps) 'mapsize': int [optional] The size of the "map", i.e. the size of the hot spot (must be used with 'map_vertices' in polygon() on a canvas that support image maps) param: array $params Parameter array |
polygon($params) X-Ref |
Draws a polygon Parameter array: 'connect': bool [optional] Specifies whether the start point should be connected to the endpoint (closed polygon) or not (connected line) 'fill': mixed [optional] The fill color 'line': mixed [optional] The line color param: array $params Parameter array |
rectangle($params) X-Ref |
Draw a rectangle Parameter array: 'x0': int X start point 'y0': int Y start point 'x1': int X end point 'y1': int Y end point 'fill': mixed [optional] The fill color 'line': mixed [optional] The line color param: array $params Parameter array |
ellipse($params) X-Ref |
Draw an ellipse Parameter array: 'x': int X center point 'y': int Y center point 'rx': int X radius 'ry': int Y radius 'fill': mixed [optional] The fill color 'line': mixed [optional] The line color param: array $params Parameter array |
pieslice($params) X-Ref |
Draw a pie slice Parameter array: 'x': int X center point 'y': int Y center point 'rx': int X radius 'ry': int Y radius 'v1': int The starting angle (in degrees) 'v2': int The end angle (in degrees) 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut) 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut) 'fill': mixed [optional] The fill color 'line': mixed [optional] The line color param: array $params Parameter array |
textWidth($text) X-Ref |
Get the width of a text, param: string $text The text to get the width of return: int The width of the text |
textHeight($text) X-Ref |
Get the height of a text, param: string $text The text to get the height of return: int The height of the text |
addText($params) X-Ref |
Writes text Parameter array: 'x': int X-point of text 'y': int Y-point of text 'text': string The text to add 'alignment': array [optional] Alignment 'color': mixed [optional] The color of the text |
image($params) X-Ref |
Overlay image Parameter array: 'x': int X-point of overlayed image 'y': int Y-point of overlayed image 'filename': string The filename of the image to overlay 'width': int [optional] The width of the overlayed image (resizing if possible) 'height': int [optional] The height of the overlayed image (resizing if possible) 'alignment': array [optional] Alignment |
setClipping($params = false) X-Ref |
Set clipping to occur Parameter array: 'x0': int X point of Upper-left corner 'y0': int X point of Upper-left corner 'x1': int X point of lower-right corner 'y1': int Y point of lower-right corner |
startGroup($name = false) X-Ref |
Start a group. What this does, depends on the canvas/format. param: string $name The name of the group |
endGroup() X-Ref |
End the "current" group. What this does, depends on the canvas/format. |
show($params = false) X-Ref |
Output the result of the canvas to the browser param: array $params Parameter array, the contents and meaning depends on the actual Canvas |
save($params = false) X-Ref |
Save the result of the canvas to a file Parameter array: 'filename': string The file to output to param: array $params Parameter array, the contents and meaning depends on the actual Canvas |
toHtml($params) X-Ref |
Get a canvas specific HTML tag. This method implicitly saves the canvas to the filename in the filesystem path specified and parses it as URL specified by URL path Parameter array: 'filename': string 'filepath': string Path to the file on the file system. Remember the final slash 'urlpath': string Path to the file available through an URL. Remember the final slash |
factory($canvas, $params) X-Ref |
Canvas factory method. Supported canvass are: 'png': output in PNG format (using GD) 'jpg': output in JPEG format (using GD) 'pdf': output in PDF format (using PDFlib) 'svg': output in SVG format 'imagemap': output as a html image map An example of usage: <code> <?php $Canvas =& Image_Graph::factory('png', array('width' => 800, 'height' => 600, 'antialias' => 'native') ); ?> </code> param: string $canvas The canvas type param: array $params The parameters for the canvas constructor return: Image_Canvas The newly created canvas |
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |