com.aspose.html.dom.canvas

Interface ICanvasRenderingContext2D

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      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.
    • Method Detail

      • save

        @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().

      • restore

        @DOMNameAttribute(name="restore")
        void restore()

        Restores the drawing style state to the last element on the 'state stack' saved by save().

      • scale

        @DOMNameAttribute(name="scale")
        void scale(double x,
                                                    double y)

        Adds a scaling transformation to the canvas units by x horizontally and by y vertically.

        Parameters:
        x - Scaling factor in the horizontal direction.
        y - Scaling factor in the vertical direction.
      • rotate

        @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.

        Parameters:
        angle - Represents a clockwise rotation angle expressed in radians.
      • translate

        @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.

        Parameters:
        x - Distance to move in the horizontal direction.
        y - Distance to move in the vertical direction.
      • transform

        @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.

        Parameters:
        a - Horizontal scaling.
        b - Horizontal skewing.
        c - Vertical skewing.
        d - Vertical scaling.
        e - Horizontal moving.
        f - Vertical moving.
      • setTransform

        @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.

        Parameters:
        a - Horizontal scaling.
        b - Horizontal skewing.
        c - Vertical skewing.
        d - Vertical scaling.
        e - Horizontal moving.
        f - Vertical moving.
      • resetTransform

        @DOMNameAttribute(name="resetTransform")
        void resetTransform()

        Resets the current transform by the identity matrix.

      • getGlobalAlpha

        @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).

      • setGlobalAlpha

        @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).

      • getGlobalCompositeOperation

        @DOMNameAttribute(name="globalCompositeOperation")
        String getGlobalCompositeOperation()

        With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Default: (source-over)

      • setGlobalCompositeOperation

        @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)

      • getStrokeStyle

        @DOMNameAttribute(name="strokeStyle")
        Object getStrokeStyle()

        Color or style to use for the lines around shapes. Default: (black).

      • setStrokeStyle

        @DOMNameAttribute(name="strokeStyle")
        void setStrokeStyle(Object value)

        Color or style to use for the lines around shapes. Default: (black).

      • setFillStyle

        @DOMNameAttribute(name="fillStyle")
        void setFillStyle(Object value)

        Color or style to use inside shapes. Default: (black).

      • getImageSmoothingEnabled

        @DOMNameAttribute(name="imageSmoothingEnabled")
        boolean getImageSmoothingEnabled()

        Image smoothing mode; if disabled, images will not be smoothed if scaled.

      • setImageSmoothingEnabled

        @DOMNameAttribute(name="imageSmoothingEnabled")
        void setImageSmoothingEnabled(boolean value)

        Image smoothing mode; if disabled, images will not be smoothed if scaled.

      • createLinearGradient

        @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.

        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.
        Returns:
        The linear CanvasGradient.
      • createRadialGradient

        @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.

        Parameters:
        x0 - The x axis of the coordinate of the start circle.
        y0 - The y axis of the coordinate of the start circle
        r0 - 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.
        Returns:
        A radial CanvasGradient initialized with the two specified circles.
      • createPattern

        @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.

        Parameters:
        image - A HTMLImageElement to be used as the image to repeat
        repetition - A string indicating how to repeat the image.
        Returns:
        An opaque object describing a pattern.
      • createPattern

        @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.

        Parameters:
        image - A HTMLCanvasElement to be used as the image to repeat
        repetition - A string indicating how to repeat the image.
        Returns:
        An opaque object describing a pattern.
      • getShadowOffsetX

        @DOMNameAttribute(name="shadowOffsetX")
        double getShadowOffsetX()

        Horizontal distance the shadow will be offset. Default 0.

      • setShadowOffsetX

        @DOMNameAttribute(name="shadowOffsetX")
        void setShadowOffsetX(double value)

        Horizontal distance the shadow will be offset. Default 0.

      • getShadowOffsetY

        @DOMNameAttribute(name="shadowOffsetY")
        double getShadowOffsetY()

        Vertical distance the shadow will be offset. Default 0.

      • setShadowOffsetY

        @DOMNameAttribute(name="shadowOffsetY")
        void setShadowOffsetY(double value)

        Vertical distance the shadow will be offset. Default 0.

      • getShadowBlur

        @DOMNameAttribute(name="shadowBlur")
        double getShadowBlur()

        Specifies the blurring effect. Default 0

      • setShadowBlur

        @DOMNameAttribute(name="shadowBlur")
        void setShadowBlur(double value)

        Specifies the blurring effect. Default 0

      • setShadowColor

        @DOMNameAttribute(name="shadowColor")
        void setShadowColor(String value)

        Color of the shadow. Default fully-transparent black.

      • clearRect

        @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.

        Parameters:
        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.
      • fillRect

        @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.

        Parameters:
        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.
      • strokeRect

        @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.

        Parameters:
        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.
      • beginPath

        @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.

      • fill

        @DOMNameAttribute(name="fill")
        void fill()

        Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.

      • fill

        @DOMNameAttribute(name="fill")
        void fill(int fillRule)

        Fills the subpaths with the current fill style.

        Parameters:
        fillRule - The algorithm by which to determine if a point is inside a path or outside a path.
      • fill

        @DOMNameAttribute(name="fill")
        void fill(Path2D path)

        Fills the subpaths with the current fill style and default algorithm CanvasFillRule.Nonzero.

        Parameters:
        path - A Path2D path to fill.
      • fill

        @DOMNameAttribute(name="fill")
        void fill(Path2D path,
                                                  int fillRule)

        Fills the subpaths with the current fill style.

        Parameters:
        path - A Path2D path to fill.
        fillRule - The algorithm by which to determine if a point is inside a path or outside a path.
      • stroke

        @DOMNameAttribute(name="stroke")
        void stroke()

        Strokes the subpaths with the current stroke style.

      • stroke

        @DOMNameAttribute(name="stroke")
        void stroke(Path2D path)

        Strokes the subpaths with the current stroke style.

        Parameters:
        path - A Path2D path to stroke.
      • drawFocusIfNeeded

        @DOMNameAttribute(name="drawFocusIfNeeded")
        void drawFocusIfNeeded(Element element)

        If a given element is focused, this method draws a focus ring around the current path.

        Parameters:
        element - The element to check whether it is focused or not.
      • clip

        @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.

      • clip

        @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.

        Parameters:
        fillRule - The algorithm by which to determine if a point is inside a path or outside a path
      • clip

        @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.

        Parameters:
        path - A Path2D path to clip.
        fillRule - The algorithm by which to determine if a point is inside a path or outside a path.
      • isPointInPath

        @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.

        Parameters:
        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.
        Returns:
        Returns true if the point is inside the area contained by the filling of a path, otherwise false.
      • isPointInPath

        @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.

        Parameters:
        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.
        Returns:
        Returns true if the point is inside the area contained by the filling of a path, otherwise false.
      • isPointInStroke

        @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.

        Parameters:
        x - The X coordinate of the point to check.
        y - The Y coordinate of the point to check.
        Returns:
        Returns true if the point is inside the area contained by the stroking of a path, otherwise false.
      • isPointInStroke

        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.

        Parameters:
        path - A Path2D path to check.
        x - The X coordinate of the point to check.
        y - The Y coordinate of the point to check.
        Returns:
        Returns true if the point is inside the area contained by the stroking of a path, otherwise false.
      • fillText

        @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.

        Parameters:
        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.
      • strokeText

        @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.

        Parameters:
        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.
      • drawImage

        @DOMNameAttribute(name="drawImage")
        void drawImage(HTMLImageElement image,
                                                            double dx,
                                                            double dy)

        Draws the specified image.

        Parameters:
        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.
      • drawImage

        @DOMNameAttribute(name="drawImage")
        void drawImage(HTMLCanvasElement image,
                                                            double dx,
                                                            double dy)

        Draws the specified image.

        Parameters:
        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.
      • drawImage

        @DOMNameAttribute(name="drawImage")
        void drawImage(HTMLImageElement image,
                                                            double dx,
                                                            double dy,
                                                            double dw,
                                                            double dh)

        Draws the specified image.

        Parameters:
        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.
      • drawImage

        @DOMNameAttribute(name="drawImage")
        void drawImage(HTMLCanvasElement image,
                                                            double dx,
                                                            double dy,
                                                            double dw,
                                                            double dh)

        Draws the specified image.

        Parameters:
        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.
      • drawImage

        @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.

        Parameters:
        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.
      • drawImage

        @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.

        Parameters:
        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.
      • addHitRegion

        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.

        Parameters:
        options - The options argument is optional. When provided, it is an Object which can contain properties.
      • removeHitRegion

        @DOMNameAttribute(name="removeHitRegion")
        void removeHitRegion(String id)

        Removes the hit region with the specified id from the canvas.

        Parameters:
        id - A string representing the id of the region that is to be removed.
      • clearHitRegions

        @DOMNameAttribute(name="clearHitRegions")
        void clearHitRegions()

        Removes all hit regions from the canvas.

      • createImageData

        @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.

        Parameters:
        sw - The width to give the new ImageData object.
        sh - The height to give the new ImageData object.
        Returns:
        A new ImageData object with the specified width and height. The new object is filled with transparent black pixels.
      • createImageData

        @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.

        Parameters:
        imagedata - An existing ImageData object from which to copy the width and height. The image itself is not copied.
        Returns:
        A new ImageData object with the specified width and height. The new object is filled with transparent black pixels.
      • getImageData

        @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.

        Parameters:
        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.
        Returns:
        An ImageData object containing the image data for the given rectangle of the canvas.
      • putImageData

        @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.

        Parameters:
        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.
      • putImageData

        @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.

        Parameters:
        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.