FileDocCategorySizeDatePackage
DynamicFilter.javaAPI DocExample2400Mon Mar 24 01:59:02 GMT 1997None

DynamicFilter

public class DynamicFilter extends ImageFilter

Fields Summary
Color
overlapColor
int
delay
int
imageWidth
int
imageHeight
int
iterations
Constructors Summary
DynamicFilter(int delay, int iterations, Color color)

        this.delay      = delay;
        this.iterations = iterations;
        overlapColor    = color;
    
Methods Summary
public voidimageComplete(int status)

        if ((status == IMAGEERROR) || (status == IMAGEABORTED)) {
            consumer.imageComplete (status);
            return;
        } else {
            int xWidth = imageWidth / iterations;
            if (xWidth <= 0)
                xWidth = 1;
            int newPixels[] = new int [xWidth*imageHeight];
            int iColor = overlapColor.getRGB();
            for (int x=0;x<(xWidth*imageHeight);x++)
                newPixels[x] = iColor;
            int t=0;
            for (;t<(imageWidth-xWidth);t+=xWidth) {
                consumer.setPixels(t, 0, xWidth, imageHeight,
                        ColorModel.getRGBdefault(), newPixels, 0, xWidth);
                consumer.imageComplete (ImageConsumer.SINGLEFRAMEDONE);
                try {
                    Thread.sleep (delay);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            int left = imageWidth-t;
            if (left > 0) {
                consumer.setPixels(imageWidth-left, 0, left, imageHeight,
                        ColorModel.getRGBdefault(), newPixels, 0, xWidth);
                consumer.imageComplete (ImageConsumer.SINGLEFRAMEDONE);
            }
            consumer.imageComplete (STATICIMAGEDONE);
        }
    
public voidresendTopDownLeftRight(java.awt.image.ImageProducer ip)

    
public voidsetDimensions(int width, int height)

        imageWidth  = width;
        imageHeight = height;
        consumer.setDimensions (width, height);
    
public voidsetHints(int hints)

        consumer.setHints (ImageConsumer.RANDOMPIXELORDER);