I was trying to show an animated GIF over the maps as a blip to indicate user's position on the map. But I could not show a gif with transparent background. The gif background was shown to be white although the gif uimage had a transparent background. Then I changed a few lines of the tutorial and then it worked. The lines I have changed is as follows :
void CGifAnimatorContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
if(iIsVisible)
{
if(iGif_Reader)
{
if(iGif_Reader->Bitmap() && iGif_Reader->BitmapImg() && iGif_Reader->BitmapMsk())
{
if(iGif_Reader->Bitmap()->Handle() && iGif_Reader->BitmapImg()->Handle() && iGif_Reader->BitmapMsk()->Handle())
{
TSize gifSize = TSize(iGif_Reader->Bitmap()->SizeInPixels());
TSize screenSize = TSize(aRect.Size());
TRect tempRect = TRect(TPoint((screenSize.iWidth - gifSize.iWidth)/2 ,(screenSize.iHeight - gifSize.iHeight)/2),gifSize);
gc.DrawBitmapMasked(tempRect,iGif_Reader->BitmapImg(),
TRect(0, 0, iGif_Reader->BitmapImg()->SizeInPixels().iWidth, iGif_Reader->BitmapImg()->SizeInPixels().iHeight),
iGif_Reader->BitmapMsk(), EFalse);
//gc.DrawBitmapMasked
}
}
}
}
}
Just replace the original function with mine.
Sweetmeats!!!
2 days ago

0 comments:
Post a Comment