Delphi.TRichView. Работа с анимированными Gif изображениями

С “полпинка” не завелось, пришлось лезть в документацию TRichView. Если воспользоваться TRichViewActions по добавлению картинок, то gif формат там присутствует, но если загрузить анимированное gif изображение, то оно не движется.

21

Мне пришлось решать 2 задачи

Как заставить двигаться анимированную gif картинку в TRichViewEdit ?

Открываем официальный хэлп и читаем там следующее


Gif animation

To support animation, assign TCustomRichView.AnimationMode = rvaniOnFormat. // <<<<

The following units must be included in your projects:

RVGifAnimate for Anders Melander’s TGifImage;
RVJvGifAnimate for TJvGifImage from JEDI’s JVCL;
RVGifAnimate2007 for standard Delphi TGifImage (in Delphi 2007 or newer).

See also: animation in TRichView

То есть, всё что нам нужно сделать это выставить TCustomRichView.AnimationMode = rvaniOnFormat

Я сделал это в объектном инспекторе следующим образом

22

После этого, при добавлении анимированных Gif всё прекрасно работало!


Как заставить двигаться анимированную gif картинку в браузере, после сохранения в HTML формат ?

Ответ на второй вопрос также находится в официальном хэлпе


Exporting graphics in HTML

By default, all images are converted to JPEGs. This is obviously undesirable for formats like GIF and PNG.

You can specify which graphic classes must not be converted.

Use RVGraphicHandler.RegisterHTMLGraphicFormat procedure, for example:

uses RVGrHandler;

// call this before the first html export

RVGraphicHandler.RegisterHTMLGraphicFormat(TMyGifImage);

This registration affects only images of the given format. Other formats will be converted to JPEGs.

TRichView registers the following classes as HTML graphic formats automatically:

standard TPngImage (for Delphi 2009+);

standard TGifImage (for Delphi 2007+), if you include RVGifAnimate2007 unit in your project;

 


 

То есть, всё что нужно – это включить модуль RVGifAnimate2007 в проект!!!

This entry was posted in Delphi, TRichView. Bookmark the permalink.