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

    final int h = image.getHeight();
    final ColorModel model = image.getColorModel();

    for (int i = 0; i < cons.length; i++)
    {
      final ImageConsumer ic = cons[i];
      ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
      ic.setHints(ImageConsumer.SINGLEFRAME);
      ic.setHints(ImageConsumer.SINGLEPASS);
      ic.setHints(ImageConsumer.COMPLETESCANLINES);
      ic.setDimensions(w, h);
      ic.setColorModel(model);
    }

    final int LINES = 10;
    int[] pixels = new int[w * LINES];

    for (int i = 0; i < h; i += LINES)
    {
      final int rows;
      if ((i + LINES) > h)
      {
        rows = h - i;
      }
      else
      {
        rows = LINES;
      }

      pixels = image.getRGB(0, i, w, rows, pixels, 0, w);
      for (int j = 0; j < cons.length; j++)
      {
        final ImageConsumer ic = cons[j];
        ic.setPixels(0, i, w, rows, model, pixels, 0, w);
      }
    }

    for (int i = 0; i < cons.length; i++)
    {
      final ImageConsumer ic = cons[i];
      ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
    }

    if (pic != null)
    {
      removeConsumer(pic);
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

        this.parent = parent;
        useful = true;
        setDaemon(true);
    }
    public void run() {
        ImageConsumer ic = this.ic;
        int w = parent.width;
        int h = parent.height;
        int hints = ic.SINGLEPASS|ic.COMPLETESCANLINES|ic.TOPDOWNLEFTRIGHT;
        if (parent.isStatic())
      hints |= ic.SINGLEFRAME;
        ic.setHints(hints);
        ic.setDimensions(w, h);
        ic.setProperties(null);
        ic.setColorModel(parent.cm);

        if (useful) {
            int[] row=new int[w];
      doPrivileged( new Runnable() {
          public void run() {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    }
      });

            do {
                for (int y = 0; y<h && useful; y++) {
                    parent.computeRow(y,row);

                    if (parent.aborted) {
                        ic.imageComplete(ic.IMAGEABORTED);
                        return;
                    }

                    ic.setPixels(0, y, w, 1, parent.cm, row, 0, w);
                }
                ic.imageComplete(parent.isStatic() ? ic.STATICIMAGEDONE
                                            : ic.SINGLEFRAMEDONE );
            } while(!parent.isStatic() && useful);
        }
    }
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.