Hi,

i am writing a bit of code that uses the following equation:

tot=(i*top)+((1-i)*btm);

basically this derives a merged value based on alpha transparency value when merging 2 images.

Now, i am kinda reversing it to obtain the alpha info. The following variables in this situation are known values:

tot, top, btm

i (alpha info) isnt known.

I cant rearrange this equation however, it seems to cancel out..

My current solution is extremely inefficient, it involves looping through for all values of i (255 of em) with the known variables until the lhs==rhs. Then i know the alpha. This has to be done for each pixel and its too slow to be practical.

Does anybody know either 1)how to rearrange the above to get i, or if this is impossible 2)some more efficient method of getting i from the above without looping through all values until i is found..

thx in advance

bob