Page 3 of 3

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Fri Sep 04, 2015 10:46 pm
by Andre
Nice, thank you for the possibility of an easy and proper GIF display in PB! :D

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Mon Sep 07, 2015 12:17 pm
by Kwai chang caine
Image
You are wonderfull !!

1/ My sheep leaps now like a gazelle, with the value 100 :mrgreen:

2/ The last GIF not crush the JPG thanks to the two parameters.
I have replace

Code: Select all

KillThread(*PtrAnimate\ThreadID)
by

Code: Select all

*PtrAnimate\Quit = #True
*PtrAnimate\Target = 0
Just i allowed myself to massacre your work by adding :oops:

Code: Select all

If IsGadget(Target)
      SetGadgetState(Target, Image)
     EndIf 
Because i have sometime red line..



And nooooowwwww...ladies and gentlemaaaaaaaan !!!!

All works fiiiine !!!

Image

Before you are my champion of HieroGlyph, now you are also my champion of HieroGIF :D

Thanks a lot for the mountain of work you have do, for all the littles animated and sympathetics personages 8) 8)
Image

I wish you a very good animated day !!!

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Mon Sep 07, 2015 1:03 pm
by wilbert
Glad to help out :wink:

You keep amazing me with the amount of animated gifs you have :shock:
Kwai chang caine wrote:Just i allowed myself to massacre your work by adding :oops:

Code: Select all

If IsGadget(Target)
      SetGadgetState(Target, Image)
     EndIf 
I didn't get such error myself but an extra check does no harm so I added the gadget check to the module code in the first post.

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Mon Sep 07, 2015 1:43 pm
by Kwai chang caine
You keep amazing me with the amount of animated gifs you have
It's my passion :D
Since the begining, at the moment of i see my first, i fall in love immediately ahead his beautiful body :mrgreen:
Image
The GIF are nices, funny and tireless....like KCC :lol:

And with the come of the 3D
Image
this time i found them
ImageSPLENDID !!!

Now...you are also in my collection...one GIF more :mrgreen:
Image
I didn't get such error myself but an extra check does no harm so I added the gadget check to the module code in the first post.
It's when i jump between JPG and GIF in the same imageGadget, perhaps an error of me :oops:

Thanks to you...i have modify my little manager of GIF linker, who not works very well with WebGadget and ListIcon, to replace by WebGadget and ImageGadget
And all my babies can come to home, for be ready for the futur thread of forum 8)

Before selected GIF

Image


After selected GIF

Image

Have a very good day GIFMASTER 8)

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Fri Aug 05, 2022 5:09 pm
by J. Baker
Resizable Gifs by Gadget size no matter the DPI. :D
  • "Enable Dpi aware executable" in the compiler options.
  • Add to line 369, "DPI.f = DesktopResolutionX()" in Module.
  • Add to line 463, "ResizeImage(\image, GadgetWidth(*Animation\Target) * DPI, GadgetHeight(*Animation\Target) * DPI)" in Module.

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Fri Aug 05, 2022 6:56 pm
by mk-soft
Short information.

The decoder has been integrated into PB for a long time

Code: Select all

UseGIFImageDecoder()
Update pb example

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - ImagePlugin GIF Viewer example file
;
;    (c) Fantaisie Software
;    
;    Modify example by mk-soft - Upscale gif images
;
; ------------------------------------------------------------
;

; Enable the GIF decoder
UseGIFImageDecoder()

; Loading a GIF file
If LoadImage(0, #PB_Compiler_Home+"Examples/Sources/Data/PureBasicLogo.gif")
  
  dx = ImageWidth(0)
  dy = ImageHeight(0)
  
  OpenWindow(0, 100, 100, dx, dy, "GIF viewer")
  
  CanvasGadget(0, 0, 0, dx, dy)
  
  ; Upscale
  dx = DesktopScaledX(dx)
  dy = DesktopScaledY(dy)
  
  ; Add a timer to animate the GIF, starts immediately to display the first frame witout delay
  AddWindowTimer(0, 0, 1)
 
  Repeat
    Event = WaitWindowEvent()
   
    If Event = #PB_Event_Timer
      SetImageFrame(0, Frame)
     
      ; Each GIF frame can have its own delay, so change the timer accordingly
      ;
      RemoveWindowTimer(0, 0)
      AddWindowTimer(0, 0, GetImageFrameDelay(0))
     
      If StartDrawing(CanvasOutput(0))
        DrawImage(ImageID(0), 0, 0, dx, dy)
        StopDrawing()
      EndIf
      
      ; Go to next frame
      Frame+1
      If Frame >= ImageFrameCount(0) ; Cycle back to first frame, to play in loop
        Frame = 0
      EndIf
    EndIf
   
  Until Event = #PB_Event_CloseWindow
Else
  Debug "Impossible to load the file: " + Filename$
EndIf

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Fri Aug 05, 2022 7:42 pm
by jacdelad
Is it exactly this decoder or a different one?

Re: GifDecoder module (All OS, single frame & animated gifs)

Posted: Fri Aug 05, 2022 9:36 pm
by J. Baker
Wilberts code runs Gifs with High DPI much faster and smooth. PureBasic's method stutters here with High DPI. Debugger is off for both, of course.

EDIT: It's the CanvasGadget() that is slow. Rendering on WindowOutput() is much better.