Gui: Making a specific color fully transparent? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Gui: Making a specific color fully transparent?

21 Jul 2018, 17:24

Hi friends,

I created a Gui which consists of a picture that doesn't perform any action.
By doing some researches I was able to find out how to do:
- transparency
- clicking through

The code is this:

Code: Select all

F1::
x := (A_ScreenWidth/2)-(Width/2)
y := (A_ScreenHeight/2)-(Height/2)
Gui +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop
WinSet, Transparent, 120
Gui Show, w1000 h1000
Gui, Add, Picture, x0 y0 w1000 h1000, %A_ScriptDir%\pics\Earth.png
return

Esc::
ExitApp
When starting the gui, I can click through it and it looks like this:
Image

My question:
Is it possible that the pink color (0xFF87FF) has a full transparency
while the rest stays at 120?
This is just an example, yet it would be very useful to me
if I know how to filter out colors/making them fully transparent.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Gui: Making a specific color fully transparent?

21 Jul 2018, 18:07

I dont have an answer but the edges look very good on the globe
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Gui: Making a specific color fully transparent?

21 Jul 2018, 18:19

Well I just did it with IrfanView within seconds - nothing special.
As said, it was just a quick test.
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Gui: Making a specific color fully transparent?  Topic is solved

21 Jul 2018, 22:28

Use: WinSet
TransColor
Makes all pixels of the chosen color invisible inside the target window.

WinSet, TransColor, Color , WinTitle, WinText, ExcludeTitle, ExcludeText
HTH
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Gui: Making a specific color fully transparent?

23 Jul 2018, 08:57

Thanks!
This one did the job:

Code: Select all

F1::
x := (A_ScreenWidth/2)-(Width/2)
y := (A_ScreenHeight/2)-(Height/2)
Gui +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop
WinSet, TransColor, 0xFF00FF 120

return
Edit:
By the way, I've noticed it's more clever to swap these lines:

Code: Select all

Gui Show, w1000 h1000
Gui, Add, Picture, x0 y0 w1000 h1000, %A_ScriptDir%\pics\Earth.png

Code: Select all

Gui, Add, Picture, x0 y0 w1000 h1000, %A_ScriptDir%\pics\Earth.png
Gui Show, w1000 h1000
By using method 2, you won't see a 1000x1000 square first, you'll directly see the picture.
Makes a better impression.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Gui: Making a specific color fully transparent?

24 Jul 2018, 06:29

I have to ask again:
Is there also a way to do the same not just for 1 color but for a range of colors?
I mean pink is not just pink, there are variations.

Or probably two colors.
The first color is 0xFF00FF, the second is: 0xFC62FD (it's pretty similar).

According to this 7 year old thread it's not possible?
https://autohotkey.com/board/topic/6863 ... anscolors/
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Gui: Making a specific color fully transparent?

24 Jul 2018, 14:18

You could use gdip and cut out the circle.
https://autohotkey.com/board/topic/1034 ... -aliasing/

Preprocess the image and use your current technique or do it on the fly and use the method in the link.
GDIP can do a lot if you are going to mess with graphics its worth learning to use.


HTH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 297 guests