Jump to content

Icon transparency not working correctly


Mikeman27294
 Share

Recommended Posts

Hey everyone.

I am currently working on making a fancy menu, but the transparency on some of my icons are not working as I would wish to have it work.

Unfortunately, it will not allow me to upload the image of the error, so I will explain it.

I have 2 icons which I created in gimp. They are a white band and a grey band, the grey one being a little longer than the white one.

They both have the edged fade out gradually, at different levels on either end, like large feathered edges.

The problem is, that when they overlap, the grey icon (which is behind the white one) is hidden behind the white band, even where the white is fully transparent, so I have a nice white band, with soft edges on either end, and a crisp top, then at the ends, suddenly pops up a grey bit, where the white band ends. The idea is for the grey icon to act like a cursor (but only on the y axis) and it is meant to somewhat highlight the other icon, however, it doesnt work.

Does anybody know how to fix this?

Also, I will try and upload later.

Thanks for any help.

EDIT

Ok, now I can upload so here is a zip file with 2 png images inside it, one what they do look like, and one what they should look like. error.zip

Edited by Mikeman27294
Link to comment
Share on other sites

BUMP (For Michael)

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
Link to comment
Share on other sites

  • 2 weeks later...

I dunno how often it needs to be bumped to stay active but I really want help with this otherwise I have to completely start my design over which means days of hard work becomes pointless.

It is a lot easier to help if we have some code/script to work with rather that do a complete design ourselves. "Means days of hard work becomes pointless" 2 "" U?
Link to comment
Share on other sites

  • 5 months later...

Oh sorry, I havent checked this in ages. I am trying to use GDI Plus, because I have images which have transparency through to solid graditenrs and I was unable to use an icon for this.

Basically, I am trying to create a main menu for a program (it will be a seperate program made in a completely different language and wil be a completely different exe and so on).

#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

GUICreate("GameMenu",@DesktopWidth,@DesktopHeight, 0, 0, 0x80000000)
_GDIPlus_Startup ()

Global  $Background         = _GDIPlus_ImageLoadFromFile(@WorkingDir & "Resources\MMBackground.jpg")

Global  $Option             = GUICtrlCreatePic("Resources\MMOption1.jpg", 0, @DesktopHeight*0.25, (@DesktopHeight/9)*16, @DesktopHeight/2)
Global  $crrntopt           = "1"
Global  $SPOption           = _GDIPlus_ImageLoadFromFile(@WorkingDir&"\Resources\MMoption1.png")


$sCLSID = _GDIPlus_EncodersGetCLSID ("PNG")
GUICtrlSetState($Background, $GUI_SHOW)
GUICtrlSetState($Option, $GUI_SHOW)
GUISetState()
While 1
    If (MouseGetPos(1) < ((@DesktopHeight/2)-(@DesktopHeight/8))) Then
        If $crrntopt="1" Then
            $crrntopt="1"
        Else
            GUICtrlSetImage($Option, @WorkingDir & "Resources\MMOption1.jpg")
            $crrntopt="1"
        EndIf
    ElseIf (MouseGetPos(1) >= (@DesktopHeight/2)-(@DesktopHeight/8)) And (MouseGetPos(1) < (@DesktopHeight/2)) Then
        If $crrntopt="2" Then
            $crrntopt="2"
        Else
            GUICtrlSetImage($Option, @WorkingDir & "Resources\MMOption2.jpg")
            $crrntopt="2"
        EndIf
    ElseIf (MouseGetPos(1) >= (@DesktopHeight/2)) And (MouseGetPos(1) < ((@DesktopHeight/2)+(@DesktopHeight/8))) Then
        If $crrntopt = "3" Then
            $crrntopt="3"
        Else
            GUICtrlSetImage($Option, @WorkingDir & "Resources\MMOption3.jpg")
            $crrntopt="3"
        EndIf
    ElseIf (MouseGetPos(1) >= ((@DesktopHeight/2)+(@DesktopHeight/8))) Then
        If $crrntopt="4" Then
            $crrntopt="4"
        Else
            GUICtrlSetImage($Option, @WorkingDir & "Resources\MMOption4.jpg")
            $crrntopt="4"
        EndIf
    EndIf

    Switch GUIGetMsg()
        Case $Option
            if (MouseGetPos(1) < ((@DesktopHeight/2)-(@DesktopHeight/8))) Then
                Run(@WorkingDir & "\singleplayer\singleplayer.exe")
