DJ_AM_Juicebox
asked on
Image transistion
Hi,
I wanted to make a simple image effect. I want a bitmp to fade to %100 transparency for example. I'm not sure how this would be done in a general sense. I'm working on win32.
I was thinking that I could have an image class with a member that represents opactiy:
class FadeImage {
Bitmap m_Img;
double m_dOpacity = 100.0;
};
When I want the image to fade, I can just call some method to initiate it, and keep generating WM_PAINT messages until it's done:
void FadeImage::StartFade()
{
while (m_dOpacity != 0) {
m_dOpacity--;
Invalidate();
}
}
That would work, but the system will just block the user from doing much until the fade is done. I'm wondering how packages like flash do it. They can carry a fade out while still allowing mouse interaction. What's the general way to do something like this?
Thanks
I wanted to make a simple image effect. I want a bitmp to fade to %100 transparency for example. I'm not sure how this would be done in a general sense. I'm working on win32.
I was thinking that I could have an image class with a member that represents opactiy:
class FadeImage {
Bitmap m_Img;
double m_dOpacity = 100.0;
};
When I want the image to fade, I can just call some method to initiate it, and keep generating WM_PAINT messages until it's done:
void FadeImage::StartFade()
{
while (m_dOpacity != 0) {
m_dOpacity--;
Invalidate();
}
}
That would work, but the system will just block the user from doing much until the fade is done. I'm wondering how packages like flash do it. They can carry a fade out while still allowing mouse interaction. What's the general way to do something like this?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want transparency, probably using 'SetLayeredWindowAttribute s()' (http://msdn2.microsoft.com/en-us/library/ms633540.aspx) is more what you are looking for. See also http://www.codeproject.com/w2k/trans.asp ("Transparency without Source Code")
http://smallcode.weblogs.us/2006/04/11/things-are-not-as-easy-as-they-seem-writing-a-clock-application/