Sign in to follow this  
Followers 0
eadthem

GIF trancparancy error

11 posts in this topic

#1 ·  Posted (edited)

when i atempt to put a gif in my autoit gui the trancparnacy will be white

in the gif the trancparent color is 0xff00ff or purple 1 of the 2 standard transparnecy colors (00ff00 green beaing the 2nd)

i have also tryed black and white for trancparancy colors with no luck all other windows apps show the gif with trancparancy but autoit.

the relevent gui code

;from guistart noskin

global $mainPh = guicreate( $vert , 550 , 685 , 50 , 50 , 0x80000000, 0x00080000 ) ;$WS_POPUP 0x80000000, $WS_EX_LAYERED 0x00080000

GUISetBkColor (0x01414d, $mainPh ); set to light background blue

;from favorits guidraw file

$servers[$i][14] = GUICtrlCreatePic("light.gif" , 120, $row, 140, 16)

;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); set background trancparaent no change commented or uncommented

;from guiloop / favoirts mode download server updates mode

;ran untell all are updated then server updates mode is disabled untell guiredraw is requested

if $servers[$id][2] > 12 then $servers[$id][2] = 13;ANTI HACKING PROTECTION

GUICtrlSetImage ( $servers[$id][14] , $status[$servers[$id][2]] & ".gif"); update based on status i am pulling the right gif files this i know

;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); set background trancparaent no change commented or uncommented

;from

the gif with trancparancy set in gimp checkerboard is 0xff00ff

Posted Image

the gif as shown in Slim Launchpad with the trancparancy error

Posted Image

Edited by eadthem

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

heres the picture i was using incase it helps

Posted Image

as you can see transparancy works fine in a webrouser or atleast firefox 1.5.x

Edited by eadthem

Share this post


Link to post
Share on other sites

i put my gif in the pic demo that has transparncy workeing and it still did not work

the file has been remade with 4 diffrant programs now gimp ms photoed photoshop serif photopro all of witch have made gif files that show transparent in a web brouser and any other windows app except for autoit my guess is that autoit dose not fully comply with the gif 89a standard or is using the gif 87a standard or maby not even complant with that ither

after opening my gif and the GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) gif file in my hex editor

i have found that both are using GIF89a standard 1989 standard but with diffrent transparancy structures if im reading that section right

http://www.martinreddy.net/gfx/2d/GIF89a.txt

and hexplorer are the 2 things i used

i will resubmit this as a bug tomarow if nobody else can find anything im doing wrong or a fix.

CODE

;----- example 1 ----

#include <GUIConstants.au3>

GUICreate("My GUI picture",350,300,-1,-1,$WS_SIZEBOX+$WS_SYSMENU) ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)

$n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",50,50, 200,50)

GUISetState ()

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

GUISetState ()

; resize the control

$n=GUICtrlSetPos($n,50,50,200,100)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

;----- example 2

#include <GUIConstants.au3>

$gui=GUICreate("test transparentpic", 200, 100)

$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)

GUICtrlCreatePic("C:\swgtools\launchpad\light.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)

GUISetState(@SW_SHOW,$gui)

HotKeySet("{ESC}", "main")

HotKeySet("{LEFT}", "left")

HotKeySet("{RIGHT}", "right")

HotKeySet("{DOWN}", "down")

HotKeySet("{UP}", "up")

$picPos = WinGetPos($pic)

$guiPos = WinGetPos($gui)

do

$msg = GUIGetMsg()

until $msg = $GUI_EVENT_CLOSE

Exit

Func main()

$guiPos = WinGetPos($gui)

WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10)

EndFunc

Func left ()

$picPos = WinGetPos($pic)

WinMove($pic,"",$picPos[0]-10,$picPos[1])

EndFunc

Func right()

$picPos = WinGetPos($pic)

WinMove($pic,"",$picPos[0]+10,$picPos[1])

EndFunc

Func down()

$picPos = WinGetPos($pic)

WinMove($pic,"",$picPos[0],$picPos[1]+10)

EndFunc

Func up()

$picPos = WinGetPos($pic)

WinMove($pic,"",$picPos[0],$picPos[1]-10)

EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

try changing your bitor statement to

$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) <------yours

$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD),$gui) <------change to this

and see if it helps. not sure if it will. i have been playing with tranparencies for the last week and think i have gotten a little bit of a grasp on them. btw, is the main gui moveable? you might try and move it around as well and see what affect that has on everything. if your child gets lost try playing with winsettrans, just stay away from 255 for the child gui :whistle:

tim

i'd test it for you but your pic link is broken

Edited by saturnknts

Share this post


Link to post
Share on other sites

try changing your bitor statement to

$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) <------yours

$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD),$gui) <------change to this

and see if it helps. not sure if it will. i have been playing with tranparencies for the last week and think i have gotten a little bit of a grasp on them. btw, is the main gui moveable? you might try and move it around as well and see what affect that has on everything. if your child gets lost try playing with winsettrans, just stay away from 255 for the child gui :whistle:

tim

i'd test it for you but your pic link is broken

i dont know why the pic keeps breaking

i do not use bitor i am a asm programmer so i do

global $mainPh = guicreate( $vert , 550 , 685 , 50 , 50 , 0x80000000, 0x00080000 ) ;$WS_POPUP 0x80000000, $WS_EX_LAYERED 0x00080000

the code you wer looking at is not my code it is the code that comes with the autoit helpfile witch works intermittanty

as for having child window behind the main one to suppor this thats rediculas to half to do so i am moving all 3000 lines over to vb as my first vb app its interstting but going well so far much better than making 2 windows to fix a bug in autoit

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Its not a bug it just doesn't work the way you think it should..

What ever colour is at pixel 1,1 is what is taken as the transparent colour.

So any area you want transparent you need to set as a colour like in my attached gif file.

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 370, 270, 193, 115)

$pic = GuiCreate("",135,13,20,20,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$Form1)
GuiCtrlCreatePic("light2.gif",0,0,135,13)
GUISetState(@SW_SHOW,$pic)

$pic2 = GuiCreate("",135,13,20,50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$Form1)
GuiCtrlCreatePic("light2.gif",0,0,135,13)
GUISetState(@SW_SHOW,$pic2)

$pic3 = GuiCreate("",135,13,20,80,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$Form1)
GuiCtrlCreatePic("light2.gif",0,0,135,13)
GUISetState(@SW_SHOW,$pic3)

GUISetState(@SW_SHOW,$Form1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by ChrisL

Share this post


Link to post
Share on other sites

Its not a bug it just doesn't work the way you think it should..

What ever colour is at pixel 1,1 is what is taken as the transparent colour.

k thanks

so it dose not support the gif standard 87a or 89a

this is a bug

insted it uses a diffrant method that can break gif standards for every other file

but owell it works and i can use this tell a fix is out and autoit meats the gif 89a standard

the 1989 gif standard the most uptodate version of gif witch is used today

http://www.martinreddy.net/gfx/2d/GIF89a.txt

Share this post


Link to post
Share on other sites

The help file says...

To have a transparent picture it is needed to use a .gif image with the transparency color set and to create the window with WS_EX_LAYERED extended style. See example 2.

Animated .gif are not supported.

Unfortunately it's not very clear what "the transparency color set" really means but it doesn't say make the transparent areas transparent it says set the transparent colour

Share this post


Link to post
Share on other sites

the easyist way to defne the transparent areas is to use msphotoed it has nothing to do with pixle 1,1

the color you choose will be put in the transparent varable that is the color number 0-255 gif supports true color ie 24bit but only a total of 256 colors set 0-256 in the color definition table witch is at the start of a gif image

if color 23 is purple and you choose that as your transaprent color the value 23 is set in the transparency varable

o btw autoit dose not support 1,1 pixle color transparancy any more reliably than the true gif standard 89a

also it makes the gui entirely transparant rather than only the object when it works. this is also a bug or a feature anyhow the option needs to be difineable as to

1 make gui transaprant when the gif 89a standard ses the image is

2 make just the object transparant where the gif 89a standard ses transparent color is

Share this post


Link to post
Share on other sites

Unless you must use a gif, try using a png file. Save your first example (GIMP Screen Shot) as "light.png" or whatever you want.

#include <GDIPlus.au3>
#include <GuiConstants.au3>

;MAKE YOUR GUI
$EXAMPLE_GUI = GUICreate("EXAMPLE GUI", 153, 51, -1 , -1)
GUISetState()

;GET PNG IMAGE
_GDIPlus_StartUp()
$YOUR_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\light.png")

;GUI TO DRAW PNG TO
$YOUR_GUI = _GDIPlus_GraphicsCreateFromHWND($EXAMPLE_GUI)

;YOU CAN USE THIS NEXT GDI FUNCTION TO DRAW (AND REDRAW) A CERTAIN AREA OF YOUR SOURCE IMAGE
$PNG_TEST_1 = _GDIPlus_GraphicsDrawImageRectRect ($YOUR_GUI, $YOUR_PNG, 0, 0, 133, 11, 10, 20, 133, 11)

While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

;UNLOAD GDI STUFF
_GDIPlus_GraphicsDispose($YOUR_PNG)
_GDIPlus_ImageDispose($YOUR_PNG)
_GDIPlus_ShutDown()

You can now just use true transparency in the PNG.


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