;               Exit
;                   MsgBox("Single Player", "Single Player", "Single Player Selected")
            ElseIf ((MouseGetPos(1) >= (@DesktopHeight/2)-(@DesktopHeight/8)) And (MouseGetPos(1) < (@DesktopHeight/2))) Then
                Run(@WorkingDir & "\singleplayer\multiplayer.exe")
;               Exit
;               MsgBox("Multiplayer", "Multiplayer", "Multiplayer Selected")
            ElseIf ((MouseGetPos(1) >= (@DesktopHeight/2)) And (MouseGetPos(1) < ((@DesktopHeight/2)+(@DesktopHeight/8)))) Then
                Run(@WorkingDir & "\options.exe")
;               Exit
;               MsgBox("Options", "Options", "Options Selected")
            ElseIf (MouseGetPos(1) >= ((@DesktopHeight/2)+(@DesktopHeight/8))) Then
;               Exit
            EndIf
;           consolewrite(8)
        Case -3
            _GDIPlus_Shutdown()
            Exit
    EndSwitch
WEnd

Func _center($x)
    $bgsub      = $x*(@DesktopHeight - _GDIPlus_ImageGetWidth($Background))
    Return $bgsub
EndFunc

There is the code. It probably looks silly because I dont really know what is required for GDI Plus but I was hoping now that somebody could help me out with it.

Thanks, everyone.

And thanks for pointing out about the "G word" guys.

Edited by Mikeman27294
Link to comment
Share on other sites

I dont understand you well(i´m read in native spanish) can you describe a little better. and i really need some pics to see the behavior..., try uploading here or imageshak or something..

PD: Try to avoid the G word :huh2:

Edited by monoscout999
Link to comment
Share on other sites

  • 3 weeks later...

It's alright, it is working now.

By G word, did you mean graphic? if you did then that means image. If you meant GIF, then it is a file format for images, and if you meant GUI, then it stands for Graphical User Intrface.

Edited by Mikeman27294
Link to comment
Share on other sites

oh. Hahaha. That is a good point. All it is is just a menu with 5 images, four transparent and 1 the background. the first 3 run executables, and the last one just quits the program. That is quite easy (I am much more experiencd now. I'm no proffessional, but I can do it perfectly fine.), but I only need to get image transparency to work, which will also help with more important scripts that I am working on. But thanks for pointing that one out to me mate.

Link to comment
Share on other sites

  • 3 years later...

Hi Guys,

this tread may be a little old but i still need to ask. has been google for hours.

i m building my own backup software for my data. in the GUI window an icon is place but i cannot get the background of the icon goes transparent. has this problem been solve?

 
my code:
Func Main()
Local $msg
 
$Main = GUICreate("Smart Sync",450,360)
;GUISetBkColor(0xFFFFFF)
GUICtrlSetDefBkColor($GUI_BKCOLOR_TRANSPARENT)
 
GUICtrlCreatePic(@ScriptDir&"ImageBlue White.bmp",0,0,450,400)
GUICtrlSetState(-1,$GUI_DISABLE)
 
GUICtrlCreateLabel("My Computer"&@CRLF&@ComputerName,50,35,100,60,$SS_CENTER);,BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1,13,500)
GUICtrlSetColor(-1, 0x974807)
 
