Class Index | File Index

Classes


Class Drawing


Defined in: graphics.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates an instance of the Drawing object
Field Summary
Field Attributes Field Name and Description
 
Drawing transparency (alpha) value.
 
Current font face property.
 
Fill blue colour property.
 
Fill green colour property.
 
Fill red colour property.
 
Current font size property.
 
Current font style property.
 
Line blue colour property.
 
Line green colour property.
 
Line red colour property.
 
Previous RGB fill style.
 
RGB fill colour property.
 
RGB line colour property.
Method Summary
Method Attributes Method Name and Description
 
box(ctx, x, y, width, height, fill)
Box (rectangle) drawing function.
 
circle(ctx, x, y, radius, fill)
Circle drawing function.
 
cls(ctx)
Clear the Canvas drawing context.
 
ellipse(ctx, x, y, radiusx, radiusy, fill)
Ellipse drawing function.
 
Return the current font face.
 
Return the current font size.
 
Return the current font style.
 
getPixelRGB(ctx, x, y)
Return the RGB value of a pixel as a string.
 
Return the RGB value of the fill colour as a 3 element array.
 
Return the RGB value of the line colour as a 3 element array.
 
Return the current drawing transparency (alpha) value.
 
line(ctx, x1, y1, x2, y2)
Line drawing function.
 
pixel(ctx, id, pix, x, y)
Pixel drawing function.
 
setFontFace(string)
Set the font face.
 
setFontSize(integer)
Set the font size.
 
setFontStyle(string)
Set the font style.
 
setRGBFill(ctx, r, g, b)
Set RGB fill colour.
 
setRGBLine(ctx, r, g, b)
Set RGB line colour.
 
text(ctx, string, x, y)
Text drawing function.
 
transparency(value)
Set the drawing transparency (alpha) value.
Class Detail
Drawing()
Creates an instance of the Drawing object
See:
graphics.js
Field Detail
{Number} alpha
Drawing transparency (alpha) value.

{String} currentFont
Current font face property. e.g "Verdana"

{Number} fillB
Fill blue colour property.

{Number} fillG
Fill green colour property.

{Number} fillR
Fill red colour property.

{Number} fontSize
Current font size property. e.g. 14

{String} fontStyle
Current font style property. e.g. "bold"

{Number} lineB
Line blue colour property.

{Number} lineG
Line green colour property.

{Number} lineR
Line red colour property.

{String} prevFillRGB
Previous RGB fill style.

{Number} rgbFill
RGB fill colour property.

{Number} rgbLine
RGB line colour property.
Method Detail
box(ctx, x, y, width, height, fill)
Box (rectangle) drawing function.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} x
X axis coordinate to start box drawing at.
{Number} y
Y axis coordinate to start box drawing at.
{Number} width
Width of box.
{Number} height
Height of box.
{Boolean} fill
Boolean denoting if the box should be filled or empty.

circle(ctx, x, y, radius, fill)
Circle drawing function.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} x
X axis coordinate to start circle drawing at.
{Number} y
Y axis coordinate to start circle drawing at.
{Number} radius
Radius of circle.
{Boolean} fill
Boolean denoting if the circle should be filled or empty.

cls(ctx)
Clear the Canvas drawing context.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.

ellipse(ctx, x, y, radiusx, radiusy, fill)
Ellipse drawing function.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} x
X axis coordinate to start ellipse drawing at.
{Number} y
Y axis coordinate to start ellipse drawing at.
{Number} radiusx
X axis radius of ellipse.
{Number} radiusy
Y axis radius of ellipse.
{Boolean} fill
Boolean denoting if the ellipse should be filled or empty.

{String} getCurrentFont()
Return the current font face.
Returns:
{String} String denoting current font face.

{Number} getFontSize()
Return the current font size.
Returns:
{Number} Number denoting current font size.

{String} getFontStyle()
Return the current font style.
Returns:
{String} String denoting current font style.

{String} getPixelRGB(ctx, x, y)
Return the RGB value of a pixel as a string.
Parameters:
ctx
x
y
Returns:
{String} String denoting pixel RGB value.

{Array} getRGBFill()
Return the RGB value of the fill colour as a 3 element array.
Returns:
{Array} 3 element array with red, green and blue fill colours.

{Array} getRGBLine()
Return the RGB value of the line colour as a 3 element array.
Returns:
{Array} 3 element array with red, green and blue line colours.

{Number} getTransparency()
Return the current drawing transparency (alpha) value.
Returns:
{Number} Number denoting current drawing transparency (alpha) value.

line(ctx, x1, y1, x2, y2)
Line drawing function.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} x1
X1 axis coordinate to start line at.
{Number} y1
Y1 axis coordinate to start line at.
{Number} x2
X2 axis coordinate to end line at.
{Number} y2
Y2 axis coordinate to end line at.

pixel(ctx, id, pix, x, y)
Pixel drawing function.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{ImageData} id
Image data object.
{ImageData.data} pix
ImageData.data object.
{Number} x
X axis coordinate to draw pixel at.
{Number} y
Y axis coordinate to draw pixel at.

setFontFace(string)
Set the font face. e.g "Verdana"
Parameters:
{String} string
String denoting font face.

setFontSize(integer)
Set the font size. e.g. 11
Parameters:
{Number} integer
Number denoting font size.

setFontStyle(string)
Set the font style. e.g. "bold"
Parameters:
{String} string
String denoting font style.

setRGBFill(ctx, r, g, b)
Set RGB fill colour.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} r
Red fill colour value.
{Number} g
Green fill colour value.
{Number} b
Blue fill colour value.

setRGBLine(ctx, r, g, b)
Set RGB line colour.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas 2D rendering context.
{Number} r
Red line colour value.
{Number} g
Green line colour value.
{Number} b
Blue line colour value.

text(ctx, string, x, y)
Text drawing function. Note: uses all font property values to draw text.
Parameters:
{[object CanvasRenderingContext2D]} ctx
Canvas drawing context.
{String} string
String for text to draw.
{Number} x
X axis coordinate to draw text at.
{Number} y
Y axis coordinate to draw text at.

transparency(value)
Set the drawing transparency (alpha) value.
Parameters:
{Number} value
Transparency (alpha) value.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri May 06 2011 14:41:27 GMT+0100 (BST)