List of usage examples for com.google.gwt.dom.client Document createCanvasElement
public CanvasElement createCanvasElement()
From source file:forplay.html.HtmlGraphics.java
License:Apache License
protected HtmlGraphics() { Document doc = Document.get(); dummyCanvas = doc.createCanvasElement(); dummyCtx = dummyCanvas.getContext2d(); rootElement = doc.getElementById("forplay-root"); if (rootElement == null) { rootElement = doc.getBody();//from www . j av a 2s. co m } else { // clear the contents of the "forplay-root" element, if present rootElement.setInnerHTML(""); } }
From source file:playn.html.HtmlGraphics.java
License:Apache License
protected HtmlGraphics() { Document doc = Document.get(); dummyCanvas = doc.createCanvasElement(); dummyCtx = dummyCanvas.getContext2d(); rootElement = doc.getElementById("playn-root"); if (rootElement == null) { rootElement = doc.getBody();/*w w w .j a va2 s.c o m*/ } else { // clear the contents of the "playn-root" element, if present rootElement.setInnerHTML(""); } // create a hidden element used to measure font heights measureElement = doc.createDivElement(); measureElement.getStyle().setVisibility(Style.Visibility.HIDDEN); measureElement.getStyle().setPosition(Style.Position.ABSOLUTE); measureElement.getStyle().setTop(-500, Unit.PX); measureElement.getStyle().setOverflow(Style.Overflow.VISIBLE); rootElement.appendChild(measureElement); }