I'm trying to display an animated GIF in a Firemonkey HD form using TImage but I do not see any methods for animation.
Using Vcl.Imaging.gifImg is not an option because types differ.
Can someone suggest a way to solve this problem or probably component to animate GIF images under Firemonkey?
The only way I find for now is:
create TGIFImage instance and load the GIF image
loop through gif.images:
a. save current image to stream
b. Image1.bitmap.loadFromStream [Image1 is FMX:TImage]
Is there any smarter solution?
You can use TBitmapListAnimation with a single image which has each frame of the animation inside a long strip. eg, if your animation has 4 frames and is 32px by 32px then you need to create an image 128px wide by 32px high and add each frame side by side...
Then add a TImage to the form (you don't have to load a bitmap into this)
Add a TBitmapListAnimation with the TImage as it's parent
Double click AnimationBitmap and load your animation image strip
Drop down PropertyName and pick Bitmap
Set AnimationCount to 4 and AnimationRowCount 1 for this example
Set enabled to true
TBitmapListAnimation has good control over animation frame rates, reversing, looping and interpolation. I couldn't find a way to get a .gif to animate in FireMonkey2 but if you have the means to convert an animated .gif into a 'cartoon strip' then this is a good way to do animations.
PS This is Delphi XE3...so can't say if these components existed in previous version.