Example usage for java.awt.image ImageObserver PROPERTIES

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

Introduction

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

Prototype

int PROPERTIES

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

Click Source Link

Document

This flag in the infoflags argument to imageUpdate indicates that the properties of the image are now available.

Usage

From source file:Main.java

/**
 * Decodes the bits of a java.awt.image.ImageObserver infoflag into a human
 * readable string./*from w  w  w. j a  va 2 s.  c  o m*/
 * 
 * @param infoflag
 *            the flag to decode
 * @return a string describing the flag
 */
public static String imageObserverInfoflagToString(int infoflag) {
    String out = "";
    if ((infoflag & ImageObserver.ABORT) == ImageObserver.ABORT)
        out += "ABORT ";
    if ((infoflag & ImageObserver.ALLBITS) == ImageObserver.ALLBITS)
        out += "ALLBITS ";
    if ((infoflag & ImageObserver.ERROR) == ImageObserver.ERROR)
        out += "ERROR ";
    if ((infoflag & ImageObserver.FRAMEBITS) == ImageObserver.FRAMEBITS)
        out += "FRAMEBITS ";
    if ((infoflag & ImageObserver.HEIGHT) == ImageObserver.HEIGHT)
        out += "HEIGHT ";
    if ((infoflag & ImageObserver.PROPERTIES) == ImageObserver.PROPERTIES)
        out += "PROPERTIES ";
    if ((infoflag & ImageObserver.SOMEBITS) == ImageObserver.SOMEBITS)
        out += "SOMEBITS ";
    if ((infoflag & ImageObserver.WIDTH) == ImageObserver.WIDTH)
        out += "WIDTH ";
    return out;
}

From source file:ImageLoaderApplet.java

/**
 * Verbose version of ImageConsumer's imageUpdate method
 *//*  ww  w .  j  a v a 2s  .c  o  m*/
public boolean imageUpdate(Image img, int flags, int x, int y, int width, int height) {
    System.out.print("Flag(s): ");
    if ((flags & ImageObserver.WIDTH) != 0) {
        System.out.print("WIDTH:(" + width + ") ");
    }

    if ((flags & ImageObserver.HEIGHT) != 0) {
        System.out.print("HEIGHT:(" + height + ") ");
    }

    if ((flags & ImageObserver.PROPERTIES) != 0) {
        System.out.print("PROPERTIES ");
    }

    if ((flags & ImageObserver.SOMEBITS) != 0) {
        System.out.print("SOMEBITS(" + x + "," + y + ")->(");
        System.out.print(width + "," + height + ") ");
        repaint();
    }

    if ((flags & ImageObserver.FRAMEBITS) != 0) {
        System.out.print("FRAMEBITS(" + x + "," + y + ")->(");
        System.out.print(width + "," + height + ") ");
        repaint();
    }

    if ((flags & ImageObserver.ALLBITS) != 0) {
        System.out.print("ALLBITS(" + x + "," + y + ")->(");
        System.out.println(width + "," + height + ") ");
        repaint();
        return false;
    }

    if ((flags & ImageObserver.ABORT) != 0) {
        System.out.println("ABORT \n");
        return false;
    }

    if ((flags & ImageObserver.ERROR) != 0) {
        System.out.println("ERROR ");
        return false;
    }

    System.out.println();
    return true;
}