I have a strange problem. I made a simple RGBImageFilter that just
returns 0xFFFF0000. Thats right, it simply replaces every pixel with
a full alpha red pixel.
My problem comes when using the filter...
//filter - is my red filter
//myApplet - is the applet I'm running this from
//original - is an image that was loaded from a .png file and has
//newImage - is a BufferedImage that I created already with the
same dimensions as the "original" image
newContext = (Graphics2D)newImage.createGraphics();
Image coloredImage = myApplet.createImage(
new FilteredImageSource(original.getSource(), filter));
//draw the red image
newContext.drawImage(coloredImage, 0,0, null);
//draw the original image over top of the red background
newContext.drawImage(original, 0,0, null);
I have this replacing colors in a function, and as it turns out, calling
this repeatedly with the SAME original image, SOMETIMES results in a
Now originally I didn't have my filter just returning red, I am just doing
this to illustrate my point. I would like to know, is there some way to
make sure the call to createImage(...) has finished making the Image
before I draw it to something else?
I am using the latest java 1.5.0_03 both for development and in my browser(IE 6),
and the appletviewer does the same thing.
Here is a pic of the problem in action:
Thanks for any help you guys can provide! I don't post here much, but I'm a long time reader.