> -----Original Message-----
> From: Peter van Raamsdonk [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 22, 2006 1:38 PM
> To: Paulo Soares
> Subject: RE: [iText-questions] Graphics2d + transparency
>
> Hello Paulo,
>
> Let me see if I get it right,
>
> GIF, PNG, and JPEG formats are supported by the javax.imageio
> package by default.
>
> I assume that if an image contains transparency, reading it
> into the imageio doesn't change the content.
>
JPEG doesn't contain any transparency information.
> I'm writing it to a bufferedImage that supports transparency.
> image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
>
Just because you write a transparent image to a BufferedImage doesn't
make the BufferedImage itself transparent in any way. Instead of writing
it to iText write it to a jpanel and see what you get.
> I've changed the color of the background, this is the
> transparent area. I don't want to see this if it is transparent.
>
> I've made a test function after you changed the background
> color that this color is replaced by a transparent color.
> Just put in the source image and the color to replace.
>
> After rendering it, the background is black..
>
> public BufferedImage drawTransparentImage(BufferedImage
> srcImage, final Color color) {
> int markerRGB = color.getRGB();
> BufferedImage destImage = new
> BufferedImage(srcImage.getWidth(), srcImage.getHeight(),
> BufferedImage.TYPE_INT_ARGB);
>
> for (int j=0; j<srcImage.getHeight(); j++) {
> for (int i=0; i<srcImage.getWidth(); i++) {
> Color oldColor = new Color(srcImage.getRGB(i,
> j), true);
> int rgb = oldColor.getRGB();
>
> if (rgb != markerRGB) {
> //destImage.setRGB(i, j, new
> Color(255,0,255).getRGB());
> } else {
> destImage.setRGB(i, j, Color.OPAQUE);
> }
> }
> }
> return destImage;
> }
>
> I also tried the g.setComposite(AlphaComposite.Src) when
> replacing the color. But the black keeps returning.
>
> Can you give my an example with an awt Image/ bufferedImage
> to draw an transparent image (example with text behind the
> image). Or tell me want I think is right is wrong.
>
Did you read my other answer?
Paulo
> Thanx in advance,
>
> "It is getting dark before my eyes and not transparent" Peter
>
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions