Example usage for com.google.gwt.dom.client CanvasElement getHeight

List of usage examples for com.google.gwt.dom.client CanvasElement getHeight

Introduction

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

Prototype

public final native int getHeight() ;

Source Link

Document

Gets the height of the canvas.

Usage

From source file:com.badlogic.gdx.backends.gwt.GwtInput.java

License:Apache License

/** Kindly borrowed from PlayN. **/
protected int getRelativeY(NativeEvent e, CanvasElement target) {
    float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling
    return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop()
            + target.getOwnerDocument().getScrollTop()));
}

From source file:com.badlogic.gdx.backends.gwt.GwtInput.java

License:Apache License

protected int getRelativeY(Touch touch, CanvasElement target) {
    float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling
    return Math.round(yScaleRatio * touch.getRelativeY(target));
}

From source file:com.badlogic.gdx.graphics.Pixmap.java

License:Apache License

/** Draws an area form another Pixmap to this Pixmap.
 * //w w w.  ja  va 2s .  co  m
 * @param pixmap The other Pixmap
 * @param x The target x-coordinate (top left corner)
 * @param y The target y-coordinate (top left corner) */
public void drawPixmap(Pixmap pixmap, int x, int y) {
    CanvasElement image = pixmap.getCanvasElement();
    image(image, 0, 0, image.getWidth(), image.getHeight(), x, y, image.getWidth(), image.getHeight());
}

From source file:playn.html.HtmlGLContext.java

License:Apache License

HtmlGLContext(HtmlPlatform platform, WebGLRenderingContext gl, CanvasElement canvas) {
    super(platform, new HtmlGL20(gl), 1, canvas.getWidth(), canvas.getHeight(),
            HtmlUrlParameters.checkGLErrors);
    this.glc = gl;
    // try basic GL operations to detect failure cases early
    tryBasicGLCalls();//from w  w  w  .j a  v  a  2  s  .  c  o m
    init();
    glc.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, ONE);
}