Class Karma.kCanvas
This object is the prototype for each canvas element submitted to Karma in the
Karma() method
Defined in: karma.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Prototype object for each canvas element submitted to Karma in the
Karma() method
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Karma.kCanvas.ctx
The 2 Dimensional Rendering context property for this canvas
|
<static> |
Karma.kCanvas.domId
Element ID for canvas element in html document.
|
<static> |
Karma.kCanvas.height
Height of canvas element
|
<static> |
Karma.kCanvas.name
Name of the canvas, used internally by karma.js
|
<static> |
Karma.kCanvas.node
Reference to the DOM element
|
<static> |
Karma.kCanvas.visible
Whether canvas is visible
|
<static> |
Karma.kCanvas.width
Width of canvas element
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Karma.kCanvas.arc()
Create an arc
For full details see W3C docs
|
<static> |
Karma.kCanvas.arcTo()
Draw an arc to the given points
For full details see W3C docs
|
<static> |
Karma.kCanvas.beginPath()
Begin a path
For full details see W3C docs
|
<static> |
Karma.kCanvas.bezierCurveTo()
Draw a bezier curve to given coordinates
For full details see W3C docs
|
<static> |
Karma.kCanvas.clear(x, y, width, height)
Clear area of canvas element specified by parameters, if no
parameters supplied, clears entire canvas
|
<static> |
Karma.kCanvas.clearRect()
Clear a rectangular area
For full details see W3C docs
|
<static> |
Karma.kCanvas.clip()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.closePath()
End a path
For full details see W3C docs
|
<static> |
Karma.kCanvas.createImageData()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.createLinearGradient()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.createPattern()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.createRadialGradient()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.drawImage()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.drawWindow()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.fill()
fill in the current subpaths with the current fillstyle
For full details see W3C docs
|
<static> |
Karma.kCanvas.fillRect()
Fill a rectangular area
For full details see W3C docs
|
<static> |
Karma.kCanvas.fillStyle()
Sets the fill style
For full details see W3C docs
|
<static> |
Karma.kCanvas.fillText()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.font()
Sets the font property and takes the same syntax as setting the font property
in CSS
For full details see W3C docs
|
<static> |
Karma.kCanvas.getImageData()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.globalAlpha(number)
The globalAlpha attribute gives an alpha value that is applied to shapes
and images before they are composited onto the canvas
|
<static> |
Karma.kCanvas.globalCompositeOperation(globalCompositeOperation)
Sets the globalCompositeOperation attribute, which sets how shapes and images
are drawn onto the existing bitmap, once they have had globalAlpha and the
current transformation matrix applied.
|
<static> |
Karma.kCanvas.isPointInPath()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.lineCap(type)
The lineCap attribute defines the type of endings that UAs will place on
the end of lines.
|
<static> |
Karma.kCanvas.lineJoin(type)
The lineJoin attribute defines the type of corners that UAs will place
where two lines meet.
|
<static> |
Karma.kCanvas.lineTo()
Draw a line to the given coordinates
For full details see W3C docs
|
<static> |
Karma.kCanvas.lineWidth(lineWidth)
Sets the lineWidth attribute which gives the width of lines, in coordinate space
units.
|
<static> |
Karma.kCanvas.measureText()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.miterLimit(number)
Sets the miter limit
For full details see W3C docs
|
<static> |
Karma.kCanvas.moveTo()
Move to specified coordinates
For full details see W3C docs
|
<static> |
Karma.kCanvas.putImageData()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.quadraticCurveTo()
Draw a quadratic curve to given coordinates
For full details see W3C docs
|
<static> |
Karma.kCanvas.rect()
Create a rectangle
For full details see W3C docs
|
<static> |
Karma.kCanvas.restore()
Restore the saved context
For full details see W3C docs
|
<static> |
Karma.kCanvas.rotate()
Perform a rotation transformation
For full details see W3C docs
|
<static> |
Karma.kCanvas.save()
Save the current state of the context
For full details see W3C docs
|
<static> |
Karma.kCanvas.scale()
Perform a scale transformation
For full details see W3C docs
|
<static> |
Karma.kCanvas.setTransform()
Set the transform
For full details see W3C docs
|
<static> |
Karma.kCanvas.shadowBlur()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.shadowColor()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.shadowOffsetX()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.shadowOffsetY()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.stroke()
Stroke the subpaths
For full details see W3C docs
|
<static> |
Karma.kCanvas.strokeRect()
Draw the outline of the rectangle
For full details see W3C docs
|
<static> |
Karma.kCanvas.strokeStyle()
Sets the stroke style
For full details see W3C docs
|
<static> |
Karma.kCanvas.strokeText()
description
For full details see W3C docs
|
<static> |
Karma.kCanvas.textAlign(alignment)
Changes the text alignment.
|
<static> |
Karma.kCanvas.textBaseline(alignment)
Changes the baseline alignment.
|
<static> |
Karma.kCanvas.transform()
Transform the identity matrix
For full details see W3C docs
|
<static> |
Karma.kCanvas.translate()
Performa a translation transformation
For full details see W3C docs
|
Class Detail
Karma.kCanvas()
Prototype object for each canvas element submitted to Karma in the
Karma() method
- Throws:
- {Error}
- if the name and domId for the canvas element are not specified
Field Detail
<static>
{2DRenderingContext}
Karma.kCanvas.ctx
The 2 Dimensional Rendering context property for this canvas
//Almost all of the context attributes and methods are wrapped in helper functions //but you can also access them directly using the ctx property Karma.canvas.someCanvas.ctx.drawImage(someImage, x, y); Karma.canvas.someCanvas.ctx.fillStyle = "#ffffff";
- Default Value:
- undefined
<static>
{String}
Karma.kCanvas.domId
Element ID for canvas element in html document. This value is read-only
- Default Value:
- undefined
<static>
{Number}
Karma.kCanvas.height
Height of canvas element
- Default Value:
- 0
<static>
{String}
Karma.kCanvas.name
Name of the canvas, used internally by karma.js
- Default Value:
- ''
<static>
{DOMElement}
Karma.kCanvas.node
Reference to the DOM element
//You can access all properties and methods of the underlying DOM element //using the 'node' property Karma.canvas.someCanvas.node.dispatchEvent( ... some event ...); var stuff = Karma.canvas.someCanvas.node.innerHTML;
- Default Value:
- undefined
<static>
{boolean}
Karma.kCanvas.visible
Whether canvas is visible
- Default Value:
- true
<static>
{Number}
Karma.kCanvas.width
Width of canvas element
- Default Value:
- 0
Method Detail
<static>
Karma.kCanvas.arc()
Create an arc
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.arcTo()
Draw an arc to the given points
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.beginPath()
Begin a path
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.bezierCurveTo()
Draw a bezier curve to given coordinates
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.clear(x, y, width, height)
Clear area of canvas element specified by parameters, if no
parameters supplied, clears entire canvas
k.canvas.ninja.clear(); // clears the entire ninja canvas k.canvas.ninja.clear(0, 10, 20, 30); //clears a specific portion of the ninja canvas
- Parameters:
- {Number} x Optional, Default: 0
- x coordinate, defaults to zero if left blank
- {Number} y Optional, Default: 0
- y coordinate, defaults to zero if left blank
- {Number} width Optional, Default: 0
- width of area to be cleared, defaults entire width of canvas
- {Number} height Optional, Default: 0
- height of area to be cleared, defaults entire height of canvas
- Returns:
- this
<static>
Karma.kCanvas.clearRect()
Clear a rectangular area
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.clip()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.closePath()
End a path
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.createImageData()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.createLinearGradient()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.createPattern()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.createRadialGradient()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.drawImage()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.drawWindow()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.fill()
fill in the current subpaths with the current fillstyle
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.fillRect()
Fill a rectangular area
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.fillStyle()
Sets the fill style
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.fillText()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.font()
Sets the font property and takes the same syntax as setting the font property
in CSS
For full details see W3C docs
- Parameters:
- {String}
- Returns:
- this
<static>
Karma.kCanvas.getImageData()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.globalAlpha(number)
The globalAlpha attribute gives an alpha value that is applied to shapes
and images before they are composited onto the canvas
- Parameters:
- {Number} number
- in the range from 0.0 to 1.0
- Returns:
- this
<static>
Karma.kCanvas.globalCompositeOperation(globalCompositeOperation)
Sets the globalCompositeOperation attribute, which sets how shapes and images
are drawn onto the existing bitmap, once they have had globalAlpha and the
current transformation matrix applied.
For full details see W3C docs
- Parameters:
- {String} globalCompositeOperation
- source-atop, source-in, source-out, source-over, destination-atop, destination-in, destination-out, destination-over, lighter
- Returns:
- this
<static>
Karma.kCanvas.isPointInPath()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.lineCap(type)
The lineCap attribute defines the type of endings that UAs will place on
the end of lines.
For full details see W3C docs
- Parameters:
- {String} type
- butt, round, square
- Returns:
- this
<static>
Karma.kCanvas.lineJoin(type)
The lineJoin attribute defines the type of corners that UAs will place
where two lines meet. The three valid values are bevel, round, and miter.
For full details see W3C docs
- Parameters:
- {String} type
- Returns:
- this
<static>
Karma.kCanvas.lineTo()
Draw a line to the given coordinates
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.lineWidth(lineWidth)
Sets the lineWidth attribute which gives the width of lines, in coordinate space
units.
For full details see W3C docs
- Parameters:
- {Number} lineWidth
- Returns:
- this
<static>
Karma.kCanvas.measureText()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.miterLimit(number)
Sets the miter limit
For full details see W3C docs
- Parameters:
- {Number} number
- Returns:
- this
<static>
Karma.kCanvas.moveTo()
Move to specified coordinates
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.putImageData()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.quadraticCurveTo()
Draw a quadratic curve to given coordinates
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.rect()
Create a rectangle
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.restore()
Restore the saved context
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.rotate()
Perform a rotation transformation
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.save()
Save the current state of the context
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.scale()
Perform a scale transformation
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.setTransform()
Set the transform
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.shadowBlur()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.shadowColor()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.shadowOffsetX()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.shadowOffsetY()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.stroke()
Stroke the subpaths
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.strokeRect()
Draw the outline of the rectangle
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.strokeStyle()
Sets the stroke style
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.strokeText()
description
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.textAlign(alignment)
Changes the text alignment. The possible values are start, end, left, right,
and center. The default is start. Other values are ignored.
For full details see W3C docs
- Parameters:
- {string} alignment
- Returns:
- this
<static>
Karma.kCanvas.textBaseline(alignment)
Changes the baseline alignment. If the value is one of top, hanging, middle,
alphabetic, ideographic, or bottom, then the value must be changed to the new value.
For full details see W3C docs
- Parameters:
- {String} alignment
- Returns:
- this
<static>
Karma.kCanvas.transform()
Transform the identity matrix
For full details see W3C docs
- Parameters:
- Returns:
- this
<static>
Karma.kCanvas.translate()
Performa a translation transformation
For full details see W3C docs
- Parameters:
- Returns:
- this