-
Notifications
You must be signed in to change notification settings - Fork 44
/
graphicColor.go
286 lines (237 loc) · 9.43 KB
/
graphicColor.go
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// 图色
package dmsoft
import (
ole "github.com/go-ole/go-ole"
)
func (com *Dmsoft) AppendPicAddr(picInfo string, addr, size int) string {
ret, _ := com.dm.CallMethod("AppendPicAddr", picInfo, addr, size)
return ret.ToString()
}
func (com *Dmsoft) Capture(x1, y1, x2, y2 int, file string) int {
ret, _ := com.dm.CallMethod("Capture", x1, y1, x2, y2, file)
return int(ret.Val)
}
func (com *Dmsoft) CaptureGif(x1, y1, x2, y2 int, file string, delay, time int) int {
ret, _ := com.dm.CallMethod("CaptureGif", x1, y1, x2, y2, file, delay, time)
return int(ret.Val)
}
func (com *Dmsoft) CaptureJpg(x1, y1, x2, y2 int, file string, quality int) int {
ret, _ := com.dm.CallMethod("CaptureJpg", x1, y1, x2, y2, file, quality)
return int(ret.Val)
}
func (com *Dmsoft) CapturePng(x1, y1, x2, y2 int, file string) int {
ret, _ := com.dm.CallMethod("CapturePng", x1, y1, x2, y2, file)
return int(ret.Val)
}
func (com *Dmsoft) CapturePre(file string) int {
ret, _ := com.dm.CallMethod("CapturePre", file)
return int(ret.Val)
}
func (com *Dmsoft) CmpColor(x int, y int, color string, sim float32) int {
ret, _ := com.dm.CallMethod("CmpColor", x, y, color, sim)
return int(ret.Val)
}
func (com *Dmsoft) EnableDisplayDebug(enableDebug int) int {
ret, _ := com.dm.CallMethod("EnableDisplayDebug", enableDebug)
return int(ret.Val)
}
func (com *Dmsoft) EnableFindPicMultithread(enable int) int {
ret, _ := com.dm.CallMethod("EnableFindPicMultithread", enable)
return int(ret.Val)
}
func (com *Dmsoft) EnableGetColorByCapture(enable int) int {
ret, _ := com.dm.CallMethod("EnableGetColorByCapture", enable)
return int(ret.Val)
}
func (com *Dmsoft) FindColor(x1, y1, x2, y2 int, color string, sim float32, dir int, intX *int, intY *int) int {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindColor", x1, y1, x2, y2, color, sim, dir, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return int(ret.Val)
}
func (com *Dmsoft) FindColorBlock(x1, y1, x2, y2 int, color string, sim float32, count, width, height int, intX, intY *int) int {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindColorBlock", x1, y1, x2, y2, color, sim, count, width, height, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return int(ret.Val)
}
func (com *Dmsoft) FindColorBlockEx(x1, y1, x2, y2 int, color string, sim float32, count, width, height int) string {
ret, _ := com.dm.CallMethod("FindColorBlockEx", x1, y1, x2, y2, color, sim, count, width, height)
return ret.ToString()
}
func (com *Dmsoft) FindColorE(x1, y1, x2, y2 int, color string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindColorE", x1, y1, x2, y2, color, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindColorEx(x1, y1, x2, y2 int, color string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindColorEx", x1, y1, x2, y2, color, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindMulColor(x1, y1, x2, y2 int, color string, sim float32) int {
ret, _ := com.dm.CallMethod("FindMulColor", x1, y1, x2, y2, color, sim)
return int(ret.Val)
}
func (com *Dmsoft) FindMultiColor(x1, y1, x2, y2 int, firstColor string, offsetColor string, sim float32, dir int, intX, intY *int) int {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindMultiColor", x1, y1, x2, y2, firstColor, offsetColor, sim, dir, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return int(ret.Val)
}
func (com *Dmsoft) FindMultiColorE(x1, y1, x2, y2 int, firstColor string, offsetColor string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindMultiColorE", x1, y1, x2, y2, firstColor, offsetColor, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindMultiColorEx(x1, y1, x2, y2 int, firstColor string, offsetColor string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindMultiColorEx", x1, y1, x2, y2, firstColor, offsetColor, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindPic(x1, y1, x2, y2 int, picName string, deltaColor string, sim float32, dir int, intX, intY *int) int {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindPic", x1, y1, x2, y2, picName, deltaColor, sim, dir, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return int(ret.Val)
}
func (com *Dmsoft) FindPicE(x1, y1, x2, y2 int, picName string, deltaColor string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindPicE", x1, y1, x2, y2, picName, deltaColor, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindPicEx(x1, y1, x2, y2 int, picName string, deltaColor string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindPicEx", x1, y1, x2, y2, picName, deltaColor, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindPicExS(x1, y1, x2, y2 int, picName string, deltaColor string, sim float32, dir int) string {
ret, _ := com.dm.CallMethod("FindPicExS", x1, y1, x2, y2, picName, deltaColor, sim, dir)
return ret.ToString()
}
func (com *Dmsoft) FindPicMem(x1, y1, x2, y2 int, pic_info, delta_color string, sim float32, dir int, intX, intY *int) int {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindPicMem", x1, y1, x2, y2, pic_info, delta_color, sim, dir, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return int(ret.Val)
}
// func (com *Dmsoft)FindPicMemE(x1, y1, x2, y2, pic_info, delta_color,sim, dir,intX, intY) string{}
// func (com *Dmsoft)FindPicMemEx(x1, y1, x2, y2, pic_info, delta_color,sim, dir,intX, intY) string{}
func (com *Dmsoft) FindPicS(x1, y1, x2, y2 int, picName string, deltaColor string, sim float32, dir int, intX, intY *int) string {
x := ole.NewVariant(ole.VT_I4, 0)
y := ole.NewVariant(ole.VT_I4, 0)
ret, _ := com.dm.CallMethod("FindPicS", x1, y1, x2, y2, picName, deltaColor, sim, dir, &x, &y)
*intX = int(x.Val)
*intY = int(y.Val)
x.Clear()
y.Clear()
return ret.ToString()
}
// func (com *Dmsoft)FindShape(x1, y1, x2, y2, offset_color,sim, dir,intX,intY) int{}
// func (com *Dmsoft)FindShapeE(x1, y1, x2, y2, offset_color,sim, dir,intX,intY) string{}
// func (com *Dmsoft)FindShapeEx(x1, y1, x2, y2, offset_color,sim, dir,intX,intY) string{}
func (com *Dmsoft) FreePic(pic_name string) int {
ret, _ := com.dm.CallMethod("FreePic", pic_name)
return int(ret.Val)
}
func (com *Dmsoft) GetAveHSV(x1, y1, x2, y2 int) string {
ret, _ := com.dm.CallMethod("GetAveHSV", x1, y1, x2, y2)
return ret.ToString()
}
func (com *Dmsoft) GetAveRGB(x1, y1, x2, y2 int) string {
ret, _ := com.dm.CallMethod("GetAveRGB", x1, y1, x2, y2)
return ret.ToString()
}
func (com *Dmsoft) GetColor(x, y int) string {
ret, _ := com.dm.CallMethod("GetColor", x, y)
return ret.ToString()
}
func (com *Dmsoft) GetColorBGR(x, y int) string {
ret, _ := com.dm.CallMethod("GetColorBGR", x, y)
return ret.ToString()
}
func (com *Dmsoft) GetColorHSV(x, y int) string {
ret, _ := com.dm.CallMethod("GetColorHSV", x, y)
return ret.ToString()
}
func (com *Dmsoft) GetColorNum(x1, y1, x2, y2 int, color string, sim float32) int {
ret, _ := com.dm.CallMethod("GetColorNum", x1, y1, x2, y2, color, sim)
return int(ret.Val)
}
func (com *Dmsoft) GetPicSize(picName string) string {
ret, _ := com.dm.CallMethod("GetPicSize", picName)
return ret.ToString()
}
func (com *Dmsoft) GetScreenData(x1, y1, x2, y2 int) int {
ret, _ := com.dm.CallMethod("GetScreenData", x1, y1, x2, y2)
return int(ret.Val)
}
func (com *Dmsoft) GetScreenDataBmp(x1, y1, x2, y2 int, data, size *int) int {
d := ole.NewVariant(ole.VT_I4, int64(*data))
s := ole.NewVariant(ole.VT_I4, int64(*size))
ret, _ := com.dm.CallMethod("GetScreenDataBmp", x1, y1, x2, y2, &d, &s)
*data = int(d.Val)
*size = int(s.Val)
d.Clear()
s.Clear()
return int(ret.Val)
}
func (com *Dmsoft) ImageToBmp(pic_name, bmp_name string) int {
ret, _ := com.dm.CallMethod("ImageToBmp", pic_name, bmp_name)
return int(ret.Val)
}
func (com *Dmsoft) IsDisplayDead(x1, y1, x2, y2, time int) int {
ret, _ := com.dm.CallMethod("IsDisplayDead", x1, y1, x2, y2, time)
return int(ret.Val)
}
func (com *Dmsoft) LoadPic(pic_name string) int {
ret, _ := com.dm.CallMethod("LoadPic", pic_name)
return int(ret.Val)
}
func (com *Dmsoft) LoadPicByte(addr, size int, pic_name string) int {
ret, _ := com.dm.CallMethod("LoadPicByte", addr, size, pic_name)
return int(ret.Val)
}
func (com *Dmsoft) MatchPicName(picName string) string {
ret, _ := com.dm.CallMethod("MatchPicName", picName)
return ret.ToString()
}
func (com *Dmsoft) SetExcludeRegion(mode int, info string) int {
ret, _ := com.dm.CallMethod("SetExcludeRegion", mode, info)
return int(ret.Val)
}
func (com *Dmsoft) SetPicPwd(pwd string) int {
ret, _ := com.dm.CallMethod("SetExcludeRegion", pwd)
return int(ret.Val)
}
func (com *Dmsoft) RGB2BGR(rgb_color string) string {
ret, _ := com.dm.CallMethod("RGB2BGR", rgb_color)
return ret.ToString()
}
func (com *Dmsoft) BGR2RGB(bgr_color string) string {
ret, _ := com.dm.CallMethod("BGR2RGB", bgr_color)
return ret.ToString()
}
func (com *Dmsoft) SetFindPicMultithreadCount(count int) int {
ret, _ := com.dm.CallMethod("SetFindPicMultithreadCount", count)
return int(ret.Val)
}
func (com *Dmsoft) SetFindPicMultithreadLimit(limit int) int {
ret, _ := com.dm.CallMethod("SetFindPicMultithreadLimit", limit)
return int(ret.Val)
}
// 增加了接口FindPicSim FindPicSimEx FindPicSimE和FindPicSimMem FindPicSimMemEx FindPicSimMemE