home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / awt / image / OffScreenImageSource.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.6 KB  |  70 lines

  1. package sun.awt.image;
  2.  
  3. import java.awt.Component;
  4. import java.awt.image.ImageConsumer;
  5. import java.awt.image.ImageProducer;
  6. import java.util.Hashtable;
  7.  
  8. public class OffScreenImageSource implements ImageProducer {
  9.    Component target;
  10.    int width;
  11.    int height;
  12.    ImageRepresentation baseIR;
  13.    private ImageConsumer theConsumer;
  14.  
  15.    public OffScreenImageSource(Component var1, int var2, int var3) {
  16.       this.target = var1;
  17.       this.width = var2;
  18.       this.height = var3;
  19.    }
  20.  
  21.    void setImageRep(ImageRepresentation var1) {
  22.       this.baseIR = var1;
  23.    }
  24.  
  25.    public ImageRepresentation getImageRep() {
  26.       return this.baseIR;
  27.    }
  28.  
  29.    public synchronized void addConsumer(ImageConsumer var1) {
  30.       this.theConsumer = var1;
  31.       this.produce();
  32.    }
  33.  
  34.    public synchronized boolean isConsumer(ImageConsumer var1) {
  35.       return var1 == this.theConsumer;
  36.    }
  37.  
  38.    public synchronized void removeConsumer(ImageConsumer var1) {
  39.       if (this.theConsumer == var1) {
  40.          this.theConsumer = null;
  41.       }
  42.  
  43.    }
  44.  
  45.    public void startProduction(ImageConsumer var1) {
  46.       this.addConsumer(var1);
  47.    }
  48.  
  49.    public void requestTopDownLeftRightResend(ImageConsumer var1) {
  50.    }
  51.  
  52.    private native void sendPixels();
  53.  
  54.    private void produce() {
  55.       if (this.theConsumer != null) {
  56.          this.theConsumer.setDimensions(this.width, this.height);
  57.       }
  58.  
  59.       if (this.theConsumer != null) {
  60.          this.theConsumer.setProperties(new Hashtable());
  61.       }
  62.  
  63.       this.sendPixels();
  64.       if (this.theConsumer != null) {
  65.          this.theConsumer.imageComplete(2);
  66.       }
  67.  
  68.    }
  69. }
  70.