微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在delphi 2009中创建一个gif动画文件?

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?

如何让它循环并设置速度?

解决方法

编写原始 TGIFImage的Anders Melander有以下 answer.

You need to add a “netscape Loop” extension block to the first frame of your GIF.
The loop block must be the first extension you define for the frame or else it will not work.

See the 07002 for an example of how to build an animated GIF.

以下是Animate demo代码摘录:

// 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;

你可以查看TGIFImage documentation here.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