ICanvasRenderingContext2D Methods |
The ICanvasRenderingContext2D type exposes the following members.
Name | Description | |
---|---|---|
![]() | AddHitRegion |
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.
|
![]() | Arc(Double, Double, Double, Double, Double) |
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
(Inherited from ICanvasPathMethods.) |
![]() | Arc(Double, Double, Double, Double, Double, Boolean) |
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
(Inherited from ICanvasPathMethods.) |
![]() | ArcTo |
Adds an arc to the path with the given control points and radius, connected to the previous point by a straight line.
(Inherited from ICanvasPathMethods.) |
![]() | BeginPath |
Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.
|
![]() | BezierCurveTo |
Adds a cubic Bézier curve to the path. It requires three points.
The first two points are control points and the third one is the end point.
The starting point is the last point in the current path,
which can be changed using moveTo() before creating the Bézier curve.
(Inherited from ICanvasPathMethods.) |
![]() | ClearHitRegions |
Removes all hit regions from the canvas.
|
![]() | ClearRect |
Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.
|
![]() | 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.
|
![]() | Clip(CanvasFillRule) |
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.
|
![]() | Clip(Path2D, CanvasFillRule) |
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.
|
![]() | ClosePath |
Causes the point of the pen to move back to the start of the current sub-path.
It tries to draw a straight line from the current point to the start.
If the shape has already been closed or has only one point, this function does nothing.
(Inherited from ICanvasPathMethods.) |
![]() | CreateImageData(IImageData) |
Creates a new, blank ImageData object with the specified dimensions.
All of the pixels in the new object are transparent black.
|
![]() | CreateImageData(Double, Double) |
Creates a new, blank ImageData object with the specified dimensions.
All of the pixels in the new object are transparent black.
|
![]() | CreateLinearGradient |
Creates a linear gradient along the line given by the coordinates represented by the parameters.
|
![]() | CreatePattern(HTMLCanvasElement, String) |
Creates a pattern using the specified image (a CanvasImageSource).
It repeats the source in the directions specified by the repetition argument.
|
![]() | CreatePattern(HTMLImageElement, String) |
Creates a pattern using the specified image (a CanvasImageSource).
It repeats the source in the directions specified by the repetition argument.
|
![]() | CreateRadialGradient |
Creates a radial gradient given by the coordinates of the two circles represented by the parameters.
|
![]() | DrawFocusIfNeeded |
If a given element is focused, this method draws a focus ring around the current path.
|
![]() | DrawImage(HTMLCanvasElement, Double, Double) |
Draws the specified image.
|
![]() | DrawImage(HTMLImageElement, Double, Double) |
Draws the specified image.
|
![]() | DrawImage(HTMLCanvasElement, Double, Double, Double, Double) |
Draws the specified image.
|
![]() | DrawImage(HTMLImageElement, Double, Double, Double, Double) |
Draws the specified image.
|
![]() | DrawImage(HTMLCanvasElement, Double, Double, Double, Double, Double, Double, Double, Double) |
Draws the specified image.
|
![]() | DrawImage(HTMLImageElement, Double, Double, Double, Double, Double, Double, Double, Double) |
Draws the specified image.
|
![]() | Ellipse(Double, Double, Double, Double, Double, Double, Double) |
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle
and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
(Inherited from ICanvasPathMethods.) |
![]() | Ellipse(Double, Double, Double, Double, Double, Double, Double, Boolean) |
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle
and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
(Inherited from ICanvasPathMethods.) |
![]() | Fill |
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
|
![]() | Fill(CanvasFillRule) |
Fills the subpaths with the current fill style.
|
![]() | Fill(Path2D) |
Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.
|
![]() | Fill(Path2D, CanvasFillRule) |
Fills the subpaths with the current fill style.
|
![]() | FillRect |
Draws a filled rectangle at (x, y) position whose size is determined by width and height.
|
![]() | FillText(String, Double, Double) |
Draws (fills) a given text at the given (x,y) position.
|
![]() | FillText(String, Double, Double, Double) |
Draws (fills) a given text at the given (x,y) position.
|
![]() | GetImageData |
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.
|
![]() | GetLineDash |
Returns the current line dash pattern array containing an even number of non-negative numbers.
(Inherited from ICanvasDrawingStyles.) |
![]() | IsPointInPath(Double, Double) |
Reports whether or not the specified point is contained in the current path.
|
![]() | IsPointInPath(Double, Double, CanvasFillRule) |
Reports whether or not the specified point is contained in the current path.
|
![]() | IsPointInPath(Path2D, Double, Double) |
Reports whether or not the specified point is contained in the current path.
|
![]() | IsPointInPath(Path2D, Double, Double, CanvasFillRule) |
Reports whether or not the specified point is contained in the current path.
|
![]() | IsPointInStroke(Double, Double) |
Reports whether or not the specified point is inside the area contained by the stroking of a path.
|
![]() | IsPointInStroke(Path2D, Double, Double) |
Reports whether or not the specified point is inside the area contained by the stroking of a path.
|
![]() | LineTo |
Connects the last point in the subpath to the x, y coordinates with a straight line.
(Inherited from ICanvasPathMethods.) |
![]() | MeasureText |
Returns a TextMetrics object.
|
![]() | MoveTo |
Moves the starting point of a new sub-path to the (x, y) coordinates.
(Inherited from ICanvasPathMethods.) |
![]() | PutImageData(IImageData, Double, Double) |
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.
|
![]() | PutImageData(IImageData, Double, Double, Double, Double, Double, Double) |
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.
|
![]() | QuadraticCurveTo |
Adds a quadratic Bézier curve to the current path.
(Inherited from ICanvasPathMethods.) |
![]() | Rect |
Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
(Inherited from ICanvasPathMethods.) |
![]() | RemoveHitRegion |
Removes the hit region with the specified id from the canvas.
|
![]() | ResetTransform |
Resets the current transform by the identity matrix.
|
![]() | Restore |
Restores the drawing style state to the last element on the 'state stack' saved by save().
|
![]() | Rotate |
Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.
|
![]() | Save |
Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
|
![]() | Scale |
Adds a scaling transformation to the canvas units by x horizontally and by y vertically.
|
![]() | SetLineDash |
Sets the current line dash pattern.
(Inherited from ICanvasDrawingStyles.) |
![]() | SetTransform |
Resets the current transform to the identity matrix, and then invokes the transform() method with the same arguments.
|
![]() | Stroke |
Strokes the subpaths with the current stroke style.
|
![]() | Stroke(Path2D) |
Strokes the subpaths with the current stroke style.
|
![]() | StrokeRect |
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.
|
![]() | StrokeText(String, Double, Double) |
Draws (strokes) a given text at the given (x, y) position.
|
![]() | StrokeText(String, Double, Double, NullableDouble) |
Draws (strokes) a given text at the given (x, y) position.
|
![]() | Transform |
Multiplies the current transformation matrix with the matrix described by its arguments.
|
![]() | Translate |
Adds a translation transformation by moving the canvas and its origin x horzontally and y vertically on the grid.
|