Java Code Examples for java.awt.image.ImageObserver

The following are top voted examples for showing how to use java.awt.image.ImageObserver. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: PathGraphics.java   Source Code and License 6 votes vote down vote up
public boolean drawImage(Image img, int x, int y,
                         Color bgcolor,
                         ImageObserver observer) {

    if (img == null) {
        return true;
    }

    boolean result;
    int srcWidth = img.getWidth(null);
    int srcHeight = img.getHeight(null);

    if (srcWidth < 0 || srcHeight < 0) {
        result = false;
    } else {
        result = drawImage(img, x, y, srcWidth, srcHeight, bgcolor, observer);
    }

    return result;
}
 
Example 2
Project: jdk8u-jdk   File: ImageRepresentation.java   Source Code and License 6 votes vote down vote up
synchronized void abort() {
    image.getSource().removeConsumer(this);
    consuming = false;
    newbits = null;
    bimage = null;
    biRaster = null;
    cmodel = null;
    srcLUT = null;
    isDefaultBI = false;
    isSameCM = false;

    newInfo(image, ImageObserver.ABORT, -1, -1, -1, -1);
    availinfo &= ~(ImageObserver.SOMEBITS
                   | ImageObserver.FRAMEBITS
                   | ImageObserver.ALLBITS
                   | ImageObserver.ERROR);
}
 
Example 3
Project: openjdk-jdk10   File: DrawImage.java   Source Code and License 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example 4
Project: OpenJSharp   File: ImageRepresentation.java   Source Code and License 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
Project: OpenJSharp   File: DrawImage.java   Source Code and License 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example 6
Project: OpenJSharp   File: ToolkitImage.java   Source Code and License 6 votes vote down vote up
private synchronized void reconstruct(int flags) {
    if ((flags & ~availinfo) != 0) {
        if ((availinfo & ImageObserver.ERROR) != 0) {
            return;
        }
        ImageRepresentation ir = getImageRep();
        ir.startProduction();
        while ((flags & ~availinfo) != 0) {
            try {
                wait();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                return;
            }
            if ((availinfo & ImageObserver.ERROR) != 0) {
                return;
            }
        }
    }
}
 
Example 7
Project: incubator-netbeans   File: ImageUtilities.java   Source Code and License 5 votes vote down vote up
private static void ensureLoaded(Image image) {
    if (
        (Toolkit.getDefaultToolkit().checkImage(image, -1, -1, null) &
            (ImageObserver.ALLBITS | ImageObserver.FRAMEBITS)) != 0
    ) {
        return;
    }

    synchronized (tracker) {
        int id = ++mediaTrackerID;
        tracker.addImage(image, id);

        try {
            tracker.waitForID(id, 0);
        } catch (InterruptedException e) {
            System.out.println("INTERRUPTED while loading Image");
        }

        // #262804 assertation disabled because of error, when using ImageFilter
        // assert (tracker.statusID(id, false) == MediaTracker.COMPLETE) : "Image loaded";
        tracker.removeImage(image, id);
    }
}
 
Example 8
Project: openjdk-jdk10   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
public synchronized void reconstruct(int flags) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    int missinginfo = flags & ~availinfo;
    if ((availinfo & ImageObserver.ERROR) == 0 && missinginfo != 0) {
        numWaiters++;
        try {
            startProduction();
            missinginfo = flags & ~availinfo;
            while ((availinfo & ImageObserver.ERROR) == 0 &&
                   missinginfo != 0)
            {
                try {
                    wait();
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    return;
                }
                missinginfo = flags & ~availinfo;
            }
        } finally {
            decrementWaiters();
        }
    }
}
 
Example 9
Project: openjdk-jdk10   File: ComponentOperator.java   Source Code and License 5 votes vote down vote up
/**
 * Maps {@code Component.prepareImage(Image, int, int, ImageObserver)}
 * through queue
 */
public boolean prepareImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) {
    return (runMapping(new MapBooleanAction("prepareImage") {
        @Override
        public boolean map() {
            return getSource().prepareImage(image, i, i1, imageObserver);
        }
    }));
}
 
Example 10
Project: openjdk-jdk10   File: ImageRepresentation.java   Source Code and License 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 11
Project: openjdk-jdk10   File: ToolkitImage.java   Source Code and License 5 votes vote down vote up
public void preload(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ALLBITS) == 0) {
        addWatcher(iw, true);
    }
}
 
