Example usage for java.awt.image MemoryImageSource MemoryImageSource

List of usage examples for java.awt.image MemoryImageSource MemoryImageSource

Introduction

In this page you can find the example usage for java.awt.image MemoryImageSource MemoryImageSource.

Prototype

public MemoryImageSource(int w, int h, int[] pix, int off, int scan) 

Source Link

Document

Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object.

Usage

From source file:de._13ducks.cor.graphics.GraphicsComponent.java

public void setCursor(boolean rcursor) {
    renderCursor = rcursor;//  w w w.j  a  v a2  s.co m
    if (rcursor) {
        int[] pixels = new int[16 * 16];
        Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(16, 16, pixels, 0, 16));
        Cursor transparentCursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0),
                "invisibleCursor");
        this.setCursor(transparentCursor);
    } else {
        this.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:com.jcraft.weirdx.XPixmap.java

void mkMIS() {
    mis = new MemoryImageSource(width, height, idata, 0, width);
    mis.setAnimated(true);
}

From source file:com.jcraft.weirdx.XPixmap.java

public void setSize(int w, int h) {
    if (w <= real_width && h <= real_height) {
        if (2 * w < real_width && 2 * h < real_height) {
            real_width /= 2;/*ww w.  j a v a2 s  . c  om*/
            real_height /= 2;
            data = new byte[real_width * real_height * 2];
            idata = new int[real_width * real_height];
            mis = new MemoryImageSource(real_width, real_height, idata, 0, real_width);
            mis.setAnimated(true);
        }
    } else {
        if (real_width < w)
            real_width = w;
        if (real_height < h)
            real_height = h;
        data = new byte[real_width * real_height * 2];
        idata = new int[real_width * real_height];
        mis = new MemoryImageSource(real_width, real_height, idata, 0, real_width);
        mis.setAnimated(true);
    }
    this.width = w;
    this.height = h;
}