home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / sun / awt / image / ImageInfoGrabber.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  2.3 KB  |  60 lines

  1. package sun.awt.image;
  2.  
  3. import java.awt.image.ColorModel;
  4. import java.awt.image.ImageConsumer;
  5. import java.util.Hashtable;
  6.  
  7. class ImageInfoGrabber extends ImageWatched implements ImageConsumer {
  8.    Image image;
  9.  
  10.    public ImageInfoGrabber(Image img) {
  11.       this.image = img;
  12.    }
  13.  
  14.    public void setupConsumer() {
  15.       this.image.getSource().addConsumer(this);
  16.    }
  17.  
  18.    public void getInfo() {
  19.       this.image.getSource().startProduction(this);
  20.    }
  21.  
  22.    public void stopInfo() {
  23.       this.image.getSource().removeConsumer(this);
  24.       super.watchers = null;
  25.    }
  26.  
  27.    public void setDimensions(int w, int h) {
  28.       this.image.setDimensions(w, h);
  29.       ((ImageWatched)this).newInfo(this.image, 3, 0, 0, w, h);
  30.    }
  31.  
  32.    public void setProperties(Hashtable props) {
  33.       this.image.setProperties(props);
  34.       ((ImageWatched)this).newInfo(this.image, 4, 0, 0, 0, 0);
  35.    }
  36.  
  37.    public void setColorModel(ColorModel model) {
  38.    }
  39.  
  40.    public void setHints(int hints) {
  41.    }
  42.  
  43.    public void setPixels(int srcX, int srcY, int srcW, int srcH, ColorModel model, byte[] pixels, int srcOff, int srcScan) {
  44.    }
  45.  
  46.    public void setPixels(int srcX, int srcY, int srcW, int srcH, ColorModel model, int[] pixels, int srcOff, int srcScan) {
  47.    }
  48.  
  49.    public void imageComplete(int status) {
  50.       this.image.getSource().removeConsumer(this);
  51.       if (status == 1) {
  52.          ((ImageWatched)this).newInfo(this.image, 64, -1, -1, -1, -1);
  53.       } else if (status == 4) {
  54.          ((ImageWatched)this).newInfo(this.image, 128, -1, -1, -1, -1);
  55.       }
  56.  
  57.       this.image.infoDone(status);
  58.    }
  59. }
  60.