PDA

View Full Version : Gif and DelphiX Graphics question...



Wizard
24-01-2007, 11:01 AM
This is probably a stupid question but how does one display animated images (.gif) in delphiX?

The gif image gets displayed if I add the GifImage to my uses clause but as a static picture :(

Is there a component that I need and where can I find it?

Thanks for your help :-)

jasonf
24-01-2007, 11:22 AM
DelphiX doesn't do Animated Gifs as far as I know.

You're far better off using a tool to make a long string of images from the gif and using DelphiX's built in animation system. I've had a look for such a tool, but I can't find one.. although I've found some VB code. I'll see what I can knock up this lunchtime.. no promises though.

jasonf
24-01-2007, 11:50 AM
OK, I've made a tool..

It's the most primitive tool since UG the caveman first hit OG the caveman over the head with a rock and said AX!

http://www.cerebral-bicycle.co.uk/downloads/ungiffer.zip

Load up the app, put the filename of the gif you want to unGif into the box and press the button. This will de-animate the GIF onto the form (resize the form to see more frames) Then do an [ALT]+[PrintScreen] and past into Paint.. cut out the frames you want and save them in whatever format you want, load into DelphiX, tell it how many frames etc.. it should work niceley.

If you want to advance this tool, please be my guest, I've included the vb6 code and project if you're interested. If someone wants to make it export to file, don't let me stop you :) I'd appreciate any enhancements being sent my way too so I can host it on my site.

Hope this helps.

Wizard
24-01-2007, 12:06 PM
Thanks JasonF, I've downloaded your file and will try it out :-) I've done animation in DelphiX before so when the gif is broken down into pieces I'll be able to work with it :)

jasonf
24-01-2007, 12:59 PM
No problem..

One more point, you may need the VB runtime files. They can be found here
http://www.cerebral-bicycle.co.uk/Downloads/VBDep.zip

Also, bear in mind that this program won't handle composite gifs very well.. i.e if one of the frames is a background frame and the animation is to be played over the top.. or if one of the frames is an overlay. Backgrounds and overlays are rendered to their own frame - the additional frames are then rendered over the top.. or something like that.

Clootie
25-01-2007, 02:56 PM
You can look at http://www.clootie.ru/delphi/download_custom.html#D3Dex_GifBlender2
This examples doesn't use DelphiX, but still shows how to correctly display anuimated GIFs in Delphi in Direct3D (using GIF as a texture).

NecroDOME
26-01-2007, 12:58 AM
Then do an [ALT]+[PrintScreen] and past into Paint..
You could make a program that does that for you and save it to a bmp or jpg or whatever you want it to be :)