@JsType(isNative=true, name="HTMLCanvasElement", namespace="<global>") public final class Canvas extends BaseHtmlElement implements IsCastable
BaseEventTarget.EventListenerCallback
Modifier and Type | Field and Description |
---|---|
static String |
TAG
The tag for this element.
|
Modifier and Type | Method and Description |
---|---|
Context2dItem |
getContext2d()
Returns a drawing 2D context on the canvas.
|
int |
getHeight()
Returns a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels.
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. |
int |
getWidth()
Returns a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels.
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. |
boolean |
isSupported()
Returns
true if canvas is supported by browser, otherwise false . |
void |
setHeight(int height)
Sets a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels.
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. |
void |
setWidth(int width)
Sets a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels.
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. |
String |
toDataURL()
Returns a data-URL containing a representation of the image in the PNG format.
The returned image is in a resolution of 96dpi. |
getAbsoluteLeft, getAbsoluteTop, getInnerText, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getParentHtmlElement, getStyle, getTabIndex, removeFromParent, setInnerText, setTabIndex
getAttributes, getChildElementCount, getClientHeight, getClientLeft, getClientTop, getClientWidth, getElementsByTagName, getFirstElementChild, getId, getInnerHTML, getLastElementChild, getNextElementSibling, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getTagName, hasAttributes, remove, setId, setInnerHTML
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, getTextContent, hasChildNodes, insertBefore, removeAllChildren, removeChild, setNodeValue, setTextContent
addEventListener, removeEventListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
as
@JsOverlay public static final String TAG
@JsProperty public int getHeight()
@JsProperty public void setHeight(int height)
height
- a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels@JsProperty public int getWidth()
@JsProperty public void setWidth(int width)
width
- a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels@JsMethod public String toDataURL()
@JsOverlay public final Context2dItem getContext2d()
@JsOverlay public final boolean isSupported()
true
if canvas is supported by browser, otherwise false
.true
if canvas is supported by browser, otherwise false