-
Notifications
You must be signed in to change notification settings - Fork 1
/
3 Color Transform.ahk
76 lines (68 loc) · 1.33 KB
/
3 Color Transform.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
SetBatchlines,-1
#SingleInstance,Force
Gui,add,picture,hwndhwnd,Test.jpg
If !Gdip_startup()
Msgbox % "GDI+ lib wurde leider nicht gefunden"
LoadedImage:=Gdip_CreateBitmapFromFile("Test.jpg")
HDC:=GetDC(hwnd+0)
G:=Gdip_GraphicsFromHDC(HDC)
OnMessage(0xF,"WM_Paint")
W:=Gdip_GetImageWidth(LoadedImage)
H:=Gdip_GetImageHeight(LoadedImage)
Loop 5
{
X:=A_Index
Loop 5
Gui,add,Edit,% "x" . (X*40-20) . " y" . (H-16+24*A_Index) . " w30 h20 vMatrix" . X . A_Index,% (X=A_Index)
}
oldmatrix:="1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|1"
Gui,Add,Button,x19 w192 h30 gPress,Test
Gui,Show
return
Press:
oldmatrix:=CreateMatrix()
Gdip_GraphicsClear(G, 0)
Gdip_DrawImage(G, LoadedImage, "", "", "", "", "", "", "", "", oldmatrix)
return
F7::
MatrixToGui(oldmatrix:=Clipboard)
GoSub,Press
return
F8::
Clipboard:=oldmatrix
return
GuiClose:
ExitApp
WM_Paint()
{
global
Critical
Gdip_DrawImage(G, LoadedImage, "", "", "", "", "", "", "", "", oldmatrix)
}
CreateMatrix()
{
Global
Gui,Submit,NoHide
ret:=""
Loop 5
{
X:=A_Index
Loop 5
ret.= Matrix%X%%A_Index% . "|"
}
StringTrimRight,ret,ret,1
return ret
}
MatrixToGui(Matrix)
{
nr:=1
Loop 5
{
X:=A_Index
Loop 5
{
nr:=RegexMatch(Matrix,"(?:[^\d\-\+]?([\+\-]?[\d]+\.?[\d]*)[^\d]?)",Out,nr+strlen(out))
GuiControl,,Matrix%X%%A_Index%,% Out1
}
}
}