
public class JsCanvasRenderingContext2D extends JsCanvasRenderingContext implements CanvasRenderingContext2D
SVG_ZOOMANDPAN_DISABLE, SVG_ZOOMANDPAN_MAGNIFY, SVG_ZOOMANDPAN_UNKNOWN| Modifier | Constructor and Description |
|---|---|
protected |
JsCanvasRenderingContext2D() |
| Modifier and Type | Method and Description |
|---|---|
void |
arc(float x,
float y,
float radius,
float startAngle,
float endAngle,
boolean anticlockwise)
Adds an arc to the path which it center is at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
|
void |
arcTo(float x1,
float y1,
float x2,
float y2,
float radius)
Adds an arc with the given control points and radius, connected to the previous point by a straight line.
|
void |
beginPath() |
void |
bezierCurveTo(float cp1x,
float cp1y,
float cp2x,
float cp2y,
float x,
float y) |
void |
clearRect(float x,
float y,
float width,
float height)
Clears the rectangle defined by it starting point at (x, y) and has a w width and a h height.
|
void |
clearShadow() |
void |
clip() |
void |
closePath() |
JsImageData |
createImageData(float sw,
float sh) |
JsImageData |
createImageData(ImageData imagedata) |
JsCanvasGradient |
createLinearGradient(float x0,
float y0,
float x1,
float y1) |
JsCanvasPattern |
createPattern(CanvasElement canvas,
String repetitionType)
Parameters |
JsCanvasPattern |
createPattern(ImageElement image,
String repetitionType)
Parameters |
JsCanvasGradient |
createRadialGradient(float x0,
float y0,
float r0,
float x1,
float y1,
float r1) |
void |
drawImage(CanvasElement canvas,
float x,
float y)
Draws the specified image.
|
void |
drawImage(CanvasElement canvas,
float x,
float y,
float width,
float height)
Draws the specified image.
|
void |
drawImage(CanvasElement canvas,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh)
Draws the specified image.
|
void |
drawImage(ImageElement image,
float x,
float y)
Draws the specified image.
|
void |
drawImage(ImageElement image,
float x,
float y,
float width,
float height)
Draws the specified image.
|
void |
drawImage(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh)
Draws the specified image.
|
void |
drawImage(VideoElement video,
float x,
float y)
Draws the specified image.
|
void |
drawImage(VideoElement video,
float x,
float y,
float width,
float height)
Draws the specified image.
|
void |
drawImage(VideoElement video,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh)
Draws the specified image.
|
void |
drawImageFromRect(ImageElement image) |
void |
drawImageFromRect(ImageElement image,
float sx) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh) |
void |
drawImageFromRect(ImageElement image,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh,
String compositeOperation) |
void |
fill()
Fills the subpaths with the current fill style.
|
void |
fillRect(float x,
float y,
float width,
float height)
Draws a filled rectangle at (x, y) position whose size is determined by width and height.
|
void |
fillText(String text,
float x,
float y) |
void |
fillText(String text,
float x,
float y,
float maxWidth) |
Object |
getFillStyle()
Color or style to use inside shapes.
|
String |
getFont()
Default value
10px sans-serif. |
float |
getGlobalAlpha()
Alpha value that is applied to shapes and images before they are composited onto the canvas.
|
String |
getGlobalCompositeOperation()
With
globalAplpha applied this sets how shapes and images are drawn onto the existing bitmap. |
JsImageData |
getImageData(float sx,
float sy,
float sw,
float sh)
Returns an
ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has a sw width and sh height. |
String |
getLineCap()
Type of endings on the end of lines.
|
String |
getLineJoin()
Defines the type of corners where two lines meet.
|
float |
getLineWidth()
Width of lines.
|
float |
getMiterLimit()
Default
10. |
float |
getShadowBlur()
Specifies the blurring effect.
|
String |
getShadowColor()
Color of the shadow.
|
float |
getShadowOffsetX()
Horizontal distance the shadow will be offset.
|
float |
getShadowOffsetY()
Vertical distance the shadow will be offset.
|
Object |
getStrokeStyle()
Color or style to use for the lines around shapes.
|
String |
getTextAlign()
Possible values:
start (default), end, left, right or center. |
String |
getTextBaseline() |
float |
getWebkitBackingStorePixelRatio() |
JsIndexable |
getWebkitLineDash()
An array which specifies the lengths of alternating dashes and gaps.
|
float |
getWebkitLineDashOffset()
Specifies where to start a dasharray on a line.
|
boolean |
isPointInPath(float x,
float y)
Reports whether or not the specified point is contained in the current path.
|
boolean |
isWebkitImageSmoothingEnabled()
Image smoothing mode; if disabled, images will not be smoothed if scaled.
|
void |
lineTo(float x,
float y)
Connects the last point in the subpath to the
x, y coordinates with a straight line. |
JsTextMetrics |
measureText(String text) |
void |
moveTo(float x,
float y)
Moves the starting point of a new subpath to the (x, y) coordinates.
|
void |
putImageData(ImageData imagedata,
float dx,
float dy)
Compatibility notes |
void |
putImageData(ImageData imagedata,
float dx,
float dy,
float dirtyX,
float dirtyY,
float dirtyWidth,
float dirtyHeight)
Compatibility notes |
void |
quadraticCurveTo(float cpx,
float cpy,
float x,
float y) |
void |
rect(float x,
float y,
float width,
float height) |
void |
restore()
Restores the drawing style state to the last element on the 'state stack' saved by save()
|
void |
rotate(float angle) |
void |
save()
Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
|
void |
scale(float sx,
float sy) |
void |
setAlpha(float alpha) |
void |
setCompositeOperation(String compositeOperation) |
void |
setFillColor(float grayLevel) |
void |
setFillColor(float grayLevel,
float alpha) |
void |
setFillColor(float r,
float g,
float b,
float a) |
void |
setFillColor(float c,
float m,
float y,
float k,
float a) |
void |
setFillColor(String color) |
void |
setFillColor(String color,
float alpha) |
void |
setFillStyle(Object param_fillStyle) |
void |
setFont(String param_font) |
void |
setGlobalAlpha(float param_globalAlpha) |
void |
setGlobalCompositeOperation(String param_globalCompositeOperation) |
void |
setLineCap(String param_lineCap) |
void |
setLineJoin(String param_lineJoin) |
void |
setLineWidth(float param_lineWidth) |
void |
setMiterLimit(float param_miterLimit) |
void |
setShadow(float width,
float height,
float blur) |
void |
setShadow(float width,
float height,
float blur,
float grayLevel) |
void |
setShadow(float width,
float height,
float blur,
float grayLevel,
float alpha) |
void |
setShadow(float width,
float height,
float blur,
float r,
float g,
float b,
float a) |
void |
setShadow(float width,
float height,
float blur,
float c,
float m,
float y,
float k,
float a) |
void |
setShadow(float width,
float height,
float blur,
String color) |
void |
setShadow(float width,
float height,
float blur,
String color,
float alpha) |
void |
setShadowBlur(float param_shadowBlur) |
void |
setShadowColor(String param_shadowColor) |
void |
setShadowOffsetX(float param_shadowOffsetX) |
void |
setShadowOffsetY(float param_shadowOffsetY) |
void |
setStrokeColor(float grayLevel) |
void |
setStrokeColor(float grayLevel,
float alpha) |
void |
setStrokeColor(float r,
float g,
float b,
float a) |
void |
setStrokeColor(float c,
float m,
float y,
float k,
float a) |
void |
setStrokeColor(String color) |
void |
setStrokeColor(String color,
float alpha) |
void |
setStrokeStyle(Object param_strokeStyle) |
void |
setTextAlign(String param_textAlign) |
void |
setTextBaseline(String param_textBaseline) |
void |
setTransform(float m11,
float m12,
float m21,
float m22,
float dx,
float dy) |
void |
setWebkitImageSmoothingEnabled(boolean param_webkitImageSmoothingEnabled) |
void |
setWebkitLineDash(Indexable param_webkitLineDash) |
void |
setWebkitLineDashOffset(float param_webkitLineDashOffset) |
void |
stroke()
Strokes the subpaths with the current stroke style.
|
void |
strokeRect(float x,
float y,
float width,
float height)
Paints a rectangle which it starting point is at (x, y) and has a w width and a h height onto the canvas, using the current stroke style.
|
void |
strokeRect(float x,
float y,
float width,
float height,
float lineWidth)
Paints a rectangle which it starting point is at (x, y) and has a w width and a h height onto the canvas, using the current stroke style.
|
void |
strokeText(String text,
float x,
float y) |
void |
strokeText(String text,
float x,
float y,
float maxWidth) |
void |
transform(float m11,
float m12,
float m21,
float m22,
float dx,
float dy) |
void |
translate(float tx,
float ty)
Moves the origin point of the context to (x, y).
|
JsImageData |
webkitGetImageDataHD(float sx,
float sy,
float sw,
float sh) |
void |
webkitPutImageDataHD(ImageData imagedata,
float dx,
float dy) |
void |
webkitPutImageDataHD(ImageData imagedata,
float dx,
float dy,
float dirtyX,
float dirtyY,
float dirtyWidth,
float dirtyHeight) |
getCanvasaddEventListener, addEventListener, beginElement, beginElementAt, dispatchEvent, endElement, endElementAt, getAnimatedClassName, getAnimatedHeight, getAnimatedHref, getAnimatedResult, getAnimatedTransform, getAnimatedWidth, getAnimatedX, getAnimatedY, getBBox, getChildElementCount, getCTM, getExternalResourcesRequired, getFarthestViewportElement, getFirstElementChild, getLastElementChild, getNearestViewportElement, getNextElementSibling, getPresentationAttribute, getPreserveAspectRatio, getPreviousElementSibling, getRequiredExtensions, getRequiredFeatures, getScreenCTM, getSvgStyle, getSystemLanguage, getTransformToElement, getViewBox, getXmllang, getXmlspace, getZoomAndPan, hasExtension, querySelector, querySelectorAll, removeEventListener, removeEventListener, setXmllang, setXmlspace, setZoomAndPanat, at, intAt, intAt, length, numberAt, numberAt, setAt, setAt, setAt, setAt, setAt, setAtcast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toStringgetCanvasintAt, lengthnumberAtpublic final Object getFillStyle()
CanvasRenderingContext2D#000 (black).getFillStyle in interface CanvasRenderingContext2Dpublic final void setFillStyle(Object param_fillStyle)
setFillStyle in interface CanvasRenderingContext2Dpublic final String getFont()
CanvasRenderingContext2D10px sans-serif.getFont in interface CanvasRenderingContext2Dpublic final void setFont(String param_font)
setFont in interface CanvasRenderingContext2Dpublic final float getGlobalAlpha()
CanvasRenderingContext2D1.0 (opaque).getGlobalAlpha in interface CanvasRenderingContext2Dpublic final void setGlobalAlpha(float param_globalAlpha)
setGlobalAlpha in interface CanvasRenderingContext2Dpublic final String getGlobalCompositeOperation()
CanvasRenderingContext2DglobalAplpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values: source-atopsource-insource-outsource-over (default)destination-atopdestination-indestination-outdestination-overlighterxorgetGlobalCompositeOperation in interface CanvasRenderingContext2Dpublic final void setGlobalCompositeOperation(String param_globalCompositeOperation)
setGlobalCompositeOperation in interface CanvasRenderingContext2Dpublic final String getLineCap()
CanvasRenderingContext2Dbutt (default), round, squaregetLineCap in interface CanvasRenderingContext2Dpublic final void setLineCap(String param_lineCap)
setLineCap in interface CanvasRenderingContext2Dpublic final String getLineJoin()
CanvasRenderingContext2Dround, bevel, miter (default)getLineJoin in interface CanvasRenderingContext2Dpublic final void setLineJoin(String param_lineJoin)
setLineJoin in interface CanvasRenderingContext2Dpublic final float getLineWidth()
CanvasRenderingContext2D1.0getLineWidth in interface CanvasRenderingContext2Dpublic final void setLineWidth(float param_lineWidth)
setLineWidth in interface CanvasRenderingContext2Dpublic final float getMiterLimit()
CanvasRenderingContext2D10.getMiterLimit in interface CanvasRenderingContext2Dpublic final void setMiterLimit(float param_miterLimit)
setMiterLimit in interface CanvasRenderingContext2Dpublic final float getShadowBlur()
CanvasRenderingContext2D0getShadowBlur in interface CanvasRenderingContext2Dpublic final void setShadowBlur(float param_shadowBlur)
setShadowBlur in interface CanvasRenderingContext2Dpublic final String getShadowColor()
CanvasRenderingContext2DgetShadowColor in interface CanvasRenderingContext2Dpublic final void setShadowColor(String param_shadowColor)
setShadowColor in interface CanvasRenderingContext2Dpublic final float getShadowOffsetX()
CanvasRenderingContext2DgetShadowOffsetX in interface CanvasRenderingContext2Dpublic final void setShadowOffsetX(float param_shadowOffsetX)
setShadowOffsetX in interface CanvasRenderingContext2Dpublic final float getShadowOffsetY()
CanvasRenderingContext2DgetShadowOffsetY in interface CanvasRenderingContext2Dpublic final void setShadowOffsetY(float param_shadowOffsetY)
setShadowOffsetY in interface CanvasRenderingContext2Dpublic final Object getStrokeStyle()
CanvasRenderingContext2D#000 (black).getStrokeStyle in interface CanvasRenderingContext2Dpublic final void setStrokeStyle(Object param_strokeStyle)
setStrokeStyle in interface CanvasRenderingContext2Dpublic final String getTextAlign()
CanvasRenderingContext2Dstart (default), end, left, right or center.getTextAlign in interface CanvasRenderingContext2Dpublic final void setTextAlign(String param_textAlign)
setTextAlign in interface CanvasRenderingContext2Dpublic final String getTextBaseline()
getTextBaseline in interface CanvasRenderingContext2Dpublic final void setTextBaseline(String param_textBaseline)
setTextBaseline in interface CanvasRenderingContext2Dpublic final float getWebkitBackingStorePixelRatio()
getWebkitBackingStorePixelRatio in interface CanvasRenderingContext2Dpublic final boolean isWebkitImageSmoothingEnabled()
CanvasRenderingContext2DisWebkitImageSmoothingEnabled in interface CanvasRenderingContext2Dpublic final void setWebkitImageSmoothingEnabled(boolean param_webkitImageSmoothingEnabled)
setWebkitImageSmoothingEnabled in interface CanvasRenderingContext2Dpublic final JsIndexable getWebkitLineDash()
CanvasRenderingContext2DgetWebkitLineDash in interface CanvasRenderingContext2Dpublic final void setWebkitLineDash(Indexable param_webkitLineDash)
setWebkitLineDash in interface CanvasRenderingContext2Dpublic final float getWebkitLineDashOffset()
CanvasRenderingContext2DgetWebkitLineDashOffset in interface CanvasRenderingContext2Dpublic final void setWebkitLineDashOffset(float param_webkitLineDashOffset)
setWebkitLineDashOffset in interface CanvasRenderingContext2Dpublic final void arc(float x,
float y,
float radius,
float startAngle,
float endAngle,
boolean anticlockwise)
CanvasRenderingContext2DAdds an arc to the path which it center is at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
xyradiusstartAngleendAngleanticlockwise
Optional from Gecko 2.0
true draws the arc anticlockwise, otherwise in a clockwise direction.arc in interface CanvasRenderingContext2Dpublic final void arcTo(float x1,
float y1,
float x2,
float y2,
float radius)
CanvasRenderingContext2DAdds an arc with the given control points and radius, connected to the previous point by a straight line.
x1y1x2y2radiusarcTo in interface CanvasRenderingContext2Dpublic final void beginPath()
beginPath in interface CanvasRenderingContext2Dpublic final void bezierCurveTo(float cp1x,
float cp1y,
float cp2x,
float cp2y,
float x,
float y)
bezierCurveTo in interface CanvasRenderingContext2Dpublic final void clearRect(float x,
float y,
float width,
float height)
CanvasRenderingContext2DClears the rectangle defined by it starting point at (x, y) and has a w width and a h height.
xywidthheightclearRect in interface CanvasRenderingContext2Dpublic final void clearShadow()
clearShadow in interface CanvasRenderingContext2Dpublic final void clip()
clip in interface CanvasRenderingContext2Dpublic final void closePath()
closePath in interface CanvasRenderingContext2Dpublic final JsImageData createImageData(ImageData imagedata)
createImageData in interface CanvasRenderingContext2Dpublic final JsImageData createImageData(float sw, float sh)
createImageData in interface CanvasRenderingContext2Dpublic final JsCanvasGradient createLinearGradient(float x0, float y0, float x1, float y1)
createLinearGradient in interface CanvasRenderingContext2Dpublic final JsCanvasPattern createPattern(CanvasElement canvas, String repetitionType)
CanvasRenderingContext2DA new DOM canvas pattern object for use in pattern-based operations.
NS_ERROR_DOM_INVALID_STATE_ERR
Requires Gecko 10.0
<canvas>
element for the image parameter is zero-sized (that is, one or both of its dimensions are 0 pixels).createPattern in interface CanvasRenderingContext2Dpublic final JsCanvasPattern createPattern(ImageElement image, String repetitionType)
CanvasRenderingContext2DA new DOM canvas pattern object for use in pattern-based operations.
NS_ERROR_DOM_INVALID_STATE_ERR
Requires Gecko 10.0
<canvas>
element for the image parameter is zero-sized (that is, one or both of its dimensions are 0 pixels).createPattern in interface CanvasRenderingContext2Dpublic final JsCanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1)
createRadialGradient in interface CanvasRenderingContext2Dpublic final void drawImage(ImageElement image, float x, float y)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(ImageElement image, float x, float y, float width, float height)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(CanvasElement canvas, float x, float y)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(CanvasElement canvas, float x, float y, float width, float height)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(CanvasElement canvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(VideoElement video, float x, float y)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(VideoElement video, float x, float y, float width, float height)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImage(VideoElement video, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2DDraws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.
image<img>
, <canvas>
, and <video>
). Some browsers, including Firefox, let you use any arbitrary element.dximage.dyimage.dwimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dhimage in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sxsyswsx and sy to the bottom-right corner of the image is used. If you specify a negative value, the image is flipped horizontally when drawn.shThe diagram below illustrates the meanings of the various parameters.

INDEX_SIZE_ERRINVALID_STATE_ERRTYPE_MISMATCH_ERRsw and sh was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, String compositeOperation)
drawImageFromRect in interface CanvasRenderingContext2Dpublic final void fill()
CanvasRenderingContext2Dfill in interface CanvasRenderingContext2Dpublic final void fillRect(float x,
float y,
float width,
float height)
CanvasRenderingContext2DDraws a filled rectangle at (x, y) position whose size is determined by width and height.
xywidthheightfillRect in interface CanvasRenderingContext2Dpublic final void fillText(String text, float x, float y)
fillText in interface CanvasRenderingContext2Dpublic final void fillText(String text, float x, float y, float maxWidth)
fillText in interface CanvasRenderingContext2Dpublic final JsImageData getImageData(float sx, float sy, float sw, float sh)
CanvasRenderingContext2DReturns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has a sw width and sh height.
sxsyswshReturns an ImageData object containing the image data for the given rectangle of the canvas.
getImageData in interface CanvasRenderingContext2Dpublic final boolean isPointInPath(float x,
float y)
CanvasRenderingContext2DReports whether or not the specified point is contained in the current path.
xytrue if the specified point is contained in the current path; otherwise false.
isPointInPath in interface CanvasRenderingContext2Dpublic final void lineTo(float x,
float y)
CanvasRenderingContext2DConnects the last point in the subpath to the x, y coordinates with a straight line.
xylineTo in interface CanvasRenderingContext2Dpublic final JsTextMetrics measureText(String text)
measureText in interface CanvasRenderingContext2Dpublic final void moveTo(float x,
float y)
CanvasRenderingContext2DMoves the starting point of a new subpath to the (x, y) coordinates.
xymoveTo in interface CanvasRenderingContext2Dpublic final void putImageData(ImageData imagedata, float dx, float dy)
CanvasRenderingContext2DputImageData in interface CanvasRenderingContext2Dpublic final void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight)
CanvasRenderingContext2DputImageData in interface CanvasRenderingContext2Dpublic final void quadraticCurveTo(float cpx,
float cpy,
float x,
float y)
quadraticCurveTo in interface CanvasRenderingContext2Dpublic final void rect(float x,
float y,
float width,
float height)
rect in interface CanvasRenderingContext2Dpublic final void restore()
CanvasRenderingContext2Drestore in interface CanvasRenderingContext2Dpublic final void rotate(float angle)
rotate in interface CanvasRenderingContext2Dpublic final void save()
CanvasRenderingContext2Dsave in interface CanvasRenderingContext2Dpublic final void scale(float sx,
float sy)
scale in interface CanvasRenderingContext2Dpublic final void setAlpha(float alpha)
setAlpha in interface CanvasRenderingContext2Dpublic final void setCompositeOperation(String compositeOperation)
setCompositeOperation in interface CanvasRenderingContext2Dpublic final void setFillColor(String color)
setFillColor in interface CanvasRenderingContext2Dpublic final void setFillColor(String color, float alpha)
setFillColor in interface CanvasRenderingContext2Dpublic final void setFillColor(float grayLevel)
setFillColor in interface CanvasRenderingContext2Dpublic final void setFillColor(float grayLevel,
float alpha)
setFillColor in interface CanvasRenderingContext2Dpublic final void setFillColor(float r,
float g,
float b,
float a)
setFillColor in interface CanvasRenderingContext2Dpublic final void setFillColor(float c,
float m,
float y,
float k,
float a)
setFillColor in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
String color)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
String color,
float alpha)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
float grayLevel)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
float grayLevel,
float alpha)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
float r,
float g,
float b,
float a)
setShadow in interface CanvasRenderingContext2Dpublic final void setShadow(float width,
float height,
float blur,
float c,
float m,
float y,
float k,
float a)
setShadow in interface CanvasRenderingContext2Dpublic final void setStrokeColor(String color)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setStrokeColor(String color, float alpha)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setStrokeColor(float grayLevel)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setStrokeColor(float grayLevel,
float alpha)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setStrokeColor(float r,
float g,
float b,
float a)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setStrokeColor(float c,
float m,
float y,
float k,
float a)
setStrokeColor in interface CanvasRenderingContext2Dpublic final void setTransform(float m11,
float m12,
float m21,
float m22,
float dx,
float dy)
setTransform in interface CanvasRenderingContext2Dpublic final void stroke()
CanvasRenderingContext2Dstroke in interface CanvasRenderingContext2Dpublic final void strokeRect(float x,
float y,
float width,
float height)
CanvasRenderingContext2DPaints a rectangle which it starting point is at (x, y) and has a w width and a h height onto the canvas, using the current stroke style.
xywhstrokeRect in interface CanvasRenderingContext2Dpublic final void strokeRect(float x,
float y,
float width,
float height,
float lineWidth)
CanvasRenderingContext2DPaints a rectangle which it starting point is at (x, y) and has a w width and a h height onto the canvas, using the current stroke style.
xywhstrokeRect in interface CanvasRenderingContext2Dpublic final void strokeText(String text, float x, float y)
strokeText in interface CanvasRenderingContext2Dpublic final void strokeText(String text, float x, float y, float maxWidth)
strokeText in interface CanvasRenderingContext2Dpublic final void transform(float m11,
float m12,
float m21,
float m22,
float dx,
float dy)
transform in interface CanvasRenderingContext2Dpublic final void translate(float tx,
float ty)
CanvasRenderingContext2DMoves the origin point of the context to (x, y).
xytranslate in interface CanvasRenderingContext2Dpublic final JsImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh)
webkitGetImageDataHD in interface CanvasRenderingContext2Dpublic final void webkitPutImageDataHD(ImageData imagedata, float dx, float dy)
webkitPutImageDataHD in interface CanvasRenderingContext2Dpublic final void webkitPutImageDataHD(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight)
webkitPutImageDataHD in interface CanvasRenderingContext2DCopyright © 2016. All rights reserved.