Example usage for java.awt.image ImageObserver ALLBITS

List of usage examples for java.awt.image ImageObserver ALLBITS

Introduction

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

Prototype

int ALLBITS

To view the source code for java.awt.image ImageObserver ALLBITS.

Click Source Link

Document

This flag in the infoflags argument to imageUpdate indicates that a static image which was previously drawn is now complete and can be drawn again in its final form.

Usage

From source file:org.pentaho.reporting.libraries.base.util.WaitingImageObserver.java

/**
 * Callback function used by AWT to inform that more data is available. The observer waits until either all data is
 * loaded or AWT signals that the image cannot be loaded.
 *
 * @param img       the image being observed.
 * @param infoflags the bitwise inclusive OR of the following flags:  <code>WIDTH</code>, <code>HEIGHT</code>,
 *                  <code>PROPERTIES</code>, <code>SOMEBITS</code>, <code>FRAMEBITS</code>, <code>ALLBITS</code>,
 *                  <code>ERROR</code>, <code>ABORT</code>.
 * @param x         the <i>x</i> coordinate.
 * @param y         the <i>y</i> coordinate.
 * @param width     the width./*  www . j  ava 2 s  .c  om*/
 * @param height    the height.
 * @return <code>false</code> if the infoflags indicate that the image is completely loaded; <code>true</code>
 * otherwise.
 */
public synchronized boolean imageUpdate(final Image img, final int infoflags, final int x, final int y,
        final int width, final int height) {
    if (img == null) {
        throw new NullPointerException();
    }

    lastUpdate = System.currentTimeMillis();
    if ((infoflags & ImageObserver.ALLBITS) == ImageObserver.ALLBITS) {
        this.lock = false;
        this.error = false;
        notifyAll();
        return false;
    } else if ((infoflags & ImageObserver.FRAMEBITS) == ImageObserver.FRAMEBITS) {
        this.lock = false;
        this.error = false;
        notifyAll();
        return false;
    } else if ((infoflags & ImageObserver.ABORT) == ImageObserver.ABORT
            || (infoflags & ImageObserver.ERROR) == ImageObserver.ERROR) {
        this.lock = false;
        this.error = true;
        notifyAll();
        return false;
    }

    // maybe it is enough already to draw the image ..
    notifyAll();
    return true;
}