forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fade Image (screen) to black

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
JetSpike



Joined: 19 Sep 2005
Posts: 8

PostPosted: Sat Mar 18, 2006 1:22 pm    Post subject: Fade Image (screen) to black Reply with quote

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?
Back to top
View user's profile Send private message
fullerlee



Joined: 03 Nov 2005
Posts: 54

PostPosted: Sat Mar 18, 2006 1:38 pm    Post subject: Reply with quote

I've found that alpha values of 0 or 255 are the only ones that work correctly.
Back to top
View user's profile Send private message
JetSpike



Joined: 19 Sep 2005
Posts: 8

PostPosted: Sat Mar 18, 2006 2:38 pm    Post subject: Reply with quote

Yeah, it's weird, only two values work when blitting to an image, but when I blit to the screen directly, I can use any value I want.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group