Of course you can. Modify the foreground making it transparent (alpha channel) and update the "scene".

If you're asking for code, it depends on what are you using. I mean, if you're using Allegro you'll do it different than using SDL...