コード例 #1
0
  /**
   * Create an ImageRepresentation for the given Image. The width and height are unknown at this
   * point. The color model is a hint as to the color model to use when creating the buffered image.
   * If null, the src color model will be used.
   */
  public ImageRepresentation(ToolkitImage im, ColorModel cmodel, boolean forceCMhint) {
    image = im;

    if (image.getSource() instanceof InputStreamImageSource) {
      src = (InputStreamImageSource) image.getSource();
    }

    setColorModel(cmodel);

    this.forceCMhint = forceCMhint;
  }
コード例 #2
0
  public void imageComplete(int status) {
    if (src != null) {
      src.checkSecurity(null, false);
    }
    boolean done;
    int info;
    switch (status) {
      default:
      case ImageConsumer.IMAGEABORTED:
        done = true;
        info = ImageObserver.ABORT;
        break;
      case ImageConsumer.IMAGEERROR:
        image.addInfo(ImageObserver.ERROR);
        done = true;
        info = ImageObserver.ERROR;
        dispose();
        break;
      case ImageConsumer.STATICIMAGEDONE:
        done = true;
        info = ImageObserver.ALLBITS;
        break;
      case ImageConsumer.SINGLEFRAMEDONE:
        done = false;
        info = ImageObserver.FRAMEBITS;
        break;
    }
    synchronized (this) {
      if (done) {
        image.getSource().removeConsumer(this);
        consuming = false;
        newbits = null;

        if (bimage != null) {
          bimage = getOpaqueRGBImage();
        }
      }
      availinfo |= info;
      notifyAll();
    }

    newInfo(image, info, 0, 0, width, height);

    image.infoDone(status);
  }
コード例 #3
0
  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);
  }
コード例 #4
0
 synchronized void dispose() {
   image.getSource().removeConsumer(this);
   consuming = false;
   newbits = null;
   availinfo &= ~(ImageObserver.SOMEBITS | ImageObserver.FRAMEBITS | ImageObserver.ALLBITS);
 }
コード例 #5
0
 /*synchronized*/ void startProduction() {
   if (!consuming) {
     consuming = true;
     image.getSource().startProduction(this);
   }
 }