Page 1 of 1

[done]GetDelayTimeImageFrame() [GIFImageDecoder]

Posted: Sat Jan 28, 2017 3:38 pm
by ts-soft
The native "DelayTime" should available for using/run in native Framerate.

@Fred
Is available in structure of your lib!

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Posted: Sun Jan 29, 2017 8:41 am
by netmaestro
Excellent request! Reading an animated gif and splitting the frames is great, but of little use without the delays.

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Posted: Tue Feb 21, 2017 11:08 am
by User_Russian
Yes, a very useful feature.
For example, here is a image of CodeArchiv.

Image

PB animates with the wrong speed.

Code: Select all

InitNetwork()
UseGIFImageDecoder()

*Buffer = ReceiveHTTPMemory("http://www.purearea.net/pb/CodeArchiv/Graphics/Gfx/anim_surprize.gif")
If *Buffer And CatchImage(0, *Buffer, MemorySize(*Buffer))

  OpenWindow(0, 100, 100, ImageWidth(0), ImageHeight(0), "")
  
  CanvasGadget(0, 0, 0, ImageWidth(0), ImageHeight(0))
  AddWindowTimer(0, 1, 150)
  
  Repeat
    Event = WaitWindowEvent()
    
    If Event = #PB_Event_Timer
      SetImageFrame(0, Frame)
      
      Frame+1
      If Frame >= ImageFrameCount(0) : Frame = 0 : EndIf
      
      If StartDrawing(CanvasOutput(0))
        DrawImage(ImageID(0), 0, 0)
        StopDrawing()
      EndIf
    EndIf
    
  Until Event = #PB_Event_CloseWindow
Else
  Debug "Impossible to load the file: " + Filename$
EndIf

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Posted: Tue Feb 21, 2017 6:05 pm
by davido
+1

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Posted: Tue Feb 21, 2017 6:07 pm
by ts-soft