Jump to content

_GUIResourcePic.au3 (UDF) - Supports GIF animation using GDI+


JScript
 Share

Recommended Posts

13 minutes ago, Nine said:

@Qwerty212 You should try my GIF animation UDF.  See my signature.

Cheers, I'm going to give it a try. Thanks for sharing.

I've also found a workaround for my problem with current JScript udf:

Instead of deleting the pictures, if you release them and then you hide them, then it works as expected.

#include <.\Data\_GUIResourcePic.au3>
Global $arrayImages[4] = [Null, Null, Null, Null]
Global $index = 1
Global $hGUI = GUICreate("TEST", 900, 850, -1, -1)
Global $next = GUICtrlCreateButton("NEXT", 850, 770, 50, 30)
Global $label = GUICtrlCreateLabel($index, 850, 0, 50, 30, 0x01)
$arrayImages[$index] = _GUICtrlPic_Create(@ScriptDir & "\" & $index & ".gif", 0, 0, 800, 800) ;, $GIS_ASPECTRATIOFIX)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $next
            _ShowNextGIF($index)
    EndSwitch
WEnd

Func _ShowNextGIF($i)
    _GUICtrlPic_Release($arrayImages[$i])

    _GUICtrlPic_SetState($arrayImages[$i], $GUI_HIDE)

    $arrayImages[$i] = Null

    Sleep(5)

    $i = $i + 1 ; Increase the index of the image to show

    If $i > 3 Then $i = 1 ; If the index is bigger than the number of images that we want to show, we do reset the count

    GUICtrlSetData($label, $i)

    $arrayImages[$i] = _GUICtrlPic_Create(@ScriptDir & "\" & $i & ".gif", 0, 0, 800 / $i, 800 / $i) ;, $GIS_ASPECTRATIOFIX)

    $index = $i
EndFunc   ;==>_ShowNextGIF

 

Greets from Barcelona

Link to comment
Share on other sites

I'm still having some issues with this udf when using a large number of gifs (I'm doing a program that is going to allow users to perform some task in front of a CNC machine and I want to show them some gifs explaining the procedures that they must follow in order to make easier their work.

 

@Nine's udf is great, but I need to show the gifs resized to fit inside a variable area, as I don't know for sure the screen resolution of the computers where the program is going to be executed.

gui.png

 

I've tried to do the HIDE and Release trick from my post above:

_GUICtrlPic_Release(Images[$i])

_GUICtrlPic_SetState($Images[$i], $GUI_HIDE)

I've even tried to move the controls outside of the screen

(GuiCtrlSetPos($Images[$i], @desktopwidth + 5000))

But after some gifs, the bumping problem comes again (althoug later than before, there has been an improvement: it failed on the 6th-7th gif and now it fails on the 13th-14th).

Any ideas, hints or clues would be truly appreciated.

 

Greets from Barcelona

 

Link to comment
Share on other sites

47 minutes ago, Chimp said:

...have you already tried this other udf too?

https://www.autoitscript.com/forum/topic/96132-gif-animation/

Uops, I discarted it for being older that the other two udf's... I've seen your example to read directly the gifs from a decoded Base64 and it looks amazing.

 

Thanks for the link, I've to test it to see if it solves my problems.

 

Cheers

Link to comment
Share on other sites

26 minutes ago, Qwerty212 said:

Uops, I discarted it for being older that the other two udf's..

... it is not always a good idea to discard what is older ... ;)
nothing against the new udf of course.
however when something is signed by @trancexx you can rest assured that you will hardly have any problems.
p.s.
unfortunately that beautiful girl hasn't been seen around for a while lately ... ... :(

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

15 minutes ago, Chimp said:

... it is not always a good idea to discard what is older ... ;)
nothing against the new udf of course.
however when something is signed by @trancexx you can rest assured that you will hardly have any problems.
p.s.
unfortunately that beautiful girl hasn't been seen around for a while lately ... ... :(

All the examples do work fine but in my script there's no gif showed at all. 

Although, I have discovered the binary-to-au3 kompressor by wakillon and also your example about inserting the gifs as binary in a script.

I will have to keep looking for ways of showing the gifs without the bumping.

(My code is huge to post it here, like 10.000 lines, but the bumping effect is the same as the example that I've posted above).

Thanks again for the help

Link to comment
Share on other sites

@Qwerty212 Did you think of creating like 3-4 resized versions of each GIF, so it can fit the area of your choice ?  It takes only a few seconds to create a new resized GIF.  Then depending of the size of the screen you can pick the appropriate GIF.

Link to comment
Share on other sites

5 hours ago, Qwerty212 said:

All the examples do work fine but in my script there's no gif showed at all.

I simply edited your Test.au3 script to fit @trancexx's GIFAnimation.au3 udf and it seems like no problem is occurring.

; #include <.\Data\_GUIResourcePic.au3>
#include ".\Data\GIFAnimation.au3"
Global $arrayImages[4] = [Null, Null, Null, Null]
Global $index = 1
Global $hGUI = GUICreate("TEST", 800, 600, -1, -1)
Global $next = GUICtrlCreateButton("NEXT", 750, 570, 50, 30)
; $arrayImages[$index] = _GUICtrlPic_Create(@ScriptDir & "\" & $index & ".gif", 0, 0, 750, 600) ;, $GIS_ASPECTRATIOFIX)
$arrayImages[$index] = _GUICtrlCreateGIF(@ScriptDir & "\" & $index & ".gif", '', 0, 0, 750, 600) ;, $GIS_ASPECTRATIOFIX)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case -3 ; $GUI_EVENT_CLOSE
            ExitLoop

        Case $next
            _ShowNextGIF($index)
    EndSwitch
WEnd

Func _ShowNextGIF($i)
    ; _GUICtrlPic_Delete($arrayImages[$i]) ; Delete the previous image
    _GIF_DeleteGIF($arrayImages[$i])

    $arrayImages[$i] = Null

    Sleep(5)

    $i = $i + 1 ; Increase the index of the image to show

    If $i > 3 Then $i = 1 ; If the index is bigger than the number of images that we want to show, we do reset the count

    $arrayImages[$i] = _GUICtrlCreateGIF(@ScriptDir & "\" & $i & ".gif", '', 0, 0, 750, 600) ;, $GIS_ASPECTRATIOFIX)

    $index = $i
EndFunc   ;==>_ShowNextGIF

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...