ia.Shape Class
Utility class for drawing shapes on a canvas.
Constructor
ia.Shape
()
Item Index
Methods
- draw static
- drawArrowDown static
- drawArrowLeft static
- drawArrowRight static
- drawArrowUp static
- drawCircle static
- drawDiamond static
- drawGradient static
- drawHorizontalLine static
- drawLine static
- drawMinus static
- drawPlus static
- drawSquare static
- drawStar static
- drawTriangleDown static
- drawTriangleLeft static
- drawTriangleRight static
- drawTriangleUp static
- drawVerticalLine static
- drawX static
Properties
- ARROW_DOWN static
- ARROW_LEFT static
- ARROW_RIGHT static
- ARROW_UP static
- CIRCLE static
- DIAMOND static
- HORIZONTAL_LINE static
- LINE static
- MINUS static
- PLUS static
- SQUARE static
- STAR static
- TRIANGLE_DOWN static
- TRIANGLE_LEFT static
- TRIANGLE_RIGHT static
- TRIANGLE_UP static
- VERTICAL_LINE static
- X static
Methods
draw
-
name
-
ctx
-
x
-
y
-
size
Generic function for drawing a shape.
Parameters:
-
name
NumberThe name of the shape to draw.
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe shape size.
drawArrowDown
-
ctx
-
x
-
y
-
size
Draws a downward-pointing arrow shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawArrowLeft
-
ctx
-
x
-
y
-
size
Draws a left-pointing arrow shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawArrowRight
-
ctx
-
x
-
y
-
size
Draws a right-pointing arrow shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawArrowUp
-
ctx
-
x
-
y
-
size
Draws an upward-pointing arrow.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawCircle
-
ctx
-
x
-
y
-
size
Draws a circle shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawDiamond
-
ctx
-
x
-
y
-
size
Draws a diamond shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawGradient
-
canvas
-
colorList
-
orientation
Draws the gradient.
Parameters:
-
canvas
HTML Canvas ElementThe canvas to draw to.
-
colorList
ArrayAn array of color values.
-
orientation
String"leftToRight"; "rightToLeft"; "topToBottom"; "bottomToTop" - default is "bottomToTop".
drawHorizontalLine
-
ctx
-
x
-
y
-
size
Draws a horizontal line.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawLine
-
ctx
-
x
-
y
-
size
Draws a line.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawMinus
-
ctx
-
x
-
y
-
size
Draws a minus shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawPlus
-
ctx
-
x
-
y
-
size
Draws a plus shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawSquare
-
ctx
-
x
-
y
-
size
Draws a square shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawStar
-
ctx
-
x
-
y
-
size
Draws a star shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawTriangleDown
-
ctx
-
x
-
y
-
size
Draws a downward-pointing triangle shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawTriangleLeft
-
ctx
-
x
-
y
-
size
Draws a left-pointing arrow shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawTriangleRight
-
ctx
-
x
-
y
-
size
Draws a right-pointing triangle shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawTriangleUp
-
ctx
-
x
-
y
-
size
Draws an upward-pointing triangle.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawVerticalLine
-
ctx
-
x
-
y
-
size
Draws a vertical line.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
drawX
-
ctx
-
x
-
y
-
size
Draws an x shape.
Parameters:
-
ctx
HTML Canvas ContextThe graphics context to draw with.
-
x
NumberThe x position to centre the shape on.
-
y
NumberThe y position to centre the shape on.
-
size
NumberThe size of the symbol.
Properties
ARROW_DOWN
String
final
static
Constant indicating a downward-pointing arrow shape.
Default: "arrow down"
ARROW_LEFT
String
final
static
Constant indicating a leftward-pointing arrow shape.
Default: "rrow left"
ARROW_RIGHT
String
final
static
Constant indicating a rightward-pointing arrow shape.
Default: "arrow right"
ARROW_UP
String
final
static
Constant indicating a upward-pointing arrow shape.
Default: "arrow up"
CIRCLE
String
final
static
Constant indicating a circle shape.
Default: "circle"
DIAMOND
String
final
static
Constant indicating a diamond shape.
Default: "diamond"
HORIZONTAL_LINE
String
final
static
Constant indicating a horizontal line.
Default: "horizontal line"
LINE
String
final
static
Constant indicating a line.
Default: "line"
MINUS
String
final
static
Constant indicating a minus shape.
Default: "minus"
PLUS
String
final
static
Constant indicating a plus shape.
Default: "plus"
SQUARE
String
final
static
Constant indicating a square shape.
Default: "square"
STAR
String
final
static
Constant indicating a star shape.
Default: "star"
TRIANGLE_DOWN
String
final
static
Constant indicating a downward-pointing triangle shape.
Default: "triangle down"
TRIANGLE_LEFT
String
final
static
Constant indicating a leftward-pointing triangle shape.
Default: "triangle left"
TRIANGLE_RIGHT
String
final
static
Constant indicating a rightward-pointing triangle shape.
Default: "triangle right"
TRIANGLE_UP
String
final
static
Constant indicating a upward-pointing triangle shape.
Default: "triangle up"
VERTICAL_LINE
String
final
static
Constant indicating a vertical line.
Default: "vertical line"
X
String
final
static
Constant indicating an x shape.
Default: "x"