Java Code Examples for java.awt.image.ImageObserver#imageUpdate()

The following examples show how to use java.awt.image.ImageObserver#imageUpdate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageRepresentation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean prepare(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
    if (!done) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }
    return done;
}
 
Example 2
Source File: ImageRepresentation.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean prepare(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
    if (!done) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }
    return done;
}
 
Example 3
Source File: ImageRepresentation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean prepare(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
    if (!done) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }
    return done;
}
 
Example 4
Source File: ImageRepresentation.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean prepare(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
    if (!done) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }
    return done;
}
 
Example 5
Source File: ImageRepresentation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              Color bg, ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage,
                     dx1, dy1, dx2, dy2,
                     sx1, sy1, sx2, sy2,
                     bg, null);
    }

    return done;
}
 
Example 6
Source File: ImageRepresentation.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              AffineTransform xform,
                              ImageObserver iw)
{
    Graphics2D g2 = (Graphics2D) g;

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g2.drawImage (bimage, xform, null);
    }

    return done;
}
 
Example 7
Source File: ImageRepresentation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int x, int y, Color bg,
                              ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage, x, y, bg, null);
    }

    return done;
}
 
Example 8
Source File: DrawImage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean imageReady(ToolkitImage sunimg,
                                    ImageObserver observer)
{
    if (sunimg.hasError()) {
        if (observer != null) {
            observer.imageUpdate(sunimg,
                                 ImageObserver.ERROR|ImageObserver.ABORT,
                                 -1, -1, -1, -1);
        }
        return false;
    }
    return true;
}
 
Example 9
Source File: DrawImage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean imageReady(ToolkitImage sunimg,
                                    ImageObserver observer)
{
    if (sunimg.hasError()) {
        if (observer != null) {
            observer.imageUpdate(sunimg,
                                 ImageObserver.ERROR|ImageObserver.ABORT,
                                 -1, -1, -1, -1);
        }
        return false;
    }
    return true;
}
 
Example 10
Source File: ToolkitImage.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private synchronized void addWatcher(ImageObserver iw, boolean load) {
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(this, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return;
    }
    ImageRepresentation ir = getImageRep();
    ir.addWatcher(iw);
    if (load) {
        ir.startProduction();
    }
}
 
Example 11
Source File: ImageRepresentation.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int x, int y, Color bg,
                              ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage, x, y, bg, null);
    }

    return done;
}
 
Example 12
Source File: ToolkitImage.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addWatcher(ImageObserver iw, boolean load) {
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(this, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return;
    }
    ImageRepresentation ir = getImageRep();
    ir.addWatcher(iw);
    if (load) {
        ir.startProduction();
    }
}
 
Example 13
Source File: ImageRepresentation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              AffineTransform xform,
                              ImageObserver iw)
{
    Graphics2D g2 = (Graphics2D) g;

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g2.drawImage (bimage, xform, null);
    }

    return done;
}
 
Example 14
Source File: ImageRepresentation.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              Color bg, ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage,
                     dx1, dy1, dx2, dy2,
                     sx1, sy1, sx2, sy2,
                     bg, null);
    }

    return done;
}
 
Example 15
Source File: DrawImage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean imageReady(ToolkitImage sunimg,
                                    ImageObserver observer)
{
    if (sunimg.hasError()) {
        if (observer != null) {
            observer.imageUpdate(sunimg,
                                 ImageObserver.ERROR|ImageObserver.ABORT,
                                 -1, -1, -1, -1);
        }
        return false;
    }
    return true;
}
 
Example 16
Source File: DrawImage.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean imageReady(ToolkitImage sunimg,
                                    ImageObserver observer)
{
    if (sunimg.hasError()) {
        if (observer != null) {
            observer.imageUpdate(sunimg,
                                 ImageObserver.ERROR|ImageObserver.ABORT,
                                 -1, -1, -1, -1);
        }
        return false;
    }
    return true;
}
 
Example 17
Source File: ImageRepresentation.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              Color bg, ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage,
                     dx1, dy1, dx2, dy2,
                     sx1, sy1, sx2, sy2,
                     bg, null);
    }

    return done;
}
 
Example 18
Source File: ImageRepresentation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              AffineTransform xform,
                              ImageObserver iw)
{
    Graphics2D g2 = (Graphics2D) g;

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }
    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g2.drawImage (bimage, xform, null);
    }

    return done;
}
 
Example 19
Source File: ImageRepresentation.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int x, int y, int w, int h,
                              Color bg, ImageObserver iw) {

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) != 0) {
        if (iw != null) {
            iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
                           -1, -1, -1, -1);
        }
        return false;
    }

    boolean done  = ((availinfo & ImageObserver.ALLBITS) != 0);
    boolean abort = ((availinfo & ImageObserver.ABORT) != 0);

    if (!done && !abort) {
        addWatcher(iw);
        startProduction();
        // Some producers deliver image data synchronously
        done = ((availinfo & ImageObserver.ALLBITS) != 0);
    }

    if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
        g.drawImage (bimage, x, y, w, h, bg, null);
    }

    return done;
}
 
Example 20
Source File: MultiResolutionToolkitImage.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static ImageObserver getResolutionVariantObserver(
        final Image image, final ImageObserver observer,
        final int imgWidth, final int imgHeight,
        final int rvWidth, final int rvHeight, boolean concatenateInfo) {

    if (observer == null) {
        return null;
    }

    synchronized (ObserverCache.INSTANCE) {
        ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(observer);

        if (o == null) {

            o = (Image resolutionVariant, int flags,
                    int x, int y, int width, int height) -> {

                        if ((flags & (ImageObserver.WIDTH | BITS_INFO)) != 0) {
                            width = (width + 1) / 2;
                        }

                        if ((flags & (ImageObserver.HEIGHT | BITS_INFO)) != 0) {
                            height = (height + 1) / 2;
                        }

                        if ((flags & BITS_INFO) != 0) {
                            x /= 2;
                            y /= 2;
                        }

                        if(concatenateInfo){
                            flags &= ((ToolkitImage) image).
                                    getImageRep().check(null);
                        }

                        return observer.imageUpdate(
                                image, flags, x, y, width, height);
                    };

            ObserverCache.INSTANCE.put(observer, o);
        }
        return o;
    }
}