Example 12
Project: OpenJSharp   File: SunGraphics2D.java   Source Code and License 5 votes vote down vote up
/**
 * Draws an image at x,y in nonblocking mode with a solid background
 * color and a callback object.
 */
public boolean drawImage(Image img, int x, int y, Color bg,
                         ImageObserver observer) {

    if (img == null) {
        return true;
    }

    if (isHiDPIImage(img)) {
        final int imgW = img.getWidth(null);
        final int imgH = img.getHeight(null);
        return drawHiDPIImage(img, x, y, x + imgW, y + imgH, 0, 0, imgW,
                              imgH, bg, observer);
    }

    try {
        return imagepipe.copyImage(this, img, x, y, bg, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.copyImage(this, img, x, y, bg, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
 
Example 13
Project: openjdk-jdk10   File: NullPipe.java   Source Code and License 5 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    return false;
}
 
Example 14
Project: openjdk-jdk10   File: ToolkitImage.java   Source Code and License 5 votes vote down vote up
synchronized void infoDone(int status) {
    if (status == ImageConsumer.IMAGEERROR ||
        ((~availinfo) & (ImageObserver.WIDTH |
                         ImageObserver.HEIGHT)) != 0) {
        addInfo(ImageObserver.ERROR);
    } else if ((availinfo & ImageObserver.PROPERTIES) == 0) {
        setProperties(null);
    }
}
 
Example 15
Project: VASSAL-src   File: ScaledImagePainter.java   Source Code and License 5 votes vote down vote up
public void draw(Graphics g, int x, int y, double scale, ImageObserver obs) {
  if (srcOp == null || scale <= 0) return;

  final BufferedImage img;
  if (scale == 1.0) {
    img = srcOp.getImage();
  }
  else {
    if (scaleOp == null || scaleOp.getScale() != scale) {
      scaleOp = Op.scale(srcOp, scale);
    }
    img = scaleOp.getImage();
  }

  if (img == null) return;

  g.drawImage(img, x, y, obs);
}
 
Example 16
Project: qupath-tracking-extension   File: HeatmapOverlay.java   Source Code and License 5 votes vote down vote up
@Override
public void paintOverlay(Graphics2D g2d, ImageRegion imageRegion, double downsampleFactor, ImageObserver observer, boolean paintCompletely) {
    if (trackerFeatures != null) {
        if (doPaintBoundsHeatmap.get()) {
            paintBoundsHeatmap(g2d);
        }
        if (doPaintCursorHeatmap.get()) {
            paintCursorHeatmap(g2d);
        }
        if (doPaintEyeHeatmap.get()) {
            paintEyeHeatmap(g2d);
        }
    }
}
 
Example 17
Project: openjdk-jdk10   File: DrawImage.java   Source Code and License 5 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example 18
Project: jdk8u-jdk   File: SunGraphics2D.java   Source Code and License 5 votes vote down vote up
/**
 * Draws an image at x,y in nonblocking mode with a solid background
 * color and a callback object.
 */
public boolean drawImage(Image img, int x, int y, Color bg,
                         ImageObserver observer) {

    if (img == null) {
        return true;
    }

    if (isHiDPIImage(img)) {
        final int imgW = img.getWidth(null);
        final int imgH = img.getHeight(null);
        return drawHiDPIImage(img, x, y, x + imgW, y + imgH, 0, 0, imgW,
                              imgH, bg, observer);
    }

    try {
        return imagepipe.copyImage(this, img, x, y, bg, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.copyImage(this, img, x, y, bg, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
 
Example 19
Project: openjdk-jdk10   File: LUTCompareTest.java   Source Code and License 5 votes vote down vote up
public boolean imageUpdate(Image image, int info,
                           int x, int y, int w, int h) {
    if (image == this.image) {
        System.out.println("Image status: " + dump(info));
        synchronized(this) {
            isReady = (info & ImageObserver.ALLBITS) != 0;
                if (isReady) {
                    synchronized(lock) {
                        lock.notifyAll();
                    }
                }
        }
        return !isReady;
    } else {
        return true;
    }
}
 
Example 20
Project: openjdk-jdk10   File: SunGraphics2D.java   Source Code and License 5 votes vote down vote up
/**
 * Draws a subrectangle of an image scaled to a destination rectangle
 * in nonblocking mode with a callback object.
 */
public boolean drawImage(Image img,
                         int dx1, int dy1, int dx2, int dy2,
                         int sx1, int sy1, int sx2, int sy2,
                         ImageObserver observer) {
    return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null,
                     observer);
}
 
Example 21
Project: OpenJSharp   File: ToolkitImage.java   Source Code and License 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 22
Project: OpenJSharp   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
synchronized void dispose() {
    image.getSource().removeConsumer(this);
    consuming = false;
    newbits = null;
    availinfo &= ~(ImageObserver.SOMEBITS
                   | ImageObserver.FRAMEBITS
                   | ImageObserver.ALLBITS);
}
 
Example 23
Project: OpenJSharp   File: ImageWatched.java   Source Code and License 5 votes vote down vote up
public void removeWatcher(ImageObserver iw) {
    synchronized (this) {
        watcherList = watcherList.removeWatcher(iw);
    }
    if (watcherList == endlink) {
        notifyWatcherListEmpty();
    }
}
 
Example 24
Project: jdk8u-jdk   File: ImageRepresentation.java   Source Code and License 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 25
Project: OpenJSharp   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
private synchronized void checkConsumption() {
    if (isWatcherListEmpty() && numWaiters == 0 &&
        ((availinfo & ImageObserver.ALLBITS) == 0))
    {
        dispose();
    }
}
 
Example 26
Project: myster   File: TabUtilities.java   Source Code and License 5 votes vote down vote up
public static int[] getPixels(Image img, int x, int y, int w, int h) {
    int[] pixels = new int[w * h]; // PixelGrabber does the work of getting
                                   // actual RGB pixel values for // us from
                                   // the image.
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    try {
        pg.grabPixels();
    } catch (InterruptedException e) {
        System.err.println("interrupted waiting for pixels!");
    }

    if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
        System.err.println("image fetch aborted or errored");
    }
    return pixels;
}
 
Example 27
Project: BaseClient   File: TextureAnimations.java   Source Code and License 5 votes vote down vote up
public static BufferedImage scaleBufferedImage(BufferedImage p_scaleBufferedImage_0_, int p_scaleBufferedImage_1_, int p_scaleBufferedImage_2_)
{
    BufferedImage bufferedimage = new BufferedImage(p_scaleBufferedImage_1_, p_scaleBufferedImage_2_, 2);
    Graphics2D graphics2d = bufferedimage.createGraphics();
    graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2d.drawImage(p_scaleBufferedImage_0_, 0, 0, p_scaleBufferedImage_1_, p_scaleBufferedImage_2_, (ImageObserver)null);
    return bufferedimage;
}
 
Example 28
Project: OpenJSharp   File: ToolkitImage.java   Source Code and License 5 votes vote down vote up
/**
 * Return the width of the original image source.
 * If the width isn't known, then the ImageObserver object will be
 * notified when the data is available.
 */
public synchronized int getWidth(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.WIDTH) == 0) {
        addWatcher(iw, true);
        if ((availinfo & ImageObserver.WIDTH) == 0) {
            return -1;
        }
    }
    return width;
}
 
Example 29
Project: BaseClient   File: TextureUtils.java   Source Code and License 5 votes vote down vote up
public static BufferedImage scaleToPowerOfTwo(BufferedImage p_scaleToPowerOfTwo_0_, int p_scaleToPowerOfTwo_1_)
{
    if (p_scaleToPowerOfTwo_0_ == null)
    {
        return p_scaleToPowerOfTwo_0_;
    }
    else
    {
        int i = p_scaleToPowerOfTwo_0_.getWidth();
        int j = p_scaleToPowerOfTwo_0_.getHeight();
        int k = Math.max(i, p_scaleToPowerOfTwo_1_);
        k = MathHelper.roundUpToPowerOfTwo(k);

        if (k == i)
        {
            return p_scaleToPowerOfTwo_0_;
        }
        else
        {
            int l = j * k / i;
            BufferedImage bufferedimage = new BufferedImage(k, l, 2);
            Graphics2D graphics2d = bufferedimage.createGraphics();
            Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;

            if (k % i != 0)
            {
                object = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
            }

            graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object);
            graphics2d.drawImage(p_scaleToPowerOfTwo_0_, 0, 0, k, l, (ImageObserver)null);
            return bufferedimage;
        }
    }
}
 
Example 30
Project: openjdk-jdk10   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
public int check(ImageObserver iw) {

        if (src != null) {
            src.checkSecurity(null, false);
        }
        if ((availinfo & (ImageObserver.ERROR | ImageObserver.ALLBITS)) == 0) {
            addWatcher(iw);
        }

        return availinfo;
    }
 
Example 31
Project: openjdk-jdk10   File: DrawImage.java   Source Code and License 5 votes vote down vote up
public boolean transformImage(SunGraphics2D sg, Image img,
                              AffineTransform atfm,
                              ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        transformImage(sg, img, 0, 0, atfm, sg.interpolationType);
        return true;
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, atfm, observer);
    }
}
 
