Recent

Author Topic: TGIFViewer Assign TGIFViewer?  (Read 935 times)

local-vision

  • New Member
  • *
  • Posts: 42
TGIFViewer Assign TGIFViewer?
« on: March 22, 2021, 05:55:32 pm »
Using a single TGIFViewer component as the GIF viewer I would want to load a GIF file from a selection GIFs files.

Memory wise the best way to do this is to load the GIFs into memory instead of having to load them from disc each time I want a particular GIF.

With TBitMap I can do this:

Code: Pascal  [Select][+][-]
  1. BMP:=TBitMap.Create;
  2. BMP.LoadFromFile(FileName);
  3. Image1.Picture.Bitmap.Assign(BMP);
  4. Image1.Refresh;
  5.  

But with TGIFViewer I cannnot do this.

I cannot Assign a TGIFViewer to a TGIFViewer.

So how to load the GIFs into memory so that I might select and present one when needed? (note: load as resource wont work for me as the selection of GIFs depends on user files).

Might TPicture handel GIFs and allow transfer to the TGIFViewer?


Handoko

  • Hero Member
  • *****
  • Posts: 4229
  • My goal: build my own game engine using Lazarus
Re: TGIFViewer Assign TGIFViewer?
« Reply #1 on: March 22, 2021, 07:45:04 pm »
Maybe you can consider to create multiple TGIFViewer at runtime, set them on the same position and only enable the visibility one among them.

local-vision

  • New Member
  • *
  • Posts: 42
Re: TGIFViewer Assign TGIFViewer?
« Reply #2 on: March 22, 2021, 09:56:14 pm »
Yes, that would certainly be an option, And is actually not a bad idea.

Each GIF gets its own GIFViewer instance.

wp

  • Hero Member
  • *****
  • Posts: 8410
Re: TGIFViewer Assign TGIFViewer?
« Reply #3 on: March 22, 2021, 10:01:41 pm »
Of what TGifViewer are you talking? AFAIK, this is no component coming with Lazarus.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...


Handoko

  • Hero Member
  • *****
  • Posts: 4229
  • My goal: build my own game engine using Lazarus
Re: TGIFViewer Assign TGIFViewer?
« Reply #5 on: March 23, 2021, 02:51:24 am »
TGIFViewer can be installed using OPM.

local-vision

  • New Member
  • *
  • Posts: 42
Re: TGIFViewer Assign TGIFViewer?
« Reply #6 on: March 23, 2021, 05:42:38 pm »
Terima kasih again Handoko

Handoko

  • Hero Member
  • *****
  • Posts: 4229
  • My goal: build my own game engine using Lazarus
Re: TGIFViewer Assign TGIFViewer?
« Reply #7 on: March 23, 2021, 05:44:16 pm »
Sama-sama.

(When someone said thank you, we usually reply with: sama-sama)

bpranoto

  • Jr. Member
  • **
  • Posts: 86
Re: TGIFViewer Assign TGIFViewer?
« Reply #8 on: March 24, 2021, 05:39:31 pm »
Does TGIFViewer have LoadFromResource method? If it does, you can make your pictures as resources. When you need to change the picture just pick the gif resource with LoadFromResource method.

Handoko

  • Hero Member
  • *****
  • Posts: 4229
  • My goal: build my own game engine using Lazarus
Re: TGIFViewer Assign TGIFViewer?
« Reply #9 on: March 24, 2021, 06:05:15 pm »
Yes, it does. But:

note: load as resource wont work for me as the selection of GIFs depends on user files

bpranoto

  • Jr. Member
  • **
  • Posts: 86
Re: TGIFViewer Assign TGIFViewer?
« Reply #10 on: March 24, 2021, 06:31:04 pm »
oh ya, sorry aku kelewatan...

local-vision

  • New Member
  • *
  • Posts: 42
Re: TGIFViewer Assign TGIFViewer?
« Reply #11 on: March 24, 2021, 08:17:57 pm »
Still, I appreciate the input bpranoto!

Terima kasih as well
« Last Edit: March 24, 2021, 08:19:36 pm by local-vision »

 

TinyPortal © 2005-2018