Example usage for com.google.gwt.modernizr.client.utils CanvasElement getContext

List of usage examples for com.google.gwt.modernizr.client.utils CanvasElement getContext

Introduction

In this page you can find the example usage for com.google.gwt.modernizr.client.utils CanvasElement getContext.

Prototype

public final native Object getContext(String ctxType) ;

Source Link

Usage

From source file:com.google.gwt.modernizr.client.tests.Canvas.java

License:MIT License

@Override
protected boolean runTest() {
    CanvasElement canvas = CanvasElement.create();
    return canvas.getContext("2d") != null;
}

From source file:com.google.gwt.modernizr.client.tests.Webgl.java

License:MIT License

@Override
protected boolean runTest() {
    CanvasElement canvas = CanvasElement.create();

    try {//from  www.  ja va 2s.c  o  m
        if (canvas.getContext("webgl") != null) {
            return true;
        }
    } catch (Exception e) {
    }

    try {
        if (canvas.getContext("experimental-webgl") != null) {
            return true;
        }
    } catch (Exception e) {
    }

    return false;
}