Hi,
I am trying to merge 2 images using the cross dissolving algorithm. That is, one image fades to the other and vice versa.
Does anyone has an idea how to do this? Thanks in advance
Printable View
Hi,
I am trying to merge 2 images using the cross dissolving algorithm. That is, one image fades to the other and vice versa.
Does anyone has an idea how to do this? Thanks in advance
What exactly is the cross dissolving algorithm? Write it out in easy to follow steps, and you should have something that's pretty easy to convert to code.
Pseudocode is like this:
Input image 1
Input image 2
Grab pixels from images 1 and 2
IF width and height are same,
In image viewer, start with image 1
Slowly fade image 1 to image 2
Wait till image 2 is fully reconstructed
Fade back to image 1 again and repeat sequence
ELSE
Resize image and repeat operation
Okay... and what part of this are you having trouble with? Where are you stuck? What have you tried?
I think this algorithm uses timers and threads but I tried to make my way around this algorithm by merging the 2 images by using pixel grabber and for loops. However, I am not getting the expected results. There are blurry lines being drawn vertically
You might find java.awt.AlphaComposite of interest.
db
It'd be much easier (and more efficient) to use an alpha channel to fade back and forth than to manually grab pixels and reconstruct an image. You can easily add an alpha channel to the images if they don't already have one.