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) |
getCanvas
addEventListener, 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, setZoomAndPan
at, at, intAt, intAt, length, numberAt, numberAt, setAt, setAt, setAt, setAt, setAt, setAt
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getCanvas
intAt, length
numberAt
public final Object getFillStyle()
CanvasRenderingContext2D
#000
(black).getFillStyle
in interface CanvasRenderingContext2D
public final void setFillStyle(Object param_fillStyle)
setFillStyle
in interface CanvasRenderingContext2D
public final String getFont()
CanvasRenderingContext2D
10px sans-serif
.getFont
in interface CanvasRenderingContext2D
public final void setFont(String param_font)
setFont
in interface CanvasRenderingContext2D
public final float getGlobalAlpha()
CanvasRenderingContext2D
1.0
(opaque).getGlobalAlpha
in interface CanvasRenderingContext2D
public final void setGlobalAlpha(float param_globalAlpha)
setGlobalAlpha
in interface CanvasRenderingContext2D
public final String getGlobalCompositeOperation()
CanvasRenderingContext2D
globalAplpha
applied this sets how shapes and images are drawn onto the existing bitmap. Possible values: source-atop
source-in
source-out
source-over
(default)destination-atop
destination-in
destination-out
destination-over
lighter
xor
getGlobalCompositeOperation
in interface CanvasRenderingContext2D
public final void setGlobalCompositeOperation(String param_globalCompositeOperation)
setGlobalCompositeOperation
in interface CanvasRenderingContext2D
public final String getLineCap()
CanvasRenderingContext2D
butt
(default), round
, square
getLineCap
in interface CanvasRenderingContext2D
public final void setLineCap(String param_lineCap)
setLineCap
in interface CanvasRenderingContext2D
public final String getLineJoin()
CanvasRenderingContext2D
round
, bevel
, miter
(default)getLineJoin
in interface CanvasRenderingContext2D
public final void setLineJoin(String param_lineJoin)
setLineJoin
in interface CanvasRenderingContext2D
public final float getLineWidth()
CanvasRenderingContext2D
1.0
getLineWidth
in interface CanvasRenderingContext2D
public final void setLineWidth(float param_lineWidth)
setLineWidth
in interface CanvasRenderingContext2D
public final float getMiterLimit()
CanvasRenderingContext2D
10
.getMiterLimit
in interface CanvasRenderingContext2D
public final void setMiterLimit(float param_miterLimit)
setMiterLimit
in interface CanvasRenderingContext2D
public final float getShadowBlur()
CanvasRenderingContext2D
0
getShadowBlur
in interface CanvasRenderingContext2D
public final void setShadowBlur(float param_shadowBlur)
setShadowBlur
in interface CanvasRenderingContext2D
public final String getShadowColor()
CanvasRenderingContext2D
getShadowColor
in interface CanvasRenderingContext2D
public final void setShadowColor(String param_shadowColor)
setShadowColor
in interface CanvasRenderingContext2D
public final float getShadowOffsetX()
CanvasRenderingContext2D
getShadowOffsetX
in interface CanvasRenderingContext2D
public final void setShadowOffsetX(float param_shadowOffsetX)
setShadowOffsetX
in interface CanvasRenderingContext2D
public final float getShadowOffsetY()
CanvasRenderingContext2D
getShadowOffsetY
in interface CanvasRenderingContext2D
public final void setShadowOffsetY(float param_shadowOffsetY)
setShadowOffsetY
in interface CanvasRenderingContext2D
public final Object getStrokeStyle()
CanvasRenderingContext2D
#000
(black).getStrokeStyle
in interface CanvasRenderingContext2D
public final void setStrokeStyle(Object param_strokeStyle)
setStrokeStyle
in interface CanvasRenderingContext2D
public final String getTextAlign()
CanvasRenderingContext2D
start
(default), end
, left
, right
or center
.getTextAlign
in interface CanvasRenderingContext2D
public final void setTextAlign(String param_textAlign)
setTextAlign
in interface CanvasRenderingContext2D
public final String getTextBaseline()
getTextBaseline
in interface CanvasRenderingContext2D
public final void setTextBaseline(String param_textBaseline)
setTextBaseline
in interface CanvasRenderingContext2D
public final float getWebkitBackingStorePixelRatio()
getWebkitBackingStorePixelRatio
in interface CanvasRenderingContext2D
public final boolean isWebkitImageSmoothingEnabled()
CanvasRenderingContext2D
isWebkitImageSmoothingEnabled
in interface CanvasRenderingContext2D
public final void setWebkitImageSmoothingEnabled(boolean param_webkitImageSmoothingEnabled)
setWebkitImageSmoothingEnabled
in interface CanvasRenderingContext2D
public final JsIndexable getWebkitLineDash()
CanvasRenderingContext2D
getWebkitLineDash
in interface CanvasRenderingContext2D
public final void setWebkitLineDash(Indexable param_webkitLineDash)
setWebkitLineDash
in interface CanvasRenderingContext2D
public final float getWebkitLineDashOffset()
CanvasRenderingContext2D
getWebkitLineDashOffset
in interface CanvasRenderingContext2D
public final void setWebkitLineDashOffset(float param_webkitLineDashOffset)
setWebkitLineDashOffset
in interface CanvasRenderingContext2D
public final void arc(float x, float y, float radius, float startAngle, float endAngle, boolean anticlockwise)
CanvasRenderingContext2D
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).
x
y
radius
startAngle
endAngle
anticlockwise
Optional from Gecko 2.0
true
draws the arc anticlockwise, otherwise in a clockwise direction.arc
in interface CanvasRenderingContext2D
public final void arcTo(float x1, float y1, float x2, float y2, float radius)
CanvasRenderingContext2D
Adds an arc with the given control points and radius, connected to the previous point by a straight line.
x1
y1
x2
y2
radius
arcTo
in interface CanvasRenderingContext2D
public final void beginPath()
beginPath
in interface CanvasRenderingContext2D
public final void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)
bezierCurveTo
in interface CanvasRenderingContext2D
public final void clearRect(float x, float y, float width, float height)
CanvasRenderingContext2D
Clears the rectangle defined by it starting point at (x, y) and has a w width and a h height.
x
y
width
height
clearRect
in interface CanvasRenderingContext2D
public final void clearShadow()
clearShadow
in interface CanvasRenderingContext2D
public final void clip()
clip
in interface CanvasRenderingContext2D
public final void closePath()
closePath
in interface CanvasRenderingContext2D
public final JsImageData createImageData(ImageData imagedata)
createImageData
in interface CanvasRenderingContext2D
public final JsImageData createImageData(float sw, float sh)
createImageData
in interface CanvasRenderingContext2D
public final JsCanvasGradient createLinearGradient(float x0, float y0, float x1, float y1)
createLinearGradient
in interface CanvasRenderingContext2D
public final JsCanvasPattern createPattern(CanvasElement canvas, String repetitionType)
CanvasRenderingContext2D
A 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 CanvasRenderingContext2D
public final JsCanvasPattern createPattern(ImageElement image, String repetitionType)
CanvasRenderingContext2D
A 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 CanvasRenderingContext2D
public final JsCanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1)
createRadialGradient
in interface CanvasRenderingContext2D
public final void drawImage(ImageElement image, float x, float y)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(ImageElement image, float x, float y, float width, float height)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(CanvasElement canvas, float x, float y)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(CanvasElement canvas, float x, float y, float width, float height)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(CanvasElement canvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(VideoElement video, float x, float y)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(VideoElement video, float x, float y, float width, float height)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImage(VideoElement video, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
CanvasRenderingContext2D
Draws 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.dx
image
.dy
image
.dw
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.dh
image
in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.sx
sy
sw
sx
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.sh
The diagram below illustrates the meanings of the various parameters.
INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
sw
and sh
was added in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)
.drawImage
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw)
drawImageFromRect
in interface CanvasRenderingContext2D
public final void drawImageFromRect(ImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
drawImageFromRect
in interface CanvasRenderingContext2D
public 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 CanvasRenderingContext2D
public final void fill()
CanvasRenderingContext2D
fill
in interface CanvasRenderingContext2D
public final void fillRect(float x, float y, float width, float height)
CanvasRenderingContext2D
Draws a filled rectangle at (x, y) position whose size is determined by width and height.
x
y
width
height
fillRect
in interface CanvasRenderingContext2D
public final void fillText(String text, float x, float y)
fillText
in interface CanvasRenderingContext2D
public final void fillText(String text, float x, float y, float maxWidth)
fillText
in interface CanvasRenderingContext2D
public final JsImageData getImageData(float sx, float sy, float sw, float sh)
CanvasRenderingContext2D
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.
sx
sy
sw
sh
Returns an ImageData
object containing the image data for the given rectangle of the canvas.
getImageData
in interface CanvasRenderingContext2D
public final boolean isPointInPath(float x, float y)
CanvasRenderingContext2D
Reports whether or not the specified point is contained in the current path.
x
y
true
if the specified point is contained in the current path; otherwise false
.
isPointInPath
in interface CanvasRenderingContext2D
public final void lineTo(float x, float y)
CanvasRenderingContext2D
Connects the last point in the subpath to the x, y
coordinates with a straight line.
x
y
lineTo
in interface CanvasRenderingContext2D
public final JsTextMetrics measureText(String text)
measureText
in interface CanvasRenderingContext2D
public final void moveTo(float x, float y)
CanvasRenderingContext2D
Moves the starting point of a new subpath to the (x, y) coordinates.
x
y
moveTo
in interface CanvasRenderingContext2D
public final void putImageData(ImageData imagedata, float dx, float dy)
CanvasRenderingContext2D
putImageData
in interface CanvasRenderingContext2D
public final void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight)
CanvasRenderingContext2D
putImageData
in interface CanvasRenderingContext2D
public final void quadraticCurveTo(float cpx, float cpy, float x, float y)
quadraticCurveTo
in interface CanvasRenderingContext2D
public final void rect(float x, float y, float width, float height)
rect
in interface CanvasRenderingContext2D
public final void restore()
CanvasRenderingContext2D
restore
in interface CanvasRenderingContext2D
public final void rotate(float angle)
rotate
in interface CanvasRenderingContext2D
public final void save()
CanvasRenderingContext2D
save
in interface CanvasRenderingContext2D
public final void scale(float sx, float sy)
scale
in interface CanvasRenderingContext2D
public final void setAlpha(float alpha)
setAlpha
in interface CanvasRenderingContext2D
public final void setCompositeOperation(String compositeOperation)
setCompositeOperation
in interface CanvasRenderingContext2D
public final void setFillColor(String color)
setFillColor
in interface CanvasRenderingContext2D
public final void setFillColor(String color, float alpha)
setFillColor
in interface CanvasRenderingContext2D
public final void setFillColor(float grayLevel)
setFillColor
in interface CanvasRenderingContext2D
public final void setFillColor(float grayLevel, float alpha)
setFillColor
in interface CanvasRenderingContext2D
public final void setFillColor(float r, float g, float b, float a)
setFillColor
in interface CanvasRenderingContext2D
public final void setFillColor(float c, float m, float y, float k, float a)
setFillColor
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, String color)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, String color, float alpha)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, float grayLevel)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, float grayLevel, float alpha)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, float r, float g, float b, float a)
setShadow
in interface CanvasRenderingContext2D
public final void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a)
setShadow
in interface CanvasRenderingContext2D
public final void setStrokeColor(String color)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setStrokeColor(String color, float alpha)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setStrokeColor(float grayLevel)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setStrokeColor(float grayLevel, float alpha)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setStrokeColor(float r, float g, float b, float a)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setStrokeColor(float c, float m, float y, float k, float a)
setStrokeColor
in interface CanvasRenderingContext2D
public final void setTransform(float m11, float m12, float m21, float m22, float dx, float dy)
setTransform
in interface CanvasRenderingContext2D
public final void stroke()
CanvasRenderingContext2D
stroke
in interface CanvasRenderingContext2D
public final void strokeRect(float x, float y, float width, float height)
CanvasRenderingContext2D
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.
x
y
w
h
strokeRect
in interface CanvasRenderingContext2D
public final void strokeRect(float x, float y, float width, float height, float lineWidth)
CanvasRenderingContext2D
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.
x
y
w
h
strokeRect
in interface CanvasRenderingContext2D
public final void strokeText(String text, float x, float y)
strokeText
in interface CanvasRenderingContext2D
public final void strokeText(String text, float x, float y, float maxWidth)
strokeText
in interface CanvasRenderingContext2D
public final void transform(float m11, float m12, float m21, float m22, float dx, float dy)
transform
in interface CanvasRenderingContext2D
public final void translate(float tx, float ty)
CanvasRenderingContext2D
Moves the origin point of the context to (x, y).
x
y
translate
in interface CanvasRenderingContext2D
public final JsImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh)
webkitGetImageDataHD
in interface CanvasRenderingContext2D
public final void webkitPutImageDataHD(ImageData imagedata, float dx, float dy)
webkitPutImageDataHD
in interface CanvasRenderingContext2D
public final void webkitPutImageDataHD(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight)
webkitPutImageDataHD
in interface CanvasRenderingContext2D
Copyright © 2018. All rights reserved.