Example usage for java.awt.image ImageObserver SOMEBITS

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

Introduction

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

Prototype

int SOMEBITS

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

Click Source Link

Document

This flag in the infoflags argument to imageUpdate indicates that more pixels needed for drawing a scaled variation of the image are 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 av a2s  .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:ImageSize.java

public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
    if ((infoflags & ImageObserver.ERROR) != 0) {
        System.out.println("Error loading image!");
        System.exit(-1);//from  w  w  w .java  2s .  co m
    }
    if ((infoflags & ImageObserver.WIDTH) != 0 && (infoflags & ImageObserver.HEIGHT) != 0)
        rightSize();
    if ((infoflags & ImageObserver.SOMEBITS) != 0)
        repaint();
    if ((infoflags & ImageObserver.ALLBITS) != 0) {
        rightSize();
        repaint();
        return false;
    }
    return true;
}

From source file:ImageLoaderApplet.java

/**
 * Verbose version of ImageConsumer's imageUpdate method
 *//*from   w  w w . ja va  2 s .  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;
}