Example usage for com.google.gwt.canvas.dom.client Context2d setGlobalAlpha

List of usage examples for com.google.gwt.canvas.dom.client Context2d setGlobalAlpha

Introduction

In this page you can find the example usage for com.google.gwt.canvas.dom.client Context2d setGlobalAlpha.

Prototype

public final native void setGlobalAlpha(double alpha) ;

Source Link

Document

Sets the global alpha value.

Usage

From source file:playn.html.HtmlImmediateLayerCanvas.java

License:Apache License

@Override
void paint(Context2d ctx, float parentAlpha) {
    if (!visible())
        return;//from w  w w . ja va 2 s  . com

    ctx.save();
    transform(ctx);
    ctx.setGlobalAlpha(parentAlpha * alpha);
    render(ctx);
    ctx.restore();
}

From source file:playn.html.HtmlSurfaceLayerCanvas.java

License:Apache License

@Override
void paint(Context2d ctx, float parentAlpha) {
    if (!visible())
        return;//w  w w  . j  a va 2  s.co m

    ctx.save();
    transform(ctx);

    ctx.setGlobalAlpha(parentAlpha * alpha);
    ctx.drawImage(canvas.canvas(), 0, 0);

    ctx.restore();
}