Package java.awt.image

Examples of java.awt.image.ImageConsumer


    public synchronized void setAnimated(boolean animated) {
        this.animating = animated;
        if (!animating) {
            Enumeration enum_ = theConsumers.elements();
            while (enum_.hasMoreElements()) {
                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
                ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
                if (isConsumer(ic)) {
                    ic.imageComplete(ImageConsumer.IMAGEERROR);
                }
            }
            theConsumers.removeAllElements();
        }
    }
View Full Code Here


        }
        this.fullbuffers = fullbuffers;
        if (animating) {
            Enumeration enum_ = theConsumers.elements();
            while (enum_.hasMoreElements()) {
                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
                ic.setHints(fullbuffers
                            ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                               ImageConsumer.COMPLETESCANLINES)
                            : ImageConsumer.RANDOMPIXELORDER);
            }
        }
View Full Code Here

            if ((w <= 0 || h <= 0) && !framenotify) {
                return;
            }
            Enumeration enum_ = theConsumers.elements();
            while (enum_.hasMoreElements()) {
                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
                if (w > 0 && h > 0) {
                    sendPixels(ic, x, y, w, h);
                }
                if (framenotify && isConsumer(ic)) {
                    ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
                }
            }
        }
    }
View Full Code Here

        int minY = raster.getMinY();
        int width = raster.getWidth();
        int height = raster.getHeight();

        Enumeration icList;
        ImageConsumer ic;
        // Set up the ImageConsumers
        icList = ics.elements();
        while (icList.hasMoreElements()) {
            ic = (ImageConsumer)icList.nextElement();
            ic.setDimensions(width,height);
            ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                        ImageConsumer.COMPLETESCANLINES |
                        ImageConsumer.SINGLEPASS |
                        ImageConsumer.SINGLEFRAME);
        }

        // Get RGB pixels from the raster scanline by scanline and
        // send to consumers.
        int pix[] = new int[width];
        int i,j;
        int numBands = sampleModel.getNumBands();
        int tmpPixel[] = new int[numBands];
        for (j = 0; j < height; j++) {
            for(i = 0; i < width; i++) {
                sampleModel.getPixel(i, j, tmpPixel, dataBuffer);
                pix[i] = colorModel.getDataElement(tmpPixel, 0);
            }
            // Now send the scanline to the Consumers
            icList = ics.elements();
            while (icList.hasMoreElements()) {
                ic = (ImageConsumer)icList.nextElement();
                ic.setPixels(0, j, width, 1, colorModel, pix, 0, width);
            }
        }

        // Now tell the consumers we're done.
        icList = ics.elements();
        while (icList.hasMoreElements()) {
            ic = (ImageConsumer)icList.nextElement();
            ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
        }
    }
View Full Code Here

        int[] pixels = new int[scansize];

        Rectangle rect = new Rectangle(minX, minY, width, 1);

        for (int i = 0; i < numConsumers; i++) {
            ImageConsumer ic = (ImageConsumer)consumers.elementAt(i);
            ic.setHints(ImageConsumer.COMPLETESCANLINES |
                        ImageConsumer.TOPDOWNLEFTRIGHT |
                        ImageConsumer.SINGLEFRAME);
        }

        for (int y = minY; y < minY + height; y++) {
            rect.y = y;
            Raster row = im.getData(rect);
            row.getPixels(minX, y, width, 1, pixels);

            for (int i = 0; i < numConsumers; i++) {
                ImageConsumer ic = (ImageConsumer)consumers.elementAt(i);
                ic.setPixels(0, y - minY, width, 1, colorModel,
                             pixels, 0, scansize);
            }
        }

        for (int i = 0; i < numConsumers; i++) {
            ImageConsumer ic = (ImageConsumer)consumers.elementAt(i);
            ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
        }
    }
View Full Code Here

        int minY = raster.getMinY();
        int width = raster.getWidth();
        int height = raster.getHeight();

        Enumeration icList;
        ImageConsumer ic;
        // Set up the ImageConsumers
        icList = ics.elements();
        while (icList.hasMoreElements()) {
            ic = (ImageConsumer)icList.nextElement();
            ic.setDimensions(width,height);
            ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                        ImageConsumer.COMPLETESCANLINES |
                        ImageConsumer.SINGLEPASS |
                        ImageConsumer.SINGLEFRAME);
        }

        // Get RGB pixels from the raster scanline by scanline and
        // send to consumers.
        int pix[] = new int[width];
        int i,j;
        int numBands = sampleModel.getNumBands();
        int tmpPixel[] = new int[numBands];
        for (j = 0; j < height; j++) {
            for(i = 0; i < width; i++) {
                sampleModel.getPixel(i, j, tmpPixel, dataBuffer);
                pix[i] = colorModel.getDataElement(tmpPixel, 0);
            }
            // Now send the scanline to the Consumers
            icList = ics.elements();
            while (icList.hasMoreElements()) {
                ic = (ImageConsumer)icList.nextElement();
                ic.setPixels(0, j, width, 1, colorModel, pix, 0, width);
            }
        }

        // Now tell the consumers we're done.
        icList = ics.elements();
        while (icList.hasMoreElements()) {
            ic = (ImageConsumer)icList.nextElement();
            ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
        }
    }
View Full Code Here

            return;
        }

        src.lockDecoder(this);

        ImageConsumer ic = null;

        for (Iterator<ImageConsumer> i = consumers.iterator(); i.hasNext();) {
            try {
                ic = i.next();
            } catch (ConcurrentModificationException e) {
                i = consumers.iterator();
                continue;
            }
            ic.imageComplete(status);
        }
    }
View Full Code Here

        if (!checkConnection()) { // No permission for this consumer
            ic.imageComplete(ImageConsumer.IMAGEERROR);
            return;
        }

        ImageConsumer cons = findConsumer(consumers, ic);

        if (cons == null) { // Try to look in the decoders
            ImageDecoder d = null;

            // Check for all existing decoders
View Full Code Here

     * Static implementation of removeConsumer method
     * @param consumersList - list of consumers
     * @param ic - consumer to be removed
     */
    private static void removeConsumer(List<ImageConsumer> consumersList, ImageConsumer ic) {
        ImageConsumer cons = null;

        for (Iterator<ImageConsumer> i = consumersList.iterator(); i.hasNext();) {
            cons = i.next();
            if (cons.equals(ic)) {
                i.remove();
            }
        }
    }
View Full Code Here

     * @param consumersList - list of consumers
     * @param ic - consumer
     * @return consumer if found, null otherwise
     */
    private static ImageConsumer findConsumer(List<ImageConsumer> consumersList, ImageConsumer ic) {
        ImageConsumer res = null;

        for (Iterator<ImageConsumer> i = consumersList.iterator(); i.hasNext();) {
            res = i.next();
            if (res.equals(ic)) {
                return res;
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of java.awt.image.ImageConsumer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.