mxGdCanvas.php

Summary
mxGdCanvas.php
Variables
antialiasSpecifies if image aspect should be preserved in drawImage.
mxGdCanvasCanvas for drawing graphs using the GD library.
Variables
antialiasSpecifies if antialiasing should be enabled.
enableTtfSpecifies if truetype fonts are enabled if available.
shadowColorHolds the color object for the shadow color defined in mxConstants.W3C_SHADOWCOLOR.
imageCacheHolds the image cache.
imageHolds the image.
heightHolds the height.
Functions
mxGdCanvasConstructs a new GD canvas.
loadImageReturns an image instance for the given URL.
drawCellDraws the given cell state.
drawLabelDraws the given label.
drawMarkerDraws the specified marker.
getImageReturns an image that represents this canvas.
setImageSets the image that represents the canvas.
getImageForStyleReturns an image that represents this canvas.
drawLineDraws the given line.
drawShapeDraws the given shape.
drawPolygonDraws the given polygon.
drawRectDraws then given rectangle.
drawOvalDraws then given ellipse.
drawRhombusDraws then given rhombus.
drawTriangleDraws then given triangle.
drawHexagonDraws then given haxagon.
drawCylinderDraws then given cylinder.
drawCloudDraws then given cloud.
drawActorDraws then given cloud.
drawImageDraws a given image.
drawText
getTrueTypeFontReturns the truetype font to be used to draw the text with the given style.
getTrueTypeFontSizeReturns the truetype font size to be used to draw the text with the given style.
drawTtfText
drawTtxTextLineDraws a single line of the given true type font text.
getFixedFontSizeReturns the fixed font size for GD (1 t0 5) for the given font properties
drawString
drawFixedTextLineDraws the given fixed text line.
getColorAllocates the given color and returns a reference to it.
offsetCreates a new array of x, y sequences where the each coordinate is translated by dx and dy, respectively.
destroyDestroys all allocated resources.
drawGraphDraws the given graph using this canvas.

Variables

antialias

Specifies if image aspect should be preserved in drawImage.  Default is true.

mxGdCanvas

Canvas for drawing graphs using the GD library.  This class requires GD support (GDLib).  Note that rounded corners, gradients and word wrapping are not supported by GD.

Summary
Variables
antialiasSpecifies if antialiasing should be enabled.
enableTtfSpecifies if truetype fonts are enabled if available.
shadowColorHolds the color object for the shadow color defined in mxConstants.W3C_SHADOWCOLOR.
imageCacheHolds the image cache.
imageHolds the image.
heightHolds the height.
Functions
mxGdCanvasConstructs a new GD canvas.
loadImageReturns an image instance for the given URL.
drawCellDraws the given cell state.
drawLabelDraws the given label.
drawMarkerDraws the specified marker.
getImageReturns an image that represents this canvas.
setImageSets the image that represents the canvas.
getImageForStyleReturns an image that represents this canvas.
drawLineDraws the given line.
drawShapeDraws the given shape.
drawPolygonDraws the given polygon.
drawRectDraws then given rectangle.
drawOvalDraws then given ellipse.
drawRhombusDraws then given rhombus.
drawTriangleDraws then given triangle.
drawHexagonDraws then given haxagon.
drawCylinderDraws then given cylinder.
drawCloudDraws then given cloud.
drawActorDraws then given cloud.
drawImageDraws a given image.
drawText
getTrueTypeFontReturns the truetype font to be used to draw the text with the given style.
getTrueTypeFontSizeReturns the truetype font size to be used to draw the text with the given style.
drawTtfText
drawTtxTextLineDraws a single line of the given true type font text.
getFixedFontSizeReturns the fixed font size for GD (1 t0 5) for the given font properties
drawString
drawFixedTextLineDraws the given fixed text line.
getColorAllocates the given color and returns a reference to it.
offsetCreates a new array of x, y sequences where the each coordinate is translated by dx and dy, respectively.
destroyDestroys all allocated resources.
drawGraphDraws the given graph using this canvas.

Variables

antialias

var $antialias

Specifies if antialiasing should be enabled.  Default is false.  NOTE: GD has a known bug where strokeWidths are ignored if this is enabled.

enableTtf

var $enableTtf

Specifies if truetype fonts are enabled if available.  Default is mxConstants.TTF_ENABLED.

shadowColor

var $shadowColor

Holds the color object for the shadow color defined in mxConstants.W3C_SHADOWCOLOR.

imageCache

var $imageCache

Holds the image cache.

image

var $image

Holds the image.

height

Holds the height.

Functions

mxGdCanvas

function mxGdCanvas($width =  0,
$height =  0,
$scale =  1,
$background =  null,
$imageBasePath =  "")

Constructs a new GD canvas.  Use a HTML color definition for the optional background parameter, eg. white or #FFFFFF.  The buffered image is only created if the given width and height are greater than 0.

loadImage

function loadImage($image)

Returns an image instance for the given URL.  If the URL has been loaded before than an instance of the same instance is returned as in the previous call.

drawCell

function drawCell($state)

Draws the given cell state.

drawLabel

function drawLabel($text,  
$state,  
$html =  false)

Draws the given label.

drawMarker

function drawMarker($type,
$p0,
$pe,
$size,
$stroke)

Draws the specified marker.

getImage

function getImage()

Returns an image that represents this canvas.

setImage

function setImage($img)

Sets the image that represents the canvas.

getImageForStyle

function getImageForStyle($style)

Returns an image that represents this canvas.

drawLine

function drawLine($x0,  
$y0,  
$x1,  
$y1,  
$stroke =  null,
$dashed =  false)

Draws the given line.

drawShape

function drawShape($x,
$y,
$w,
$h,
$style)

Draws the given shape.

drawPolygon

