47 |
import java.awt.color.ColorSpace; |
import java.awt.color.ColorSpace; |
48 |
import java.util.Hashtable; |
import java.util.Hashtable; |
49 |
import java.util.Vector; |
import java.util.Vector; |
50 |
|
import java.util.HashSet; |
51 |
|
import java.util.Iterator; |
52 |
import gnu.java.awt.ComponentDataBlitOp; |
import gnu.java.awt.ComponentDataBlitOp; |
53 |
|
|
54 |
/** |
/** |
444 |
|
|
445 |
public ImageProducer getSource() |
public ImageProducer getSource() |
446 |
{ |
{ |
447 |
throw new UnsupportedOperationException("not implemented"); |
return new ImageProducer() { |
448 |
|
|
449 |
|
HashSet consumers = new HashSet(); |
450 |
|
|
451 |
|
public void addConsumer(ImageConsumer ic) |
452 |
|
{ |
453 |
|
consumers.add(ic); |
454 |
|
} |
455 |
|
|
456 |
|
public boolean isConsumer(ImageConsumer ic) |
457 |
|
{ |
458 |
|
return consumers.contains(ic); |
459 |
|
} |
460 |
|
|
461 |
|
public void removeConsumer(ImageConsumer ic) |
462 |
|
{ |
463 |
|
consumers.remove(ic); |
464 |
|
} |
465 |
|
|
466 |
|
public void startProduction(ImageConsumer ic) |
467 |
|
{ |
468 |
|
int x = 0; |
469 |
|
int y = 0; |
470 |
|
int width = getWidth(); |
471 |
|
int height = getHeight(); |
472 |
|
int stride = width; |
473 |
|
int offset = 0; |
474 |
|
int[] pixels = getRGB(x, y, |
475 |
|
width, height, |
476 |
|
(int[])null, offset, stride); |
477 |
|
ColorModel model = getColorModel(); |
478 |
|
|
479 |
|
consumers.add(ic); |
480 |
|
|
481 |
|
Iterator i = consumers.iterator(); |
482 |
|
while(i.hasNext()) |
483 |
|
{ |
484 |
|
ImageConsumer c = (ImageConsumer) i.next(); |
485 |
|
c.setHints(ImageConsumer.SINGLEPASS); |
486 |
|
c.setDimensions(getWidth(), getHeight()); |
487 |
|
c.setPixels(x, y, width, height, model, pixels, offset, stride); |
488 |
|
c.imageComplete(ImageConsumer.STATICIMAGEDONE); |
489 |
|
} |
490 |
|
} |
491 |
|
|
492 |
|
public void requestTopDownLeftRightResend(ImageConsumer ic) |
493 |
|
{ |
494 |
|
startProduction(ic); |
495 |
|
} |
496 |
|
|
497 |
|
}; |
498 |
} |
} |
499 |
|
|
500 |
public Vector getSources() |
public Vector getSources() |