Example usage for com.google.gwt.html5.client CanvasElement getWidth

List of usage examples for com.google.gwt.html5.client CanvasElement getWidth

Introduction

In this page you can find the example usage for com.google.gwt.html5.client CanvasElement getWidth.

Prototype

public final native int getWidth() ;

Source Link

Usage

From source file:com.googlecode.gwtquake.client.GwtWebGLRenderer.java

License:Open Source License

public GwtWebGLRenderer(CanvasElement canvas, Element video) {
    super(canvas.getWidth(), canvas.getHeight());
    GlState.gl = this.webGL = new WebGLGl1Contect(canvas);
    this.canvas = canvas;
    this.video = (VideoElement) video;

    for (int y = 0; y < HOLODECK_TEXTURE_SIZE; y++) {
        for (int x = 0; x < HOLODECK_TEXTURE_SIZE; x++) {
            holoDeckTexture.put((byte) 0);
            holoDeckTexture.put((byte) (((x & MASK) == HIT) || ((y & MASK) == HIT) ? 255 : 0));
            holoDeckTexture.put((byte) 0);
            holoDeckTexture.put((byte) 0xff);
        }//from   w  w w . ja va 2 s .c o  m
    }
    holoDeckTexture.rewind();

    canvas1 = (CanvasElement) Document.get().createElement("canvas");
    canvas1.getStyle().setDisplay(Display.NONE);
    canvas1.setWidth(128);
    canvas1.setHeight(128);
    Document.get().getBody().appendChild(canvas1);

    canvas2 = (CanvasElement) Document.get().createElement("canvas");
    canvas2.setWidth(128);
    canvas2.setHeight(128);
    canvas2.getStyle().setDisplay(Display.NONE);
    Document.get().getBody().appendChild(canvas2);

    init();
}

From source file:com.googlecode.gwtquake.client.GwtWireframeGLRenderer.java

License:Open Source License

public GwtWireframeGLRenderer(final CanvasElement canvas) {
    super(canvas.getWidth(), canvas.getHeight());
    GlState.gl = new WireframeGl1Context(canvas);
    init();//w  w w .  ja v a2  s. c  o  m
}