RVGif.pas
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:1k
源码类别:

RichEdit

开发平台:

Delphi

  1. unit RVGif;
  2. interface
  3. {.$DEFINE USEGIFIMAGE}
  4. // Use this define if you want to enable Gif support
  5. // with Anders Melander's TGifImage
  6. // http://www.torry.net/vcl/graphics/gif/gifimage.exe (original)
  7. // http://www.trichview.com/resources/thirdparty/gifimage.zip (update)
  8. implementation
  9. {$IFDEF USEGIFIMAGE}
  10. uses Classes, GifImage, Graphics, RVFuncs;
  11. procedure MyAfterImportGraphic(Graphic: TGraphic);
  12. begin
  13.   if Graphic is TGIFImage then
  14.     TGIFImage(Graphic).DrawOptions := TGIFImage(Graphic).DrawOptions-[goAnimate]+[goTransparent];
  15. end;
  16. {------------------------------------------------------------------------------}
  17. // Required for Delphi 2-5/C++Builder 1-5
  18. // I do not know how to convert this function to C++ code
  19. function MyCreateGraphics(GraphicClass: TGraphicClass): TGraphic;
  20. begin
  21.   if GraphicClass=TGIFImage then  begin
  22.     Result := TGIFImage.Create;
  23.     end
  24.   else
  25.     Result := GraphicClass.Create;
  26. end;
  27. {------------------------------------------------------------------------------}
  28. initialization
  29.   TPicture.RegisterFileFormat('gif','Gif Image',TGifImage);
  30.   RV_CreateGraphics := MyCreateGraphics;
  31.   RV_AfterImportGraphic := MyAfterImportGraphic;
  32.   RegisterClass(TGifImage);
  33. {$ENDIF}
  34. end.