加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 09:21:58 所属栏目:大数据 来源:网络整理
导读: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'); 这只循环一次,
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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读