Examples of ImageConsumer


Examples of ae.java.awt.image.ImageConsumer

        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

Examples of ae.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

Examples of ae.java.awt.image.ImageConsumer

        }
        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

Examples of ae.java.awt.image.ImageConsumer

            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

Examples of com.google.code.appengine.awt.image.ImageConsumer

        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

Examples of com.google.code.appengine.awt.image.ImageConsumer

     * 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

Examples of com.google.code.appengine.awt.image.ImageConsumer

     * @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

Examples of com.google.code.appengine.awt.image.ImageConsumer

            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

Examples of com.google.code.appengine.awt.image.ImageConsumer

        return false;
    }

    public void startProduction(ImageConsumer ic) {
        addConsumer(ic);
        ImageConsumer fic = consTable.get(ic);
        source.startProduction(fic);
    }
View Full Code Here

Examples of com.google.code.appengine.awt.image.ImageConsumer

        }
    }

    public synchronized void removeConsumer(ImageConsumer ic) {
        if(ic != null && isConsumer(ic)){
            ImageConsumer fic = consTable.get(ic);
            source.removeConsumer(fic);
            consTable.remove(ic);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.