-
Notifications
You must be signed in to change notification settings - Fork 71
/
class_CutWindowSquare.ahk
47 lines (46 loc) · 1.56 KB
/
class_CutWindowSquare.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Example
#NoEnv
Gui, Show, w700 h500, Test
Sleep 2000
SC_CutWindow.Square("Test", 200, 200, 880, 659, 0 )
Sleep 3000
SC_CutWindow.Square("Test", 200, 200, 881, 660, 0 )
Sleep 3000
SC_CutWindow.Restore("Test")
Return
*/
Class SC_CutWindow
{
Square( Window_Name, X1, Y1, X2, Y2, Invert)
{ If ( X1 > X2 || Y1 > Y2 )
Return 1
WinGetPos, , , Width, Height, %Window_Name%
If Invert = 1
WinSet, Region, % 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, Invert )
{ WinGetPos, , , Width, Height, %Window_Name%
If Invert = 1
WinSet, Region, %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, Invert )
{ WinGetPos, , , Width, Height, %Window_Name%
Loop, Parse, Positions, |
Whole .= A_LoopField " "
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
}
}