Example 32
Project: jdk8u-jdk   File: ValidatePipe.java   Source Code and License 5 votes vote down vote up
public boolean transformImage(SunGraphics2D sg, Image img,
                              AffineTransform atfm,
                              ImageObserver observer) {
    if (validate(sg)) {
        return sg.imagepipe.transformImage(sg, img, atfm, observer);
    } else {
        return false;
    }
}
 
Example 33
Project: openjdk-jdk10   File: MultiResolutionImageTest.java   Source Code and License 5 votes vote down vote up
static void testToolkitImageObserver(final Image image) {

        ImageObserver observer = new ImageObserver() {

            @Override
            public boolean imageUpdate(Image img, int infoflags, int x, int y,
                int width, int height) {

                if (img != image) {
                    throw new RuntimeException("Wrong image in observer");
                }

                if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT))
                    != 0) {
                    throw new RuntimeException("Error during image loading");
                }

                return (infoflags & ImageObserver.ALLBITS) == 0;

            }
        };

        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
            2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
        setImageScalingHint(g2x, true);

        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0,
            IMAGE_WIDTH, IMAGE_HEIGHT, observer);

    }
 
Example 34
Project: OpenJSharp   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
synchronized void abort() {
    image.getSource().removeConsumer(this);
    consuming = false;
    bimage = null;
    bitmap = null;

    newInfo(image, ImageObserver.ABORT, -1, -1, -1, -1);
    availinfo &= ~(ImageObserver.SOMEBITS
                   | ImageObserver.FRAMEBITS
                   | ImageObserver.ALLBITS
                   | ImageObserver.ERROR);
}
 