$HomeDrive = GUICtrlCreateProgress(60,75,80,200,BitOR($PBS_VERTICAL,$PBS_SMOOTH))
$ProgressLabel1 = GUICtrlCreateLabel("",60,75,80,200,BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetBkColor($ProgressLabel1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($ProgressLabel1,13,500)
GUICtrlSetColor($ProgressLabel1, 0x974807)
 
$Free = DriveSpaceFree($SourceDir)
$Total = DriveSpaceTotal($SourceDir)
$Size = 100-(($Free/$Total)*100)
GUICtrlSetData($HomeDrive,$Size)
GUICtrlSetData($ProgressLabel1,Round($Size))
 
$SourceBtn = GUICtrlCreateButton("Browse",50,285,100,30)
 
$BackUpLabel = GUICtrlCreateLabel("My Backup Drive"&@CRLF&$BackupDisk,280,35,140,60,$SS_CENTER);,BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1,13,500)
GUICtrlSetColor(-1, 0x974807)
 
$BackDrive = GUICtrlCreateProgress(310, 75, 80, 200,BitOR($PBS_VERTICAL,$PBS_SMOOTH))
$ProgressLabel2 = GUICtrlCreateLabel("",310,75,80,200,BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetBkColor($ProgressLabel2, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($ProgressLabel2,13,500)
GUICtrlSetColor($ProgressLabel2, 0x974807)
 
$Free = DriveSpaceFree($BackupDisk)
$Total = DriveSpaceTotal($BackupDisk)
$Size = 100-(($Free/$Total)*100)
GUICtrlSetData($BackDrive,$Size)
 
$DestBtn = GUICtrlCreateButton("Browse",300,285,100,30)
 
$SyncBtn = GUICtrlCreateIcon(@ScriptDir&"ImageSync_Green.ico",-1,181,131,88,88,BitOR($GUI_SS_DEFAULT_ICON,$SS_CENTERIMAGE))
;$SyncBtn = GUICtrlCreatePic(@ScriptDir&"ImageSync_Green.png",-1,181,131,88,88,$GUI_SS_DEFAULT_ICON)
 
;GUICtrlSetBkColor($SyncBtn,$GUI_BKCOLOR_TRANSPARENT)
 
;GUIRegisterMsg(0x000F, "WM_PAINT")
 
$Setting = TrayCreateItem("Setting")
$About = TrayCreateItem("About")
TrayCreateItem("")
$Exit = TrayCreateItem("Exit")
 
TraySetState()
GUISetState()
 
$List = _DriveList()
 
; Run the GUI until the dialog is closed
While 1
Switch TrayGetMsg()
Case $Exit
ExitLoop
Case $About
MsgBox(64,"About","Smart Sync)"&@LF&@LF&"Software Ver. "&$Version&@LF& _
"Copyright © 2013 Alan Kam"&@LF&"AlTech Soft",5)
Case $Setting
GUISetState(@SW_SHOW,$Main)
EndSwitch
 
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
;GUISetState(@SW_HIDE,$Main)
ExitLoop
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_MINIMIZE,$Main)
Case $SyncBtn
GUICtrlSetImage($SyncBtn,@ScriptDir&"ImageSync_Silver.ico")
If StringCompare($DriveRtv[0],"Not Found") <> 0 Then
_FileProcess($SourceDir,$DriveRtv[0]&$DriveRtv[1]&"")
EndIf
Case $SourceBtn
 
Case $DestBtn
 
EndSwitch
 
Switch _DriveList()
Case $List
;MsgBox(0,"","New Drive")
Case Else
$List = _DriveList()
If $List <> $New Then
$New = _DriveList()
;MsgBox(0,"","New Drive")
GUISetState(@SW_SHOW,$Main)
$DriveRtv = _BackupDriveSearch()
$BackupDisk = $DriveRtv[0]
GUICtrlSetData($BackUpLabel,"My Backup Drive"&@CRLF&$BackupDisk)
GUICtrlSetData($DestBtn,$BackupDisk)
$Free = DriveSpaceFree($BackupDisk)
$Total = DriveSpaceTotal($BackupDisk)
$Size = 100-(($Free/$Total)*100)
GUICtrlSetData($BackDrive,$Size)
EndIf
EndSwitch
WEnd
GUIDelete()
EndFunc
 

 

Edited by alankam58
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...