Update GetPixelColor

This commit is contained in:
vCaesar 2016-10-24 13:50:42 +08:00
parent 4ea8a5eea5
commit 3deaefc81b
2 changed files with 12 additions and 2 deletions

View File

@ -44,8 +44,11 @@ type Bit_map struct {
BytesPerPixel C.uint8_t
}
func GetPixelColor(x, y C.size_t) string {
color := C.aGetPixelColor(x, y)
func GetPixelColor(x, y int) string {
cx := C.size_t(x)
cy := C.size_t(y)
color := C.aGetPixelColor(cx, cy)
// color := C.aGetPixelColor(x, y)
gcolor := C.GoString(color)
defer C.free(unsafe.Pointer(color))
return gcolor

View File

@ -13,6 +13,13 @@ func arobotgo() {
robotgo.MoveMouse(x, y)
robotgo.MoveMouse(100, 200)
robotgo.MouseToggle("up")
for i := 0; i < 1080; i += 1000 {
Println(i)
robotgo.MoveMouse(800, i)
}
Println(robotgo.GetPixelColor(x, y))
color := robotgo.GetPixelColor(100, 200)