Package 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
Canvas element.
- See Also:
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionfinal Context
getContext
(String contextId) Gets the rendering context that may be used to draw on this canvas.final Context2d
Returns a 2D rendering context.final int
Gets the height of the canvas.final int
getWidth()
Gets the width of the canvas.final void
setHeight
(int height) Sets the height of the canvas.final void
setWidth
(int width) Sets the width of the canvas.final String
Returns a data URL for the current content of the canvas element.final String
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
-
Field Details
-
TAG
The tag for this element.- See Also:
-
-
Constructor Details
-
CanvasElement
protected CanvasElement()
-
-
Method Details
-
getContext
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
Returns a 2D rendering context. This is a convenience method, seegetContext(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:
-
getWidth
public final int getWidth()Gets the width of the canvas.- Returns:
- the width, in pixels
- See Also:
-
setHeight
public final void setHeight(int height) Sets the height of the canvas.- Parameters:
height
- the height, in pixels- See Also:
-
setWidth
public final void setWidth(int width) Sets the width of the canvas.- Parameters:
width
- the width, in pixels- See Also:
-
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
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.
-