gif := TgifImage.Create;
gif.Width := 100;
gif.Height := 100;
gif.AnimationSpeed := 500;
gif.Animate := true;
gif.add(image1.Picture.Bitmap);
gif.add(image2.Picture.Bitmap);
gif.add(image3.Picture.Bitmap);
gif.SaveToFile('gif.gif');
这个只循环一次而且速度不是500?
如何让它循环并设置速度?
安德斯·梅兰德 (Anders Melander),原著作者TGIF图像 http://melander.dk/delphi/gifimage/,有以下answer http://melander.dk/delphi/gifimage/#faq_5.
您需要将“Netscape Loop”扩展块添加到 GIF 的第一帧。
循环块必须是您为框架定义的第一个扩展,否则它将不起作用。
See the 动画演示 http://melander.dk/articles/gifanimate/有关如何构建动画 GIF 的示例。
这是代码摘录动画演示 http://melander.dk/articles/gifanimate/:
// Add the source image to the animation
Result := GIF.Add(Source);
// Netscape Loop extension must be the first extension in the first frame!
if (GIF.Images.Count = 1) then
begin
LoopExt := TGIFAppExtNSLoop.Create(Result);
LoopExt.Loops := 0; // Number of loops (0 = forever)
end;
您可以查看TGIF图像文档在这里 http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/GIFImg_TGIFImage.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)