Class HTMLCanvasElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class HTMLCanvasElement
    extends HTMLElement
    The JavaScript object HTMLCanvasElement.
    See Also:
    Serialized Form
    • Constructor Detail

      • HTMLCanvasElement

        public HTMLCanvasElement()
        Creates an instance.
    • Method Detail

      • getWidth

        public int getWidth()
        Returns the width property.
        Returns:
        the width property
      • getValue

        static java.lang.Integer getValue​(java.lang.String value)
      • setWidth

        public void setWidth​(int width)
        Sets the width property.
        Parameters:
        width - the width property
      • getHeight

        public int getHeight()
        Returns the height property.
        Returns:
        the height property
      • setHeight

        public void setHeight​(int height)
        Sets the height property.
        Parameters:
        height - the height property
      • getContext

        public java.lang.Object getContext​(java.lang.String contextId)
        Gets the context.
        Parameters:
        contextId - the context id
        Returns:
        Returns an object that exposes an API for drawing on the canvas, or null if the given context ID is not supported
      • toDataURL

        public java.lang.String toDataURL​(java.lang.Object type)
        Get the data: URL representation of the Canvas element. Here we return an empty image.
        Parameters:
        type - the type (optional)
        Returns:
        the data URL