Image_Canvas
[ class tree: Image_Canvas ] [ index: Image_Canvas ] [ all elements ]

Class: Image_Canvas

Source Location: /Image_Canvas-0.3.5/Image/Canvas.php

Class Overview


Class for handling different output formats


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2009 The PHP Group

Methods


Child classes:

Image_Canvas_SWF
SVG Canvas class.
Image_Canvas_PS
PostScript Canvas class.
Image_Canvas_PDF
PDF Canvas class.
Image_Canvas_WithMap
Class for handling different output formats including a HTML image map
Image_Canvas_SVG
SVG Canvas class.
Image_Canvas_ImageMap
Class for handling output as a HTML imagemap

Inherited Variables

Inherited Methods


Class Details

[line 63]
Class for handling different output formats


[ Top ]


Method Detail

Image_Canvas (Constructor)   [line 153]

Image_Canvas Image_Canvas( array $params)

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

  • Abstract:

Parameters:

array   $params     Parameter array

[ Top ]

addSpline   [line 505]

void addSpline( array $params)

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)


Overridden in child classes as:

Image_Canvas_WithMap::addSpline()
Adds "splined" vertex to a polygon

Parameters:

array   $params     Parameter array

[ Top ]

addText   [line 634]

void addText( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::addText()
Writes text
Image_Canvas_PS::addText()
Writes text
Image_Canvas_PDF::addText()
Writes text
Image_Canvas_WithMap::addText()
Writes text
Image_Canvas_GD::addText()
Writes text
Image_Canvas_SVG::addText()
Writes text

Parameters:

array   $params     Parameter array

[ Top ]

addVertex   [line 479]

void addVertex( array $params)

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)


Overridden in child classes as:

Image_Canvas_WithMap::addVertex()
Adds vertex to a polygon

Parameters:

array   $params     Parameter array

[ Top ]

drawEnd   [line 406]