function drawPolygon($points,  
$fill =  null,
$stroke =  null,
$shadow =  false)

Draws the given polygon.

drawRect

function drawRect($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$rounded =  false,
$dashed =  false)

Draws then given rectangle.  Rounded is currently ignored.

drawOval

function drawOval($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)

Draws then given ellipse.

drawRhombus

function drawRhombus($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)

Draws then given rhombus.

drawTriangle

function drawTriangle($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$direction =  null)

Draws then given triangle.

drawHexagon

function drawHexagon($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$direction =  null)

Draws then given haxagon.

drawCylinder

function drawCylinder($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)

Draws then given cylinder.

drawCloud

function drawCloud($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow = false)

Draws then given cloud.

drawActor

function drawActor($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow = false)

Draws then given cloud.

drawImage

function drawImage($x,  
$y,  
$w,  
$h,  
$image,  
$aspect =  true,
$flipH =  false,
$flipV =  false)

Draws a given image.

drawText

function drawText($string,
$x,
$y,
$w,
$h,
$style)

getTrueTypeFont

function getTrueTypeFont($style)

Returns the truetype font to be used to draw the text with the given style.

getTrueTypeFontSize

function getTrueTypeFontSize($style)

Returns the truetype font size to be used to draw the text with the given style.  This returns the fontSize in the style of the default fontsize multiplied with <ttfSizeFactor>.

drawTtfText

function drawTtfText($string,
$x,
$y,
$w,
$h,
$style)

drawTtxTextLine

Draws a single line of the given true type font text.  The w and h are the width and height of the complete text box that contains this line.

getFixedFontSize

function getFixedFontSize($fontSize,  
$fontFamily,  
$fontStyle = null)

Returns the fixed font size for GD (1 t0 5) for the given font properties

drawString

drawFixedTextLine

function drawFixedTextLine($text,  
$font,  
$left,  
$top,  
$color,  
$horizontal =  true)

Draws the given fixed text line.

getColor

function getColor($hex,  
$default =  null)

Allocates the given color and returns a reference to it.  Supported color names are black, red, green, blue, orange, yellow, pink, turqoise, white, gray and any hex codes between 000000 and FFFFFF.

offset

function offset($points,  
$dx =  null,
$dy =  null)

Creates a new array of x, y sequences where the each coordinate is translated by dx and dy, respectively.

destroy

function destroy()

Destroys all allocated resources.

drawGraph

public static function drawGraph($graph,  
$clip =  null,
$bg =  null)

Draws the given graph using this canvas.

var $antialias
Specifies if antialiasing should be enabled.
var $enableTtf
Specifies if truetype fonts are enabled if available.
var $shadowColor
Holds the color object for the shadow color defined in mxConstants.W3C_SHADOWCOLOR.
public static $W3C_SHADOWCOLOR
Defines the color to be used to draw shadows in DOM documents.
var $imageCache
Holds the image cache.
var $image
Holds the image.
function mxGdCanvas($width =  0,
$height =  0,
$scale =  1,
$background =  null,
$imageBasePath =  "")
Constructs a new GD canvas.
function loadImage($image)
Returns an image instance for the given URL.
function drawCell($state)
Draws the given cell state.
function drawLabel($text,  
$state,  
$html =  false)
Draws the given label.
function drawMarker($type,
$p0,
$pe,
$size,
$stroke)
Draws the specified marker.
function getImage()
Returns an image that represents this canvas.
function setImage($img)
Sets the image that represents the canvas.
function getImageForStyle($style)
Returns an image that represents this canvas.
function drawLine($x0,  
$y0,  
$x1,  
$y1,  
$stroke =  null,
$dashed =  false)
Draws the given line.
function drawShape($x,
$y,
$w,
$h,
$style)
Draws the given shape.
function drawPolygon($points,  
$fill =  null,
$stroke =  null,
$shadow =  false)
Draws the given polygon.
function drawRect($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$rounded =  false,
$dashed =  false)
Draws then given rectangle.
function drawOval($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)
Draws then given ellipse.
function drawRhombus($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)
Draws then given rhombus.
function drawTriangle($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$direction =  null)
Draws then given triangle.
function drawHexagon($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false,
$direction =  null)
Draws then given haxagon.
function drawCylinder($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow =  false)
Draws then given cylinder.
function drawCloud($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow = false)
Draws then given cloud.
function drawActor($x,  
$y,  
$w,  
$h,  
$fill =  null,
$stroke =  null,
$shadow = false)
Draws then given cloud.
function drawImage($x,  
$y,  
$w,  
$h,  
$image,  
$aspect =  true,
$flipH =  false,
$flipV =  false)
Draws a given image.
function drawText($string,
$x,
$y,
$w,
$h,
$style)
function getTrueTypeFont($style)
Returns the truetype font to be used to draw the text with the given style.
function getTrueTypeFontSize($style)
Returns the truetype font size to be used to draw the text with the given style.
function drawTtfText($string,
$x,
$y,
$w,
$h,
$style)
function getFixedFontSize($fontSize,  
$fontFamily,  
$fontStyle = null)
Returns the fixed font size for GD (1 t0 5) for the given font properties
function drawFixedTextLine($text,  
$font,  
$left,  
$top,  
$color,  
$horizontal =  true)
Draws the given fixed text line.
function getColor($hex,  
$default =  null)
Allocates the given color and returns a reference to it.
function offset($points,  
$dx =  null,
$dy =  null)
Creates a new array of x, y sequences where the each coordinate is translated by dx and dy, respectively.
function destroy()
Destroys all allocated resources.
public static function drawGraph($graph,  
$clip =  null,
$bg =  null)
Draws the given graph using this canvas.
public static $TTF_ENABLED
Whether TrueType fonts should be enabled in the mxGdCanvas by default.
Close