Image Fade-in Fade-out

B2Ben

Well-known member
Joined
Aug 17, 2006
Messages
52
Programming Experience
Beginner
I'm building an application that, among other things, displays images full-screen, with the option of fading them in or out.

I want to load images from files (jpg/png/bmp/etc...), and fade them in and out at varying speeds. One at a time, no overlapping fades (yet?).

Anyway, I found some code to load an image into a picturebox and mess with the alpha, but it's INCREDIBLY slow when you try to process so many levels of fading.

So... I think I need something more powerful... but what? DirectX, DirectDraw, GDI...? I have no idea. It's beyond my scope of understanding right now.

If anyone can point me to a good tutorial or sample code to help me do this, it would be greatly appreciated.

Thanks!
 
To give you a little more background... I'm building some software for a local non-profit Community Theatre organization that I work with a lot, both on and off-stage. They're doing a musical in March, and they want to incorporate 3 projection screens of video and images as part of the show. Each projector will be connected to a computer with a wireless card.

From the sound booth, I will control these 3 computers/projectors remotely. I've written a server/client system to allow me to control video playback remotely on my client computers. I'm using the Windows Media Player control to handle the video playback, which is going well. Overall, the project is going well so far.

I also want to make my projector screens display static images, which I can do, but a more dramatic effect would be to make images fade-in and fade-out. I could somehow do this with video, but the picture quality would degrade, and it would be a pain to do this with every image.

So if anyone has any ideas... I'd love to hear them ...help out a non-profit :)
 
Mmm, i wouldn't try manipulating the alpha of full screen images with managed code. You'd have a job to do it with any kind of decent performance. Unless you are using WinFX (.Net 3.0) and the windows presentation foundation. However you could try setting the image as a background of a form and just adjust the opacity of the form to fade it in and out.
 
I have thought about doing the form transparency thing. I tried it once a long time ago when I was experimenting with building a screensaver. Haven't tried it yet with this project... I figure it uses some of the same graphics routines that don't run so fast... I'm sure I'll give it a try soon enough though.
 
I have thought about doing the form transparency thing. I tried it once a long time ago when I was experimenting with building a screensaver. Haven't tried it yet with this project... I figure it uses some of the same graphics routines that don't run so fast... I'm sure I'll give it a try soon enough though.

Not quite sure what you mean. Adjusting the forms alpha is as simple as adjusting the forms opacity property.

Haven't tried it yet with this project... I figure it uses some of the same graphics routines that don't run so fast...

Not sure what you mean here. Adjusting the forms opacity internally calls the 'SetWindowLong' API which is stored in an UnsafeNativeMethods Class which is as good as using unmanaged code. So it will be as fast as you can get in a managed world.
 
Sorry my last post wasn't very coherent... :)

Thanks for the tip. I'll give this method a try tonight if I get some time.
 
Back
Top