void drawEnd( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::drawEnd()
Draw a line end
Image_Canvas_GD::drawEnd()
Draw a line end

Parameters:

array   $params     Parameter array

[ Top ]

ellipse   [line 569]

void ellipse( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::ellipse()
Draw an ellipse
Image_Canvas_PS::ellipse()
Draw an ellipse
Image_Canvas_PDF::ellipse()
Draw an ellipse
Image_Canvas_WithMap::ellipse()
Draw an ellipse
Image_Canvas_GD::ellipse()
Draw an ellipse
Image_Canvas_SVG::ellipse()
Draw an ellipse
Image_Canvas_ImageMap::ellipse()
Draw an ellipse

Parameters:

array   $params     Parameter array

[ Top ]

endGroup   [line 696]

void endGroup( )

End the "current" group.

What this does, depends on the canvas/format.


Overridden in child classes as:

Image_Canvas_SVG::endGroup()
End the "current" group.

[ Top ]

factory   [line 789]

Image_Canvas &factory( string $canvas, array $params)

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)

'ps': output in PostScript format (using pslib)

'svg': output in SVG format

'swf': output in SWF flash format (using ming extension)

'imagemap': output as a html image map

An example of usage:

  1.  <?php
  2.  $Canvas =Image_Graph::factory('png',
  3.      array('width' => 800'height' => 600'antialias' => 'native')
  4.  );
  5.  ?>

  • Return: The newly created canvas or PEAR_Error on error

Parameters:

string   $canvas     The canvas type
array   $params     The parameters for the canvas constructor

[ Top ]

getHeight   [line 215]

int getHeight( )

Get the height of the canvas
  • Return: The height

[ Top ]

getWidth   [line 205]

int getWidth( )

Get the width of the canvas
  • Return: The width

[ Top ]

image   [line 654]

void image( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::image()
Overlay image
Image_Canvas_PS::image()
Overlay image
Image_Canvas_PDF::image()
Overlay image
Image_Canvas_WithMap::image()
Overlay image
Image_Canvas_GD::image()
Overlay image
Image_Canvas_SVG::image()
Overlay image

Parameters:

array   $params     Parameter array

[ Top ]

line   [line 428]

void line( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::line()
Parameter array:
Image_Canvas_PS::line()
Draw a line
Image_Canvas_PDF::line()
Draw a line
Image_Canvas_WithMap::line()
Draw a line
Image_Canvas_GD::line()
Draw a line
Image_Canvas_SVG::line()
Parameter array:
Image_Canvas_ImageMap::line()
Draw a line

Parameters:

array   $params     Parameter array

[ Top ]

pieslice   [line 593]

void pieslice( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::pieslice()
Draw a pie slice
Image_Canvas_PS::pieslice()
Draw a pie slice
Image_Canvas_PDF::pieslice()
Draw a pie slice
Image_Canvas_WithMap::pieslice()
Draw a pie slice
Image_Canvas_GD::pieslice()
Draw a pie slice
Image_Canvas_SVG::pieslice()
Draw a pie slice
Image_Canvas_ImageMap::pieslice()
Draw a pie slice

Parameters:

array   $params     Parameter array

[ Top ]

polygon   [line 529]

void polygon( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::polygon()
Parameter array:
Image_Canvas_PS::polygon()
Parameter array:
Image_Canvas_PDF::polygon()
Parameter array:
Image_Canvas_WithMap::polygon()
Draws a polygon
Image_Canvas_GD::polygon()
Parameter array:
Image_Canvas_SVG::polygon()
Parameter array:
Image_Canvas_ImageMap::polygon()
Draws a polygon

Parameters:

array   $params     Parameter array

[ Top ]

rectangle   [line 549]

void rectangle( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::rectangle()
Draw a rectangle
Image_Canvas_PS::rectangle()
Draw a rectangle
Image_Canvas_PDF::rectangle()
Draw a rectangle
Image_Canvas_WithMap::rectangle()
Draw a rectangle
Image_Canvas_GD::rectangle()
Draw a rectangle
Image_Canvas_SVG::rectangle()
Draw a rectangle
Image_Canvas_ImageMap::rectangle()
Draw a rectangle

Parameters:

array   $params     Parameter array

[ Top ]

reset   [line 388]

void reset( )

Reset the canvas.

Includes fillstyle, linestyle, thickness and polygon


[ Top ]

save   [line 729]

void save( [array $params = false])

Save the result of the canvas to a file

Parameter array: 'filename': string The file to output to

  • Abstract:

Overridden in child classes as:

Image_Canvas_SWF::save()
Save the SWF to a file
Image_Canvas_PS::save()
Output the result of the canvas
Image_Canvas_PDF::save()
Output the result of the canvas
Image_Canvas_GD_PNG::save()
Output the result of the canvas
Image_Canvas_GD_JPG::save()
Output the result of the canvas
Image_Canvas_SVG::save()
Output the result of the canvas
Image_Canvas_ImageMap::save()
Save the result of the canvas to a file

Parameters:

array   $params     Parameter array, the contents and meaning depends on the actual Canvas

[ Top ]

setClipping   [line 672]

void setClipping( [array $params = false])

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


Overridden in child classes as:

Image_Canvas_SWF::setClipping()
Set clipping to occur
Image_Canvas_GD::setClipping()
Set clipping to occur
Image_Canvas_SVG::setClipping()
Set clipping to occur

Parameters:

array   $params     Parameter array (x0, y0, x1, y1)

[ Top ]

setDefaultFont   [line 358]

void setDefaultFont( array $fontOptions)

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


Parameters:

array   $fontOptions     The font options.

[ Top ]

setFill   [line 254]

void setFill( mixed $fill)

Sets the style of the filling of drawn objects.

This method gives simple access to setFillColor(), setFillImage() and setGradientFill()


Parameters:

mixed   $fill     The fill style

[ Top ]

setFillColor   [line 272]

void setFillColor( mixed $color)

Sets the color of the filling of drawn objects

Parameters:

mixed   $color     The fill color

[ Top ]

setFillImage   [line 284]

void setFillImage( string $filename)

Sets an image that should be used for filling

Overridden in child classes as:

Image_Canvas_SWF::setFillImage()
Sets an image that should be used for filling
Image_Canvas_PS::setFillImage()
Sets an image that should be used for filling.
Image_Canvas_PDF::setFillImage()
Sets an image that should be used for filling.
Image_Canvas_GD::setFillImage()
Sets an image that should be used for filling
Image_Canvas_SVG::setFillImage()
Sets an image that should be used for filling

Parameters:

string   $filename     The filename of the image to fill with

[ Top ]

setFont   [line 316]

void setFont( array $fontOptions)

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


Overridden in child classes as:

Image_Canvas_SWF::setFont()
Sets the font options.
Image_Canvas_PS::setFont()
Sets the font options.
Image_Canvas_PDF::setFont()
Sets the font options.
Image_Canvas_GD::setFont()
Sets the font options.
Image_Canvas_SVG::setFont()
Sets the font options.

Parameters:

array   $fontOptions     The font options.

[ Top ]

setGradientFill   [line 295]

void setGradientFill( array $gradient)

Sets a gradient fill

Overridden in child classes as:

Image_Canvas_SWF::setGradientFill()
Sets a gradient fill
Image_Canvas_PS::setGradientFill()
Sets a gradient fill
Image_Canvas_PDF::setGradientFill()
Sets a gradient fill
Image_Canvas_SVG::setGradientFill()
Sets a gradient fill

Parameters:

array   $gradient     Gradient fill options

[ Top ]

setLineColor   [line 239]

void setLineColor( mixed $color)

Sets the color of the line(s) to be drawn

Parameters:

mixed   $color     The color of the line

[ Top ]

setLineThickness   [line 227]

void setLineThickness( int $thickness)

Sets the thickness of the line(s) to be drawn

Parameters:

int   $thickness     The actual thickness (in pixels)

[ Top ]

show   [line 708]

void show( [array $params = false])

Output the result of the canvas to the browser
  • Abstract:

Overridden in child classes as:

Image_Canvas_SWF::show()
Display the SWF
Image_Canvas_PS::show()
Output the result of the canvas
Image_Canvas_PDF::show()
Output the result of the canvas
Image_Canvas_GD_PNG::show()
Output the result of the canvas
Image_Canvas_GD_JPG::show()
Output the result of the canvas
Image_Canvas_SVG::show()
Output the result of the canvas
Image_Canvas_ImageMap::show()
Output the result of the canvas to the browser

Parameters:

array   $params     Parameter array, the contents and meaning depends on the actual Canvas

[ Top ]

startGroup   [line 685]

void startGroup( [string $name = false])

Start a group.

What this does, depends on the canvas/format.


Overridden in child classes as:

Image_Canvas_SVG::startGroup()
Start a group.

Parameters:

string   $name     The name of the group

[ Top ]

textHeight   [line 616]

int textHeight( string $text)

Get the height of a text,
  • Return: The height of the text

Overridden in child classes as:

Image_Canvas_SWF::textHeight()
Get the height of a text,
Image_Canvas_PS::textHeight()
Get the height of a text,
Image_Canvas_PDF::textHeight()
Get the height of a text,
Image_Canvas_GD::textHeight()
Get the height of a text.
Image_Canvas_SVG::textHeight()
Get the height of a text,

Parameters:

string   $text     The text to get the height of

[ Top ]

textWidth   [line 605]

int textWidth( string $text)

Get the width of a text,
  • Return: The width of the text

Overridden in child classes as:

Image_Canvas_SWF::textWidth()
Get the width of a text,
Image_Canvas_PS::textWidth()
Get the width of a text,
Image_Canvas_PDF::textWidth()
Get the width of a text,
Image_Canvas_GD::textWidth()
Get the width of a text,
Image_Canvas_SVG::textWidth()
Get the width of a text,

Parameters:

string   $text     The text to get the width of

[ Top ]

toHtml   [line 748]

void toHtml( array $params)

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


Overridden in child classes as:

Image_Canvas_SWF::toHtml()
Get an SWF specific HTML tag
Image_Canvas_PS::toHtml()
Get a canvas specific HTML tag.
Image_Canvas_PDF::toHtml()
Get a canvas specific HTML tag.
Image_Canvas_GD::toHtml()
Get a canvas specific HTML tag.
Image_Canvas_SVG::toHtml()
Get a canvas specific HTML tag.
Image_Canvas_ImageMap::toHtml()
Get a canvas specific HTML tag.

Parameters:

array   $params     Parameter array (filename, filepath, urlpath)

[ Top ]


Documentation generated on Fri, 27 Jul 2012 07:30:05 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.