I have created an image like this:
imgAlpha = Image.createEmpty(480,272)
clrAlpha = Color.new(0,0,0,150)
imgAlpha:fillRect(0,0,479,271,clrAlpha)
So now I have a black rectangle the size of the screen with an alpha value of 150.
I have another image:
imgToFade = Image.createEmpty(480,272)
imgToFade:clear(clrBlack)
I then draw some graphics to imgToFade.
Now what want to do is blit imgAlpha on to imgToFade, once every loop, so the effect will be imgToFade will go completely black if I don't draw anything new. However, when I try to blit imgAlpha on to imgToFade, it doesn't blend properly. If I set an alpha value of 255, then it works, but I want to use a lower value so if fades gradually.
I know the imgAlpha works correctly because if I do this:
screen:clear(clrBlack)
screen:blit(0,0,imgToFade,true)
screen:blit(0,0,imgAlpha,true)
Then the graphics on imgToFade are blended appropriately. But I want to have it apply the blend on to imgToFade itself so eventually it goes to black.
Any ideas why this isn't happening the way I expect it to?
Fade Image (screen) to black
Moderators: Shine, Insert_witty_name