Graph: ezcGraphDriver
[ ]
[ Gallery ]
[ ]
[ ]
[ ]
[ ]
Class: ezcGraphDriver
|
Abstract class to be extended for ezcGraph output drivers. [
source]
Descendents
Member Variables
|
protected ezcDriverOptions |
$options
Driveroptions |
Method Summary
|
public abstract void |
drawCircle(
$center, $width, $height, $color, [$filled = true] )
Draw circle |
|
public abstract void |
drawCircleSector(
$center, $width, $height, $startAngle, $endAngle, $color, [$filled = true] )
Draws a sector of cirlce |
|
public abstract void |
drawCircularArc(
$center, $width, $height, $size, $startAngle, $endAngle, $color, [$filled = true] )
Draws a circular arc |
|
public abstract void |
drawImage(
$file, $position, $width, $height )
Draw an image |
|
public abstract void |
drawLine(
$start, $end, $color, [$thickness = 1.] )
Draws a line |
|
public abstract void |
drawPolygon(
$points, $color, [$filled = true], [$thickness = 1.] )
Draws a single polygon. |
|
public abstract void |
drawTextBox(
$string, $position, $width, $height, $align, [$rotation = null] )
Writes text in a box of desired size |
|
public abstract string |
getMimeType(
)
Return mime type for current image format |
|
protected abstract ezcGraphBoundings |
getTextBoundings(
$size, $font, $text )
Returns boundings of text depending on the available font extension |
|
protected array |
reduceEllipseSize(
$center, $width, $height, $startAngle, $endAngle, $size )
Reduce the size of an ellipse |
|
protected array( |
reducePolygonSize(
$points, $size )
Reduces the size of a polygon |
|
public abstract void |
render(
$file )
Finally save image |
|
public void |
renderToOutput(
)
Render image directly to output |
|
protected mixed |
testFitStringInTextBox(
$string, $position, $width, $height, $size )
Test if string fits in a box with given font size |
|
protected void |
tryFitShortenedString(
$string, $position, $width, $height, $size )
If it is allow to shortened the string, this method tries to extract as many chars as possible to display a decent amount of characters. |
Methods
drawCircle
Draw circle
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of ellipse |
$width |
mixed |
Width of ellipse |
$height |
mixed |
height of ellipse |
$color |
ezcGraphColor |
Color |
$filled |
mixed |
Filled |
Redefined in descendants as
drawCircleSector
void drawCircleSector(
ezcGraphCoordinate
$center, mixed
$width, mixed
$height, mixed
$startAngle, mixed
$endAngle,
ezcGraphColor
$color, [mixed
$filled = true] )
Draws a sector of cirlce
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of circle |
$width |
mixed |
Width |
$height |
mixed |
Height |
$startAngle |
mixed |
Start angle of circle sector |
$endAngle |
mixed |
End angle of circle sector |
$color |
ezcGraphColor |
Color |
$filled |
mixed |
Filled |
Redefined in descendants as
drawCircularArc
void drawCircularArc(
ezcGraphCoordinate
$center, integer
$width, integer
$height, integer
$size, float
$startAngle, float
$endAngle,
ezcGraphColor
$color, [bool
$filled = true] )
Draws a circular arc
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of ellipse |
$width |
integer |
Width of ellipse |
$height |
integer |
Height of ellipse |
$size |
integer |
Height of border |
$startAngle |
float |
Starting angle of circle sector |
$endAngle |
float |
Ending angle of circle sector |
$color |
ezcGraphColor |
Color of Border |
$filled |
bool |
Fill state |
Redefined in descendants as
drawImage
Draw an image
Parameters
| Name |
Type |
Description |
$file |
mixed |
Image file |
$position |
ezcGraphCoordinate |
Top left position |
$width |
mixed |
Width of image in destination image |
$height |
mixed |
Height of image in destination image |
Redefined in descendants as
drawLine
Draws a line
Parameters
Redefined in descendants as
drawPolygon
void drawPolygon(
$points,
ezcGraphColor
$color, [mixed
$filled = true], [float
$thickness = 1.] )
Draws a single polygon.
Parameters
| Name |
Type |
Description |
$points |
array |
Point array |
$color |
ezcGraphColor |
Polygon color |
$filled |
mixed |
Filled |
$thickness |
float |
Line thickness |
Redefined in descendants as
drawTextBox
void drawTextBox(
string
$string,
ezcGraphCoordinate
$position, float
$width, float
$height, int
$align, [
$rotation = null] )
Writes text in a box of desired size
Parameters
| Name |
Type |
Description |
$string |
string |
Text |
$position |
ezcGraphCoordinate |
Top left position |
$width |
float |
Width of text box |
$height |
float |
Height of text box |
$align |
int |
Alignement of text |
$rotation |
ezcGraphRotation |
|
Redefined in descendants as
getMimeType
string getMimeType(
)
Return mime type for current image format
Redefined in descendants as
getTextBoundings
Returns boundings of text depending on the available font extension
Parameters
Redefined in descendants as
reduceEllipseSize
array reduceEllipseSize(
ezcGraphCoordinate
$center, float
$width, float
$height, float
$startAngle, float
$endAngle, float
$size )
Reduce the size of an ellipse
The method returns a the edgepoints and angles for an ellipse where all borders are moved to the inner side of the ellipse by the give $size value.
The method returns an array ( 'center' => (ezcGraphCoordinate) New center point, 'start' => (ezcGraphCoordinate) New outer start point, 'end' => (ezcGraphCoordinate) New outer end point, )
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
|
$width |
float |
|
$height |
float |
|
$startAngle |
float |
|
$endAngle |
float |
|
$size |
float |
|
Throws
| Class | Description |
ezcGraphReducementFailedException |
|
reducePolygonSize
array( reducePolygonSize(
$points, float
$size )
Reduces the size of a polygon
The method takes a polygon defined by a list of points and reduces its size by moving all lines to the middle by the given $size value.
The detection of the inner side of the polygon depends on the angle at each edge point. This method will always work for 3 edged polygones, because the smaller angle will always be on the inner side. For polygons with more then 3 edges this method may fail. For ezcGraph this is a valid simplification, because we do not have any polygones which have an inner angle >= 180 degrees.
Parameters
| Name |
Type |
Description |
$points |
array(ezcGraphCoordinate) |
|
$size |
float |
|
Throws
| Class | Description |
ezcGraphReducementFailedException |
|
render
void render(
string
$file )
Finally save image
Parameters
| Name |
Type |
Description |
$file |
string |
Destination filename |
Redefined in descendants as
renderToOutput
void renderToOutput(
)
Render image directly to output
The method renders the image directly to the standard output. You normally do not want to use this function, because it makes it harder to proper cache the generated graphs.
Redefined in descendants as
testFitStringInTextBox
mixed testFitStringInTextBox(
string
$string,
ezcGraphCoordinate
$position, float
$width, float
$height, int
$size )
Test if string fits in a box with given font size
This method splits the text up into tokens and tries to wrap the text in an optimal way to fit in the Box defined by width and height.
If the text fits into the box an array with lines is returned, which can be used to render the text later: array( // Lines array( 'word', 'word', .. ), ) Otherwise the function will return false.
Parameters
| Name |
Type |
Description |
$string |
string |
Text |
$position |
ezcGraphCoordinate |
Topleft position of the text box |
$width |
float |
Width of textbox |
$height |
float |
Height of textbox |
$size |
int |
Fontsize |
tryFitShortenedString
void tryFitShortenedString(
mixed
$string,
ezcGraphCoordinate
$position, mixed
$width, mixed
$height, mixed
$size )
If it is allow to shortened the string, this method tries to extract as many chars as possible to display a decent amount of characters.
If no complete token (word) does fit, the largest possible amount of chars from the first word are taken. If the amount of chars is bigger then strlen( shortenedStringPostFix ) * 2 the last chars are replace by the postfix.
If one complete word fits the box as many words are taken as possible including a appended shortenedStringPostFix.
Parameters
| Name |
Type |
Description |
$string |
mixed |
|
$position |
ezcGraphCoordinate |
|
$width |
mixed |
|
$height |
mixed |
|
$size |
mixed |
|
Last updated: Tue, 23 Mar 2010