@TagName(value="canvas") public class CanvasElement extends Element
Modifier and Type | Field and Description |
---|---|
static String |
TAG
The tag for this element.
|
DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUE
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE
Modifier | Constructor and Description |
---|---|
protected |
CanvasElement() |
Modifier and Type | Method and Description |
---|---|
Context |
getContext(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.
|
String |
toDataUrl()
Returns a data URL for the current content of the canvas element.
|
String |
toDataUrl(String type)
Returns a data URL for the current content of the canvas element, with a specified type.
|
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, 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
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
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
public static final String TAG
public final Context getContext(String contextId)
contextId
- the context id as a Stringpublic final Context2d getContext2d()
getContext(String)
.public final int getHeight()
setHeight(int)
public final int getWidth()
setWidth(int)
public final void setHeight(int height)
height
- the height, in pixelsgetHeight()
public final void setWidth(int width)
width
- the width, in pixelsgetWidth()
public final String toDataUrl()
public final String toDataUrl(String type)
type
- the type of the data url, e.g., image/jpeg or image/png.Copyright © 2018. All rights reserved.