If anyone has a more elegant way to do this, I'd love to hear
it.  I had a similar need using JDK 1.1, and created an
image filter which, given an existing image, produces a
new image with all pixels of a certain color made transparent.

I've attached it here.  It can be used with the code:

    newImage =  Toolkit.getDefaultToolkit().createImage(new FilteredImageSource (
      oldImage.getSource(), new BluescreenImageFilter())
    );

Hope this helps

--Andy

[EMAIL PROTECTED]
(206) 662-4943

 <<BluescreenImageFilter.java>> 
> ----------
> From:         John Sproull[SMTP:[EMAIL PROTECTED]]
> Sent:         Friday, March 26, 1999 10:26 AM
> To:   [EMAIL PROTECTED]
> Subject:      [java2d] transparent image
> 
> 
>  Hi all, now that I've ditched the Area idea, i'm trying to construct a
> completely transparent image which i will then draw polygons on and then,
> in turn, draw the image to the main graphics context which i have. the
> only thing is that i can't seem to figure out how to replace the pixels on
> the image with transparent ones. I've tried every combination of source
> and alpha using
> AlphaComposite.getInstance(). i must've missed one. my image still has a
> background color when it draws.
> 
> thanks again.
> 
> John
> 
> 
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/
> 

BluescreenImageFilter.java

Reply via email to