[done]GetDelayTimeImageFrame() [GIFImageDecoder]

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

[done]GetDelayTimeImageFrame() [GIFImageDecoder]

Post by ts-soft »

The native "DelayTime" should available for using/run in native Framerate.

@Fred
Is available in structure of your lib!
Last edited by ts-soft on Wed Feb 22, 2017 10:18 am, edited 1 time in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Post by netmaestro »

Excellent request! Reading an animated gif and splitting the frames is great, but of little use without the delays.
BERESHEIT
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Post 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
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Post by davido »

+1
DE AA EB
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: GetDelayTimeImageFrame() [GIFImageDecoder]

Post by ts-soft »

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply