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

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

Introduction

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

Prototype

public final native CanvasElement getCanvas() ;

Source Link

Document

Gets this context's canvas.

Usage

From source file:anagram.client.Lens.java

License:Apache License

public void draw(Context2d back, Context2d front) {
    front.drawImage(back.getCanvas(), 0, 0);

    if (!GWT.isScript()) {
        // in devmode this effect is slow so we disable it here
    } else {/*from w  ww  . j  a  v a 2 s . c o  m*/
        ImageData frontData = front.getImageData((int) (pos.x - radius), (int) (pos.y - radius), 2 * radius,
                2 * radius);
        CanvasPixelArray frontPixels = frontData.getData();
        ImageData backData = back.getImageData((int) (pos.x - radius), (int) (pos.y - radius), 2 * radius,
                2 * radius);
        CanvasPixelArray backPixels = backData.getData();
        int srcIdx, dstIdx;
        for (int i = lensArray.length - 1; i >= 0; i--) {
            dstIdx = 4 * lensArray[i][0];
            srcIdx = 4 * lensArray[i][1];
            frontPixels.set(dstIdx + 0, backPixels.get(srcIdx + 0));
            frontPixels.set(dstIdx + 1, backPixels.get(srcIdx + 1));
            frontPixels.set(dstIdx + 2, backPixels.get(srcIdx + 2));
        }
        front.putImageData(frontData, (int) (pos.x - radius), (int) (pos.y - radius));
    }

    front.setStrokeStyle(strokeStyle);
    front.beginPath();
    front.arc(pos.x, pos.y, radius, 0, Math.PI * 2, true);
    front.closePath();
    front.stroke();
}

From source file:edu.ycp.cs320.fokemon_webApp.client.LogoGroup.java

License:Open Source License

public void draw(Context2d back, Context2d front) {
    front.drawImage(back.getCanvas(), 0, 0);
}

From source file:uk.co.threeonefour.ifictionary.engine.client.pages.level9game.Level9GameActivity.java

License:Apache License

protected void startGame() {

    Context2d context = view.getCanvas().getContext2d();
    int w = context.getCanvas().getWidth();
    int h = context.getCanvas().getHeight();
    context.setFillStyle("#" + Colour.WHITE.toHexString());
    context.fillRect(0, 0, w, h);/*  w w w.ja v  a 2 s  . c o m*/

    icyVm.startGame();
    processVmOutput();

    view.getTextBox().setFocus(true);
}

From source file:web.diva.client.somclust.view.MaxTreeZoomImage.java

public void buffer(Context2d back, Context2d front) {
    front.beginPath();/*from  w  ww  .  j av a 2s.  com*/
    front.clearRect(0, 0, width, height);
    front.drawImage(back.getCanvas(), 0, 0);
}