@DOMObjectAttribute @DOMNoInterfaceObjectAttribute public interface ICanvasRenderingContext2D extends ICanvasDrawingStyles, ICanvasPathMethods
The ICanvasRenderingContext2D interface is used for drawing rectangles, text, images and other objects onto the canvas element. It provides the 2D rendering context for the drawing surface of a canvas element.
Modifier and Type | Method and Description |
---|---|
void |
addHitRegion(com.aspose.html.internal.ms.System.Collections.Generic.Dictionary<String,String> options)
Adds a hit region to the canvas.
|
void |
beginPath()
Starts a new path by emptying the list of sub-paths.
|
void |
clearHitRegions()
Removes all hit regions from the canvas.
|
void |
clearRect(double x,
double y,
double w,
double h)
Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.
|
void |
clip()
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule.
|
void |
clip(int fillRule)
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule.
|
void |
clip(Path2D path,
int fillRule)
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule.
|
IImageData |
createImageData(double sw,
double sh)
Creates a new, blank ImageData object with the specified dimensions.
|
IImageData |
createImageData(IImageData imagedata)
Creates a new, blank ImageData object with the specified dimensions.
|
ICanvasGradient |
createLinearGradient(double x0,
double y0,
double x1,
double y1)
Creates a linear gradient along the line given by the coordinates represented by the parameters.
|
ICanvasPattern |
createPattern(HTMLCanvasElement image,
String repetition)
Creates a pattern using the specified image (a CanvasImageSource).
|
ICanvasPattern |
createPattern(HTMLImageElement image,
String repetition)
Creates a pattern using the specified image (a CanvasImageSource).
|
ICanvasGradient |
createRadialGradient(double x0,
double y0,
double r0,
double x1,
double y1,
double r1)
Creates a radial gradient given by the coordinates of the two circles represented by the parameters.
|
void |
drawFocusIfNeeded(Element element)
If a given element is focused, this method draws a focus ring around the current path.
|
void |
drawImage(HTMLCanvasElement image,
double dx,
double dy)
Draws the specified image.
|
void |
drawImage(HTMLCanvasElement image,
double dx,
double dy,
double dw,
double dh)
Draws the specified image.
|
void |
drawImage(HTMLCanvasElement image,
double sx,
double sy,
double sw,
double sh,
double dx,
double dy,
double dw,
double dh)
Draws the specified image.
|
void |
drawImage(HTMLImageElement image,
double dx,
double dy)
Draws the specified image.
|
void |
drawImage(HTMLImageElement image,
double dx,
double dy,
double dw,
double dh)
Draws the specified image.
|
void |
drawImage(HTMLImageElement image,
double sx,
double sy,
double sw,
double sh,
double dx,
double dy,
double dw,
double dh)
Draws the specified image.
|
void |
fill()
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
|
void |
fill(int fillRule)
Fills the subpaths with the current fill style.
|
void |
fill(Path2D path)
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
|
void |
fill(Path2D path,
int fillRule)
Fills the subpaths with the current fill style.
|
void |
fillRect(double x,
double y,
double w,
double h)
Draws a filled rectangle at (x, y) position whose size is determined by width and height.
|
void |
fillText(String text,
double x,
double y,
Double maxWidth)
Draws (fills) a given text at the given (x,y) position.
|
HTMLCanvasElement |
getCanvas()
A read-only back-reference to the HTMLCanvasElement.
|
Object |
getFillStyle()
Color or style to use inside shapes.
|
double |
getGlobalAlpha()
Alpha value that is applied to shapes and images before they are composited onto the canvas.
|
String |
getGlobalCompositeOperation()
With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap.
|
IImageData |
getImageData(double sx,
double sy,
double sw,
double 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 an sw width and sh height.
|
boolean |
getImageSmoothingEnabled()
Image smoothing mode; if disabled, images will not be smoothed if scaled.
|
double |
getShadowBlur()
Specifies the blurring effect.
|
String |
getShadowColor()
Color of the shadow.
|
double |
getShadowOffsetX()
Horizontal distance the shadow will be offset.
|
double |
getShadowOffsetY()
Vertical distance the shadow will be offset.
|
Object |
getStrokeStyle()
Color or style to use for the lines around shapes.
|
boolean |
isPointInPath(double x,
double y,
int fillRule)
Reports whether or not the specified point is contained in the current path.
|
boolean |
isPointInPath(Path2D path,
double x,
double y,
int fillRule)
Reports whether or not the specified point is contained in the current path.
|
boolean |
isPointInStroke(double x,
double y)
Reports whether or not the specified point is inside the area contained by the stroking of a path.
|
boolean |
isPointInStroke(Path2D path,
double x,
double y)
Reports whether or not the specified point is inside the area contained by the stroking of a path.
|
ITextMetrics |
measureText(String text)
Returns a TextMetrics object.
|
void |
putImageData(IImageData imagedata,
double dx,
double dy)
Paints data from the given ImageData object onto the bitmap.
|
void |
putImageData(IImageData imagedata,
double dx,
double dy,
double dirtyX,
double dirtyY,
double dirtyWidth,
double dirtyHeight)
Paints data from the given ImageData object onto the bitmap.
|
void |
removeHitRegion(String id)
Removes the hit region with the specified id from the canvas.
|
void |
resetTransform()
Resets the current transform by the identity matrix.
|
void |
restore()
Restores the drawing style state to the last element on the 'state stack' saved by save().
|
void |
rotate(double angle)
Adds a rotation to the transformation matrix.
|
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(double x,
double y)
Adds a scaling transformation to the canvas units by x horizontally and by y vertically.
|
void |
setFillStyle(Object value)
Color or style to use inside shapes.
|
void |
setGlobalAlpha(double value)
Alpha value that is applied to shapes and images before they are composited onto the canvas.
|
void |
setGlobalCompositeOperation(String value)
With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap.
|
void |
setImageSmoothingEnabled(boolean value)
Image smoothing mode; if disabled, images will not be smoothed if scaled.
|
void |
setShadowBlur(double value)
Specifies the blurring effect.
|
void |
setShadowColor(String value)
Color of the shadow.
|
void |
setShadowOffsetX(double value)
Horizontal distance the shadow will be offset.
|
void |
setShadowOffsetY(double value)
Vertical distance the shadow will be offset.
|
void |
setStrokeStyle(Object value)
Color or style to use for the lines around shapes.
|
void |
setTransform(double a,
double b,
double c,
double d,
double e,
double f)
Resets the current transform to the identity matrix, and then invokes the transform() method with the same arguments.
|
void |
stroke()
Strokes the subpaths with the current stroke style.
|
void |
stroke(Path2D path)
Strokes the subpaths with the current stroke style.
|
void |
strokeRect(double x,
double y,
double w,
double h)
Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.
|
void |
strokeText(String text,
double x,
double y,
Double maxWidth)
Draws (strokes) a given text at the given (x, y) position.
|
void |
transform(double a,
double b,
double c,
double d,
double e,
double f)
Multiplies the current transformation matrix with the matrix described by its arguments.
|
void |
translate(double x,
double y)
Adds a translation transformation by moving the canvas and its origin x horzontally and y vertically on the grid.
|
getFont, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineWidth, getMiterLimit, getTextAlign, getTextBaseline, setFont, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineWidth, setMiterLimit, setTextAlign, setTextBaseline
arc, arc, arcTo, bezierCurveTo, closePath, ellipse, ellipse, lineTo, moveTo, quadraticCurveTo, rect
@DOMNameAttribute(name="canvas") HTMLCanvasElement getCanvas()
A read-only back-reference to the HTMLCanvasElement. Might be null if it is not associated with a canvas element.
@DOMNameAttribute(name="save") void save()
Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
@DOMNameAttribute(name="restore") void restore()
Restores the drawing style state to the last element on the 'state stack' saved by save().
@DOMNameAttribute(name="scale") void scale(double x, double y)
Adds a scaling transformation to the canvas units by x horizontally and by y vertically.
x
- Scaling factor in the horizontal direction.y
- Scaling factor in the vertical direction.@DOMNameAttribute(name="rotate") void rotate(double angle)
Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.
angle
- Represents a clockwise rotation angle expressed in radians.@DOMNameAttribute(name="translate") void translate(double x, double y)
Adds a translation transformation by moving the canvas and its origin x horzontally and y vertically on the grid.
x
- Distance to move in the horizontal direction.y
- Distance to move in the vertical direction.@DOMNameAttribute(name="transform") void transform(double a, double b, double c, double d, double e, double f)
Multiplies the current transformation matrix with the matrix described by its arguments.
a
- Horizontal scaling.b
- Horizontal skewing.c
- Vertical skewing.d
- Vertical scaling.e
- Horizontal moving.f
- Vertical moving.@DOMNameAttribute(name="setTransform") void setTransform(double a, double b, double c, double d, double e, double f)
Resets the current transform to the identity matrix, and then invokes the transform() method with the same arguments.
a
- Horizontal scaling.b
- Horizontal skewing.c
- Vertical skewing.d
- Vertical scaling.e
- Horizontal moving.f
- Vertical moving.@DOMNameAttribute(name="resetTransform") void resetTransform()
Resets the current transform by the identity matrix.
@DOMNameAttribute(name="globalAlpha") double getGlobalAlpha()
Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).
@DOMNameAttribute(name="globalAlpha") void setGlobalAlpha(double value)
Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).
@DOMNameAttribute(name="globalCompositeOperation") String getGlobalCompositeOperation()
With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Default: (source-over)
@DOMNameAttribute(name="globalCompositeOperation") void setGlobalCompositeOperation(String value)
With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Default: (source-over)
@DOMNameAttribute(name="strokeStyle") Object getStrokeStyle()
Color or style to use for the lines around shapes. Default: (black).
@DOMNameAttribute(name="strokeStyle") void setStrokeStyle(Object value)
Color or style to use for the lines around shapes. Default: (black).
@DOMNameAttribute(name="fillStyle") Object getFillStyle()
Color or style to use inside shapes. Default: (black).
@DOMNameAttribute(name="fillStyle") void setFillStyle(Object value)
Color or style to use inside shapes. Default: (black).
@DOMNameAttribute(name="imageSmoothingEnabled") boolean getImageSmoothingEnabled()
Image smoothing mode; if disabled, images will not be smoothed if scaled.
@DOMNameAttribute(name="imageSmoothingEnabled") void setImageSmoothingEnabled(boolean value)
Image smoothing mode; if disabled, images will not be smoothed if scaled.
@DOMNameAttribute(name="createLinearGradient") ICanvasGradient createLinearGradient(double x0, double y0, double x1, double y1)
Creates a linear gradient along the line given by the coordinates represented by the parameters.
x0
- The x axis of the coordinate of the start point.y0
- The y axis of the coordinate of the start point.x1
- The x axis of the coordinate of the end point.y1
- The y axis of the coordinate of the end point.@DOMNameAttribute(name="createRadialGradient") ICanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1)
Creates a radial gradient given by the coordinates of the two circles represented by the parameters.
x0
- The x axis of the coordinate of the start circle.y0
- The y axis of the coordinate of the start circler0
- The radius of the start circle.x1
- The x axis of the coordinate of the end circle.y1
- The y axis of the coordinate of the end circle.r1
- The radius of the end circle.@DOMNameAttribute(name="createPattern") ICanvasPattern createPattern(HTMLImageElement image, String repetition)
Creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the directions specified by the repetition argument.
image
- A HTMLImageElement to be used as the image to repeatrepetition
- A string indicating how to repeat the image.@DOMNameAttribute(name="createPattern") ICanvasPattern createPattern(HTMLCanvasElement image, String repetition)
Creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the directions specified by the repetition argument.
image
- A HTMLCanvasElement to be used as the image to repeatrepetition
- A string indicating how to repeat the image.@DOMNameAttribute(name="shadowOffsetX") double getShadowOffsetX()
Horizontal distance the shadow will be offset. Default 0.
@DOMNameAttribute(name="shadowOffsetX") void setShadowOffsetX(double value)
Horizontal distance the shadow will be offset. Default 0.
@DOMNameAttribute(name="shadowOffsetY") double getShadowOffsetY()
Vertical distance the shadow will be offset. Default 0.
@DOMNameAttribute(name="shadowOffsetY") void setShadowOffsetY(double value)
Vertical distance the shadow will be offset. Default 0.
@DOMNameAttribute(name="shadowBlur") double getShadowBlur()
Specifies the blurring effect. Default 0
@DOMNameAttribute(name="shadowBlur") void setShadowBlur(double value)
Specifies the blurring effect. Default 0
@DOMNameAttribute(name="shadowColor") String getShadowColor()
Color of the shadow. Default fully-transparent black.
@DOMNameAttribute(name="shadowColor") void setShadowColor(String value)
Color of the shadow. Default fully-transparent black.
@DOMNameAttribute(name="clearRect") void clearRect(double x, double y, double w, double h)
Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.
x
- The x axis of the coordinate for the rectangle starting point.y
- The y axis of the coordinate for the rectangle starting point.w
- The rectangle's width.h
- The rectangle's height.@DOMNameAttribute(name="fillRect") void fillRect(double x, double y, double w, double h)
Draws a filled rectangle at (x, y) position whose size is determined by width and height.
x
- The x axis of the coordinate for the rectangle starting point.y
- The y axis of the coordinate for the rectangle starting point.w
- The rectangle's width.h
- The rectangle's height.@DOMNameAttribute(name="strokeRect") void strokeRect(double x, double y, double w, double h)
Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.
x
- The x axis of the coordinate for the rectangle starting point.y
- The y axis of the coordinate for the rectangle starting point.w
- The rectangle's width.h
- The rectangle's height.@DOMNameAttribute(name="beginPath") void beginPath()
Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.
@DOMNameAttribute(name="fill") void fill()
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
@DOMNameAttribute(name="fill") void fill(int fillRule)
Fills the subpaths with the current fill style.
fillRule
- The algorithm by which to determine if a point is inside a path or outside a path.@DOMNameAttribute(name="fill") void fill(Path2D path)
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
path
- A Path2D path to fill.@DOMNameAttribute(name="fill") void fill(Path2D path, int fillRule)
Fills the subpaths with the current fill style.
path
- A Path2D path to fill.fillRule
- The algorithm by which to determine if a point is inside a path or outside a path.@DOMNameAttribute(name="stroke") void stroke()
Strokes the subpaths with the current stroke style.
@DOMNameAttribute(name="stroke") void stroke(Path2D path)
Strokes the subpaths with the current stroke style.
path
- A Path2D path to stroke.@DOMNameAttribute(name="drawFocusIfNeeded") void drawFocusIfNeeded(Element element)
If a given element is focused, this method draws a focus ring around the current path.
element
- The element to check whether it is focused or not.@DOMNameAttribute(name="clip") void clip()
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule. Open subpaths must be implicitly closed when computing the clipping region, without affecting the actual subpaths. The new clipping region replaces the current clipping region.
@DOMNameAttribute(name="clip") void clip(int fillRule)
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule. Open subpaths must be implicitly closed when computing the clipping region, without affecting the actual subpaths. The new clipping region replaces the current clipping region.
fillRule
- The algorithm by which to determine if a point is inside a path or outside a path@DOMNameAttribute(name="clip") void clip(Path2D path, int fillRule)
Creates a new clipping region by calculating the intersection of the current clipping region and the area described by the path, using the non-zero winding number rule. Open subpaths must be implicitly closed when computing the clipping region, without affecting the actual subpaths. The new clipping region replaces the current clipping region.
path
- A Path2D path to clip.fillRule
- The algorithm by which to determine if a point is inside a path or outside a path.@DOMNameAttribute(name="isPointInPath") boolean isPointInPath(double x, double y, @DOMParameterAttribute(name="fillRule",optional=true,defaultValue=0L) int fillRule)
Reports whether or not the specified point is contained in the current path.
x
- The X coordinate of the point to check.y
- The Y coordinate of the point to check.fillRule
- The algorithm by which to determine if a point is inside a path or outside a path.@DOMNameAttribute(name="isPointInPath") boolean isPointInPath(Path2D path, double x, double y, @DOMParameterAttribute(name="fillRule",optional=true,defaultValue=0L) int fillRule)
Reports whether or not the specified point is contained in the current path.
path
- A Path2D path to check.x
- The X coordinate of the point to check.y
- The Y coordinate of the point to check.fillRule
- The algorithm by which to determine if a point is inside a path or outside a path.@DOMNameAttribute(name="isPointInStroke") boolean isPointInStroke(double x, double y)
Reports whether or not the specified point is inside the area contained by the stroking of a path.
x
- The X coordinate of the point to check.y
- The Y coordinate of the point to check.boolean isPointInStroke(Path2D path, double x, double y)
Reports whether or not the specified point is inside the area contained by the stroking of a path.
path
- A Path2D path to check.x
- The X coordinate of the point to check.y
- The Y coordinate of the point to check.@DOMNameAttribute(name="fillText") void fillText(String text, double x, double y, @DOMParameterAttribute(name="maxWidth",optional=true) Double maxWidth)
Draws (fills) a given text at the given (x,y) position.
text
- The text to draw using the current font, textAlign, textBaseline, and direction values.x
- The x axis of the coordinate for the text starting point.y
- The y axis of the coordinate for the text starting point.maxWidth
- The maximum width to draw. If specified, and the string is computed to be wider than this width, the font is adjusted to use a more horizontally condensed font (if one is available or if a reasonably readable one can be synthesized by scaling the current font horizontally) or a smaller font.@DOMNameAttribute(name="strokeText") void strokeText(String text, double x, double y, @DOMParameterAttribute(name="maxWidth",optional=true) Double maxWidth)
Draws (strokes) a given text at the given (x, y) position.
text
- The text to draw using the current font, textAlign, textBaseline, and direction values.x
- The x axis of the coordinate for the text starting point.y
- The y axis of the coordinate for the text starting point.maxWidth
- The maximum width to draw. If specified, and the string is computed to be wider than this width, the font is adjusted to use a more horizontally condensed font (if one is available or if a reasonably readable one can be synthesized by scaling the current font horizontally) or a smaller font.@DOMNameAttribute(name="measureText") ITextMetrics measureText(String text)
Returns a TextMetrics object.
text
- The text to measure.@DOMNameAttribute(name="drawImage") void drawImage(HTMLImageElement image, double dx, double dy)
Draws the specified image.
image
- The HTMLImageElement to draw into the context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.@DOMNameAttribute(name="drawImage") void drawImage(HTMLCanvasElement image, double dx, double dy)
Draws the specified image.
image
- The HTMLCanvasElement to draw into the context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.@DOMNameAttribute(name="drawImage") void drawImage(HTMLImageElement image, double dx, double dy, double dw, double dh)
Draws the specified image.
image
- The HTMLImageElement to draw into the context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.dw
- The width to draw the 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
- The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.@DOMNameAttribute(name="drawImage") void drawImage(HTMLCanvasElement image, double dx, double dy, double dw, double dh)
Draws the specified image.
image
- The HTMLCanvasElement to draw into the context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.dw
- The width to draw the 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
- The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.@DOMNameAttribute(name="drawImage") void drawImage(HTMLImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
Draws the specified image.
image
- The HTMLImageElement to draw into the context.sx
- The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.sy
- The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.sw
- The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.sh
- The height of the sub-rectangle of the source image to draw into the destination context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.dw
- The width to draw the 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
- The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.@DOMNameAttribute(name="drawImage") void drawImage(HTMLCanvasElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
Draws the specified image.
image
- The HTMLCanvasElement to draw into the context.sx
- The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.sy
- The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.sw
- The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.sh
- The height of the sub-rectangle of the source image to draw into the destination context.dx
- The X coordinate in the destination canvas at which to place the top-left corner of the source image.dy
- The Y coordinate in the destination canvas at which to place the top-left corner of the source image.dw
- The width to draw the 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
- The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.void addHitRegion(com.aspose.html.internal.ms.System.Collections.Generic.Dictionary<String,String> options)
Adds a hit region to the canvas. This allows you to make hit detection easier, lets you route events to DOM elements, and makes it possible for users to explore the canvas without seeing it.
options
- The options argument is optional. When provided, it is an Object which can contain properties.@DOMNameAttribute(name="removeHitRegion") void removeHitRegion(String id)
Removes the hit region with the specified id from the canvas.
id
- A string representing the id of the region that is to be removed.@DOMNameAttribute(name="clearHitRegions") void clearHitRegions()
Removes all hit regions from the canvas.
@DOMNameAttribute(name="createImageData") IImageData createImageData(double sw, double sh)
Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.
sw
- The width to give the new ImageData object.sh
- The height to give the new ImageData object.@DOMNameAttribute(name="createImageData") IImageData createImageData(IImageData imagedata)
Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.
imagedata
- An existing ImageData object from which to copy the width and height. The image itself is not copied.@DOMNameAttribute(name="getImageData") IImageData getImageData(double sx, double sy, double sw, double 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 an sw width and sh height. This method is not affected by the canvas transformation matrix.
sx
- The x coordinate of the upper left corner of the rectangle from which the ImageData will be extracted.sy
- The y coordinate of the upper left corner of the rectangle from which the ImageData will be extracted.sw
- The width of the rectangle from which the ImageData will be extracted.sh
- The height of the rectangle from which the ImageData will be extracted.@DOMNameAttribute(name="putImageData") void putImageData(IImageData imagedata, double dx, double dy)
Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted. This method is not affected by the canvas transformation matrix.
imagedata
- An ImageData object containing the array of pixel values.dx
- Horizontal position (x-coordinate) at which to place the image data in the destination canvas.dy
- Vertical position (y-coordinate) at which to place the image data in the destination canvas.@DOMNameAttribute(name="putImageData") void putImageData(IImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight)
Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted. This method is not affected by the canvas transformation matrix.
imagedata
- An ImageData object containing the array of pixel values.dx
- Horizontal position (x-coordinate) at which to place the image data in the destination canvas.dy
- Vertical position (y-coordinate) at which to place the image data in the destination canvas.dirtyX
- Horizontal position (x-coordinate). The x coordinate of the top left hand corner of your Image data. Defaults to 0.dirtyY
- Vertical position (y-coordinate). The y coordinate of the top left hand corner of your Image data. Defaults to 0.dirtyWidth
- Width of the rectangle to be painted. Defaults to the width of the image data.dirtyHeight
- Height of the rectangle to be painted. Defaults to the height of the image data.