CanvasElement (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.dom.client
Class CanvasElement

    java.lang.Object
      com.google.gwt.core.client.JavaScriptObject
          com.google.gwt.dom.client.Node
              com.google.gwt.dom.client.Element
                  com.google.gwt.dom.client.CanvasElement

    @TagName(value="canvas")
    public class CanvasElement

extends Element

Canvas element.

See Also:
  W3C HTML 5 Specification

Field Summary
`static java.lang.String` | `TAG` The tag for this element.

Fields inherited from class com.google.gwt.dom.client.Element
`DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUE`

Fields inherited from class com.google.gwt.dom.client.Node
`DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE`

Constructor Summary
`protected` | `CanvasElement()`

Method Summary
`Context` | `getContext(java.lang.String contextId)` Gets the rendering context that may be used to draw on this canvas.
`Context2d` | `getContext2d()` Returns a 2D rendering context.
`int` | `getHeight()` Gets the height of the canvas.
`int` | `getWidth()` Gets the width of the canvas.
`void` | `setHeight(int height)` Sets the height of the canvas.
`void` | `setWidth(int width)` Sets the width of the canvas.
`java.lang.String` | `toDataUrl()` Returns a data URL for the current content of the canvas element.
`java.lang.String` | `toDataUrl(java.lang.String type)` Returns a data URL for the current content of the canvas element, with a specified type.

Methods inherited from class com.google.gwt.dom.client.Element
`addClassName, as, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPreviousSiblingElement, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasClassName, hasTagName, indexOfName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerSafeHtml, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle, toggleClassName`

Methods inherited from class com.google.gwt.dom.client.Node
`appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeAllChildren, removeChild, removeFromParent, replaceChild, setNodeValue`

Methods inherited from class com.google.gwt.core.client.JavaScriptObject
`cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### TAG

    public static final java.lang.String TAG

  The tag for this element.

  See Also:
    Constant Field Values

Constructor Detail

### CanvasElement

    protected CanvasElement()

Method Detail

### getContext

    public final Context getContext(java.lang.String contextId)

  Gets the rendering context that may be used to draw on this canvas.

  Parameters:
    `contextId` - the context id as a String
  Returns:
    the canvas rendering context

### getContext2d

    public final Context2d getContext2d()

  Returns a 2D rendering context. This is a convenience method, see `getContext(String)`.

  Returns:
    a 2D canvas rendering context

### getHeight

    public final int getHeight()

  Gets the height of the canvas.

  Returns:
    the height, in pixels
  See Also:
    `setHeight(int)`

### getWidth

    public final int getWidth()

  Gets the width of the canvas.

  Returns:
    the width, in pixels
  See Also:
    `setWidth(int)`

### setHeight

    public final void setHeight(int height)

  Sets the height of the canvas.

  Parameters:
    `height` - the height, in pixels
  See Also:
    `getHeight()`

### setWidth

    public final void setWidth(int width)

  Sets the width of the canvas.

  Parameters:
    `width` - the width, in pixels
  See Also:
    `getWidth()`

### toDataUrl

    public final java.lang.String toDataUrl()

  Returns a data URL for the current content of the canvas element.

  Returns:
    a data URL for the current content of this element.

### toDataUrl

    public final java.lang.String toDataUrl(java.lang.String type)

  Returns a data URL for the current content of the canvas element, with a specified type.

  Parameters:
    `type` - the type of the data url, e.g., image/jpeg or image/png.
  Returns:
    a data URL for the current content of this element with the specified type.

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD