import java.awt.image.*; import java.util.*; public class NewImageProducer implements ImageProducer { private Vector _v = null; public NewImageProducer() { _v = new Vector(); } public void addConsumer(ImageConsumer ic) { if (isConsumer(ic) == false) _v.addElement(ic); } public void removeConsumer(ImageConsumer ic) { if (isConsumer(ic) == true) _v.removeElement(ic); } public boolean isConsumer(ImageConsumer ic) { return _v.indexOf(ic) > -1; } public void startProduction(ImageConsumer ic) { addConsumer(ic); int x = 128; int y = 128; int [] rgn = new int [x * y]; for (int i = 0; i < x * y; i++) rgn[i] = i * 2; Hashtable ht = new Hashtable(); ColorModel cm = new DirectColorModel(24, 0x0000FF, 0x00FF00, 0xFF0000); Vector v = (Vector)_v.clone(); Enumeration e = v.elements(); while (e.hasMoreElements()) { ic = (ImageConsumer)e.nextElement(); ic.setColorModel(cm); ic.setDimensions(x, y); ic.setProperties(ht); ic.setHints(ImageConsumer.RANDOMPIXELORDER); ic.setPixels(0, 0, x, y, cm, rgn, 0, x); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } } public void requestTopDownLeftRightResend(ImageConsumer ic) { ; } }