Sign in to follow this  
Followers 0
Heiko3110

Loosing transparency of GIF when emdedding by using "resources.au3"

5 posts in this topic

#1 ·  Posted (edited)

Hi there,

 

I'm quite new to autoIt and now try to build a simple GUI. I know different other coding languages, so the Script syntax is not too hard to understand for me. But right now I run into a problem with my little GUI:

 

I want to add a transparent GIF Image into the GUI. So far no Problem. I assigned a Color as transparent when exporting my GIF, used GUICtrlCreatePic(..) to add the Control and it is displayed nicely and transparent as it should. If my GUI is bigger in size than my Image I also have to set GUISetBkColor(..) to the same Color as the transparent GIF Color and again its displayed fine.

As a next step I tried to embed this GIF into a compiled EXE. So I installed full SCite Edit and Zedna's ressources.a3u. I used his example Code to add the Image to the Resource Section and then used _ResourceSetImageToCtrl(...) to set the resource for my Gui Image Control Element. But somehow, if I use this steps, the transparency of the GIF is lost. Instead of my chosen background color, it seems like always *black* is set at transparent color. I have some black elements in the GIF which now show up as transparent.

I dont know if the GIF is converted to some other type of data or if its a bug. I just want to know if this is common and/or if I can avoid this or set a other color than black as transparent when using the resources.au3.

 

Thank you in advance

Heiko

 

 

Edited by Heiko3110

Share this post


Link to post
Share on other sites



Can you post a small reproducer script incl. the GIF?


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#notrayicon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
#include "resources.au3"
; Farbe 0 muß als Transparant definiert werden (Erste Palettenfarbe und dann als BG Color für die Control)
#AutoIt3Wrapper_Res_File_Add=vnczugriff.gif, rt_rcdata, IMAGE_1

Local $out

$Intervall = IniRead("vncvisual.ini", "General", "CheckIntervall", "3000")
;ConsoleWrite($Intervall)

$gui = GUICreate("VNC_Overlay", 463, 100, -1, @DesktopHeight-100, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0x000000)

$pic = GUICtrlCreatePic("", 0, 0, 463, 100,-1, $GUI_WS_EX_PARENTDRAG)
_ResourceSetImageToCtrl($pic, "IMAGE_1") ; GIF als Control-Bild setzen


While 1

    $isvncactive=0
    $netstat = Run(@ComSpec & " /c netstat -n", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

    While 1
        $out &= StdoutRead($netstat)
        If @error Then ExitLoop
        Sleep(50)
    WEnd

    $isvncactive=StringRegExp ( $out, "TCP    \d+\.\d+\.\d+\.\d+:5354.+HERGESTELLT" ,0,1)

    If $isvncactive Then
        GUISetState(@SW_SHOW)
    Else
        GUISetState(@SW_HIDE)
    EndIf

    ProcessClose($netstat)
    ProcessWaitClose($netstat)
    StdioClose($netstat)
    $out=0
    Sleep($Intervall)

WEnd

 

Hello UEZ,,

this is the Code so far (Checking for active VNC Connection), very basic and simple, but working for me for now, I Know there is space for improvements (RegExp is not nicely defined,etc..)  :) . As for the GIF Problem, I don't have the original GIF anymore, I created the GIF again as workaround. It seems that if I use

_ResourceSetImageToCtrl

not the Color I "choose to be transparent" is set as transparent, but always Palette Color 0. So I created the GIF again, this time choose Palette Color 0 for the Transparent areas, set the Control Background to same color (0x000000) and its transparent again. I'm fine with this workaround, if I know it works like this, so no need for deep digging.

But maybe You have an Idea while this little Script eats up memory ? Not much, but about 1MB per day we have machines which wont be rebooted alot of times. I tried to add

ProcessClose($netstat)
ProcessWaitClose($netstat)
StdioClose($netstat)
$out=0

which I found in some other StdRead Example, but it doesnt seem to help

 

..and yes there is no way to exit the Script, but thats the Idea, our users shouldnt exit it.

 

Thank for your reply

Heiko

Edited by Heiko3110
.

Share this post


Link to post
Share on other sites

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hello UEZ,

 

I finally found some time to work in Little Project again. The Extended Version Show the same behaviour, but as I said, ist not that big of a deal since I know how to work around this :-)

 

Thanks for your replys.

Share this post


Link to post
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
Sign in to follow this  
Followers 0