Page 1 of 1

Animated Bitmaps

Posted: Wed May 02, 2007 6:42 pm
by baileyrc
I'm trying to add support for bitmap animations inside a TRichViewEdit component. I have four bitmap images I would like to cycle through to create the effect of a simple animation. How might I go about this -- is it possible to do. Note, this animation effect is not using animated gifs. Any ideas would be greatly appreciated.

Posted: Wed May 02, 2007 11:35 pm
by baileyrc
It turns out that the Demo6 has an example how to do this using InsertBullet(ImageMap) and then SetCurrentBulletInfo or SetBulletInfoEd in a TTimer. I should have looked before I posted...

Posted: Thu May 03, 2007 5:01 pm
by Sergey Tkachenko
Bitmap animation is supported.
Set the following integer properties (see SetItemExtraIntProperty):
rvepImageWidth,
rvepImageHeight,
rvepAnimationInterval.

Bitmap is sliced into frames (rvepImageWidth x rvepImageHeight) arranged in rows and columns. Animation is enabled if you set rvepAnimationInterval in positive value (animation delay in 1/100 of second)

Known problems: such bitmaps are still printed and exported stretched instead of exporting one frame.

Posted: Fri May 04, 2007 6:40 pm
by baileyrc
Sergey,

I tried your recommendation to use rvepAnimationInterval but it doesn't work. Here is my code:

Code: Select all

Graphics::TBitmap *bigBmp = new Graphics::TBitmap;
			 bigBmp->Canvas->CopyMode = cmSrcCopy;
			 bigBmp->SetSize(animBmp[0]->Width*2,animBmp[0]->Height*2);
			 bigBmp->Canvas->Draw(0,0,animBmp[0]);
			 bigBmp->Canvas->Draw(0,animBmp[0]->Width,animBmp[1]);
			 bigBmp->Canvas->Draw(animBmp[0]->Height,0,animBmp[2]);
			 bigBmp->Canvas->Draw(animBmp[0]->Height,animBmp[0]->Width,animBmp[3]);

			 RichViewEdit1->InsertPicture("", bigBmp, rvvaBaseline);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepImageWidth, animBmp[0]->Width, true);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepImageHeight, animBmp[0]->Height, true);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepAnimationInterval, 50, true);
What this produces is a static (non-animated) bitmap image the size of rvepImageWidth/Height with all four tiled bitmap images (so they have been shruken). The rvepAnimationInterval doesn't seem to work. What might I be doing wrong?

Posted: Fri May 04, 2007 7:14 pm
by Sergey Tkachenko
Did you set RichViewEdit1->AnimationMode = rvaniOnFormat ?

Posted: Fri May 04, 2007 7:27 pm
by baileyrc
I just set this as well but I get the same result

New code snippet with line added below:

Code: Select all

Graphics::TBitmap *bigBmp = new Graphics::TBitmap;
			 bigBmp->Canvas->CopyMode = cmSrcCopy;
			 bigBmp->SetSize(animBmp[0]->Width*2,animBmp[0]->Height*2);
			 bigBmp->Canvas->Draw(0,0,animBmp[0]);
			 bigBmp->Canvas->Draw(0,animBmp[0]->Width,animBmp[1]);
			 bigBmp->Canvas->Draw(animBmp[0]->Height,0,animBmp[2]);
			 bigBmp->Canvas->Draw(animBmp[0]->Height,animBmp[0]->Width,animBmp[3]);

			 RichViewEdit1->InsertPicture("", bigBmp, rvvaBaseline);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepImageWidth, animBmp[0]->Width, true);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepImageHeight, animBmp[0]->Height, true);
			 RichViewEdit1->SetCurrentItemExtraIntProperty(rvepAnimationInterval, 50, true);
			 RichViewEdit1->AnimationMode = rvaniOnFormat;

Posted: Fri May 04, 2007 7:41 pm
by baileyrc
Where in the documentation can I find information about bitmap animation? I don't see any of the rvaniOnFormat, AnimationMode, or rvepAnimationInterval you refer to.

Posted: Sat May 05, 2007 8:38 am
by Sergey Tkachenko
Oops, there is a bug preventing bitmap animation to work :(
If you are a registered user, I can give you instructions how to fix it. If not, and this functionality is critical for you, I can send updated trial to you.

All changes not included in the help file are listed in readme.txt, in the same folder as the help file.

Posted: Sun May 06, 2007 9:52 am
by Sergey Tkachenko
Fixed version is available for registered users.

Posted: Mon May 07, 2007 1:18 pm
by baileyrc
Sergey,

I am not a registered user yet -- I have a request in at my company to buy a 2/3 developer license and that should happen this week. Could you send me an updated trial with bitmap animation support to my email address? I would greatly appreciate it.

Thanks!

-Ryan

Posted: Tue May 08, 2007 6:05 pm
by Sergey Tkachenko
Ok, but which version of Delphi/C++Builder do you use?

Posted: Tue May 08, 2007 6:24 pm
by baileyrc
C++ BDS 2006

Posted: Wed May 09, 2007 6:41 pm
by Sergey Tkachenko
Sent.

BTW, this week I plan to change policy of free lifetime updates. Updates will be free only for those who order before this Saturday.
Just an information :)