Example usage for com.google.gwt.canvas.dom.client ImageData getHeight

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

Introduction

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

Prototype

public final native int getHeight() ;

Source Link

Document

Returns the height of this image data object.

Usage

From source file:com.google.gwt.sample.userwatcher.client.FileUploaderWidget_v2.java

private void drawThumbToScreen(Image image) {

    int size = 75;

    int width = image.getWidth();
    int height = image.getHeight();

    double scaleToRatio = 0.50D; // TODO oops, getting image loading problem. event loading, fix later...

    ImageData imageDataForThumb = ImageUtils.scaleImage(image, scaleToRatio);

    // for debugging
    Canvas canvasTmp = Canvas.createIfSupported();
    canvasTmp.setCoordinateSpaceHeight((int) imageDataForThumb.getHeight());
    canvasTmp.setCoordinateSpaceWidth((int) imageDataForThumb.getWidth());
    Context2d context = canvasTmp.getContext2d();
    context.putImageData(imageDataForThumb, 0, 0);
    pThumb.add(canvasTmp);/*  w w  w.j  a  va  2 s. c om*/

    canvasTmp.addStyleName("test2");
}

From source file:com.google.gwt.sample.userwatcher.client.ImageUtils.java

/**
 * for debugging//from  w ww . java2 s. c  o m
 * 
 * @param imageData
 */
public static void addImageToScreen(ImageData imageData) {

    Canvas canvasTmp = Canvas.createIfSupported();
    canvasTmp.setCoordinateSpaceHeight((int) imageData.getHeight() + 10);
    canvasTmp.setCoordinateSpaceWidth((int) imageData.getWidth() + 10);
    Context2d context = canvasTmp.getContext2d();

    context.putImageData(imageData, 0, 0);

    //flexTable.setWidget(r, c, canvasTmp);
    RootPanel.get().add(canvasTmp);
}

From source file:com.google.gwt.sample.userwatcher.client.ImageUtils.java

public static ImageData cropImage(ImageData imageData, double sx, double sy, double sw, double sh) {

    Canvas canvasTmp = Canvas.createIfSupported();
    canvasTmp.setStyleName("mainCanvas");
    Context2d context = canvasTmp.getContext2d();

    canvasTmp.setCoordinateSpaceHeight((int) imageData.getHeight() + 10);
    canvasTmp.setCoordinateSpaceWidth((int) imageData.getWidth() + 10);

    // draw image to canvas
    context.putImageData(imageData, 0, 0);

    // get image data
    //imageData = context.getImageData(0, 0, imageData.getWidth(), imageData.getHeight());
    ImageData newImageData = context.getImageData(sx, sy, sw, sh);

    return newImageData;
}

From source file:uk.co.threeonefour.ifictionary.engine.client.graphics.FourWayImageDataQueueFloodFill.java

License:Apache License

public FourWayImageDataQueueFloodFill(ImageData imageData, int x, int y, Colour srcColour, Colour tgtColour) {

    this.imageData = imageData;
    this.width = imageData.getWidth();
    this.height = imageData.getHeight();
    this.mark = new boolean[this.width][this.height];
    this.srcColour = srcColour;
    this.tgtColour = tgtColour;

    this.queue = new LinkedList<Point>();
    queue.add(new Point(x, y));
}