Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-04 Thread java2d
I am trying to add one image above another image. And tried alpha from 0 to 1, they all did not work. So what's right way to do this? [Message sent by forum member 'jiezhang' (jiezhang)] http://forums.java.net/jive/thread.jspa?messageID=291351

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-04 Thread Harald Kuhr
Hi, You can't do an alpha-blended composition of two bi-level images, as a bilevel image has only two levels, either completely white or completely black. So you first have to create a new temporary true color BufferedImage (any of the TYPE_INT_RGB or TYPE_3/4BYTE_RGB/BGR will probably

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-04 Thread java2d
That way should work. Another way to make it work is converting the first one to gray image and draw the second on it. But I am hoping to get thing done without introducing the third image or doing a content conversion. [Message sent by forum member 'jiezhang' (jiezhang)]

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-04 Thread Dmitri Trembovetski
Have you tried without extra alpha? Just with the default SrcOver compositing mode? Thanks, Dmitri [EMAIL PROTECTED] wrote: I am trying to add one image above another image. And tried alpha from 0 to 1, they all did not work. So what's right way to do this? [Message sent by forum

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-03 Thread java2d
Not quite sure what you expected. If you're compositing two 1-bit images with .4 extra alpha, you'll pretty much get 0 in the result since extra alpha is shifting all colors towards index 0 which is black by default. Dmitri [Message sent by forum member 'trembovetski' (trembovetski)]

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-01 Thread Dmitri Trembovetski
[EMAIL PROTECTED] wrote: I am using drawimage method to add a BufferedImage to another BufferedImage. The base image is a bilevel (white and black) and the added image is bilevel too. But in result, the added image just became a black frame in base image. Anyone has an idea? Please post a

Re: [JAVA2D] drawimage on a bilevel image does not work

2008-08-01 Thread java2d
This is source code. How do I give images. import java.awt.image.BufferedImage; import java.awt.Graphics2D; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Font; import java.awt.RenderingHints; import java.awt.FontMetrics; import java.awt.geom.Rectangle2D; import