Created
March 2, 2013 09:27
-
-
Save grey-code/5070286 to your computer and use it in GitHub Desktop.
AutoHotkey: SC_CutWindow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; I added a feather field instead of a new func. | |
Gui, Show, w500 h500 | |
; By: Sjc1000 | |
; http://www.autohotkey.com/board/topic/90132-class-sc-cutwindow-easily-cut-windows-into-shapes/ | |
Class SC_CutWindow | |
{ | |
Square( Window_Name, X1, Y1, X2, Y2, Feather, Invert) | |
{ If ( X1 > X2 || Y1 > Y2 ) | |
Return 1 | |
WinGetPos, , , Width, Height, %Window_Name% | |
If Invert = 1 | |
WinSet, Region, % "R" Feather "-" Feather " W" X2 " H" Y2 " " X1 "-" Y1 " " X2 "-" Y1 " " X2 "-" Y2 " " X1 "-" Y2 " " X1 "-" Y1 , %Window_Name% | |
else | |
WinSet, Region, % " 0-0 " Width "-0 " Width "-" Height " 0-" Height " 0-0 " X1 "-" Y1 " " X2 "-" Y1 " " X2 "-" Y2 " " X1 "-" Y2 " " X1 "-" Y1, %Window_Name% | |
Return 0 | |
} | |
Triangle( Window_Name, X1, Y1, X2, Y2, X3, Y3, Feather, Invert ) | |
{ WinGetPos, , , Width, Height, %Window_Name% | |
If Invert = 1 | |
WinSet, Region, R%Feather%-%Feather% W%X2% H%Y2% %X1%-%Y1% %X2%-%Y2% %X3%-%Y3%, %Window_Name% | |
else | |
WinSet, region, 0-0 %Width%-0 %Width%-%Height% 0-%Height% 0-0 %X1%-%Y1% %X2%-%Y2% %X3%-%Y3%, %Window_Name% | |
Return 0 | |
} | |
Polygon( Window_Name, Positions, Feather, Invert ) | |
{ WinGetPos, , , Width, Height, %Window_Name% | |
Loop, Parse, Positions, | | |
Whole .= A_LoopField " " | |
Whole .= "R" Feather "-" Feather " W" X2 " H" Y2 | |
StringSplit, Pos, Positions, | | |
If Invert = 0 | |
Whole := " 0-0 " Width "-0 " Width "-" Height " 0-" Height " 0-0 " Whole Pos1 "-" Pos2 | |
WinSet, Region, %Whole%, %Window_name% | |
Return 0 | |
} | |
Restore( Window_Name ) | |
{ WinSet, Region, , %Window_Name% | |
Return 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment