public class Canvas extends FocusWidget
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledDEBUG_ID_PREFIX| Modifier and Type | Method and Description |
|---|---|
static Canvas |
createIfSupported()
Return a new
Canvas if supported, and null otherwise. |
CanvasElement |
getCanvasElement()
Returns the attached Canvas Element.
|
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 |
getCoordinateSpaceHeight()
Gets the height of the internal canvas coordinate space.
|
int |
getCoordinateSpaceWidth()
Gets the width of the internal canvas coordinate space.
|
static boolean |
isSupported()
Runtime check for whether the canvas element is supported in this browser.
|
void |
setCoordinateSpaceHeight(int height)
Sets the height of the internal canvas coordinate space.
|
void |
setCoordinateSpaceWidth(int width)
Sets the width of the internal canvas coordinate space.
|
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.
|
static Canvas |
wrap(CanvasElement element)
Wrap an existing canvas element.
|
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, getTabIndex, isEnabled, onAttach, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setEnabled, setFocus, setTabIndexaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfireEventpublic static Canvas createIfSupported()
Canvas if supported, and null otherwise.Canvas if supported, and null otherwisepublic static Canvas wrap(CanvasElement element)
RootPanel.detachNow(Widget).
Note: This method can return null if there is no support for canvas by the
current browser.element - the element to wrapCanvas widget or null if canvas is not supported by the current browser.public static boolean isSupported()
public CanvasElement getCanvasElement()
public Context getContext(java.lang.String contextId)
contextId - the context id as a Stringpublic Context2d getContext2d()
getContext(String).public int getCoordinateSpaceHeight()
setCoordinateSpaceHeight(int)public int getCoordinateSpaceWidth()
setCoordinateSpaceWidth(int)public void setCoordinateSpaceHeight(int height)
height - the height, in pixelsgetCoordinateSpaceHeight()public void setCoordinateSpaceWidth(int width)
width - the width, in pixelsgetCoordinateSpaceWidth()public java.lang.String toDataUrl()
public java.lang.String toDataUrl(java.lang.String type)
type - the type of the data url, e.g., image/jpeg or image/png.