Example 35
Project: openjdk-jdk10   File: ToolkitImage.java   Source Code and License 5 votes vote down vote up
/**
 * Return the height of the original image source.
 * If the height isn't known, then the image is reconstructed.
 */
public int getHeight() {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.HEIGHT) == 0) {
        reconstruct(ImageObserver.HEIGHT);
    }
    return height;
}
 
Example 36
Project: openjdk-jdk10   File: ValidatePipe.java   Source Code and License 5 votes vote down vote up
public boolean transformImage(SunGraphics2D sg, Image img,
                              AffineTransform atfm,
                              ImageObserver observer) {
    if (validate(sg)) {
        return sg.imagepipe.transformImage(sg, img, atfm, observer);
    } else {
        return false;
    }
}
 
Example 37
Project: OpenJSharp   File: ValidatePipe.java   Source Code and License 5 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (validate(sg)) {
        return sg.imagepipe.scaleImage(sg, img, dx1, dy1, dx2, dy2,
                                       sx1, sy1, sx2, sy2, bgColor,
                                       observer);
    } else {
        return false;
    }
}
 
Example 38
Project: openjdk-jdk10   File: ImageRepresentation.java   Source Code and License 5 votes vote down vote up
public void setProperties(Hashtable<?,?> props) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    image.setProperties(props);
    newInfo(image, ImageObserver.PROPERTIES, 0, 0, 0, 0);
}
 
Example 39
Project: OpenJSharp   File: DrawImage.java   Source Code and License 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 40
Project: openjdk-jdk10   File: ValidatePipe.java   Source Code and License 5 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img, int x, int y,
                          int w, int h,
                          Color bgColor,
                          ImageObserver observer) {
    if (validate(sg)) {
        return sg.imagepipe.scaleImage(sg, img, x, y, w, h, bgColor,
                                       observer);
    } else {
        return false;
    }
}