Class HTMLCanvasElement

All Implemented Interfaces:
Serializable, 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:
  • Field Details

  • Constructor Details

    • HTMLCanvasElement

      public HTMLCanvasElement()
      Creates an instance.
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class HTMLElement
    • getWidth

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

      static Integer getValue(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 Object getContext(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 String toDataURL(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