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

Class: Image_Canvas

Source Location: /Image_Canvas-0.2.0/Canvas.php

Class Overview


Class for handling different output formats


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • Copyright (C) 2003, 2004 Jesper Veggerby Hansen

Methods


Child classes:

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

Inherited Variables

Inherited Methods


Class Details

[line 62]
Class for handling different output formats


[ Top ]


Method Detail

Image_Canvas (Constructor)   [line 151]

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 460]

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 571]

void addText( $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_WithMap::addText()
Writes text
Image_Canvas_GD::addText()
Writes text
Image_Canvas_PDF::addText()
Writes text
Image_Canvas_SVG::addText()
Writes text

Parameters:

   $params   — 

[ Top ]

addVertex   [line 437]

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 370]

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_GD::drawEnd()
Draw a line end

Parameters:

array   $params   —  Parameter array

[ Top ]

ellipse   [line 515]

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_WithMap::ellipse()
Draw an ellipse
Image_Canvas_GD::ellipse()
Draw an ellipse
Image_Canvas_PDF::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 607]

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 675]

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)

'svg': output in SVG format

'imagemap': output as a html image map

  • Return: The newly created canvas

Parameters:

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

[ Top ]

getHeight   [line 211]

int getHeight( )

Get the height of the canvas
  • Return: The height

[ Top ]

getWidth   [line 201]

int getWidth( )

Get the width of the canvas
  • Return: The width

[ Top ]

image   [line 587]

void image( $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_WithMap::image()
Overlay image
Image_Canvas_GD::image()
Overlay image
Image_Canvas_PDF::image()
Overlay image
Image_Canvas_SVG::image()
Overlay image

Parameters:

   $params   — 

[ Top ]

line   [line 389]

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_WithMap::line()
Draw a line
Image_Canvas_GD::line()
Draw a line
Image_Canvas_PDF::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 536]

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_WithMap::pieslice()
Draw a pie slice
Image_Canvas_GD::pieslice()
Draw a pie slice
Image_Canvas_PDF::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 481]

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_WithMap::polygon()
Draws a polygon
Image_Canvas_GD::polygon()
Parameter array:
Image_Canvas_PDF::polygon()
Parameter array:
Image_Canvas_SVG::polygon()
Parameter array:
Image_Canvas_ImageMap::polygon()
Draws a polygon

Parameters:

array   $params   —  Parameter array

[ Top ]

rectangle   [line 498]

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_WithMap::rectangle()
Draw a rectangle
Image_Canvas_GD::rectangle()
Draw a rectangle
Image_Canvas_PDF::rectangle()
Draw a rectangle
Image_Canvas_SVG::rectangle()
Draw a rectangle
Image_Canvas_ImageMap::rectangle()
Draw a rectangle

Parameters:

array   $params   —  Parameter array

[ Top ]

save   [line 635]

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_GD_JPG::save()
Output the result of the canvas
Image_Canvas_GD_PNG::save()
Output the result of the canvas
Image_Canvas_PDF::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 ]

setDefaultFont   [line 338]

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 244]

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 260]

void setFillColor( mixed $color)

Sets the color of the filling of drawn objects

Parameters:

mixed   $color   —  The fill color

[ Top ]

setFillImage   [line 270]

void setFillImage( string $filename)

Sets an image that should be used for filling

Overridden in child classes as:

Image_Canvas_GD::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_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 298]

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_GD::setFont()
Sets the font options.
Image_Canvas_PDF::setFont()
Sets the font options.
Image_Canvas_SVG::setFont()
Sets the font options.

Parameters:

array   $fontOptions   —  The font options.

[ Top ]

setGradientFill   [line 279]

void setGradientFill( array $gradient)

Sets a gradient fill

Overridden in child classes as:

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 231]

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 221]

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 617]

void show( [array $params = false])

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

Overridden in child classes as:

Image_Canvas_GD_JPG::show()
Output the result of the canvas
Image_Canvas_GD_PNG::show()
Output the result of the canvas
Image_Canvas_PDF::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 598]

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 557]

int textHeight( string $text)

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

Overridden in child classes as:

Image_Canvas_GD::textHeight()
Get the height of a text.
Image_Canvas_PDF::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 547]

int textWidth( string $text)

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

Overridden in child classes as:

Image_Canvas_GD::textWidth()
Get the width of a text,
Image_Canvas_PDF::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 650]

void toHtml( $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_GD::toHtml()
Get a canvas specific HTML tag.
Image_Canvas_PDF::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:

   $params   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:16:24 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.