Animated Bitmaps

General TRichView support forum. Please post your questions here
Post Reply
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Animated Bitmaps

Post 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.
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post 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...
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Did you set RichViewEdit1->AnimationMode = rvaniOnFormat ?
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post 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;
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Fixed version is available for registered users.
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post 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
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, but which version of Delphi/C++Builder do you use?
baileyrc
Posts: 11
Joined: Fri Apr 27, 2007 11:44 pm

Post by baileyrc »

C++ BDS 2006
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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 :)
Post Reply