From fb382d9e8d59489a63a65fef6d6108da48f45329 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sun, 3 Dec 2017 01:21:55 +0800 Subject: [PATCH] [Update examples] findcolor and add new findcolor example --- .gitignore | 4 ++++ examples/bitmap/main.go | 6 +++++- examples/main.go | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8ca80c5..582baa7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,10 @@ .DS_Store .vscode .idea + +examples/bitmap/test.png +examples/bitmap/test.tif +examples/bitmap/test31.tif test/test.png # Debug files diff --git a/examples/bitmap/main.go b/examples/bitmap/main.go index 3337200..7dd91f5 100644 --- a/examples/bitmap/main.go +++ b/examples/bitmap/main.go @@ -36,7 +36,11 @@ func main() { color := robotgo.GetColor(bitmap, 1, 2) fmt.Println("color...", color) - cx, cy := robotgo.FindColor(bitmap, color, 1.0) + cx, cy := robotgo.FindColor(bitmap, robotgo.CHex(color), 1.0) + fmt.Println("pos...", cx, cy) + cx, cy = robotgo.FindColor(bitmap, 0xAADCDC) + fmt.Println("pos...", cx, cy) + cx, cy = robotgo.FindColorCS(388, 179, 300, 300, 0xAADCDC) fmt.Println("pos...", cx, cy) bit := robotgo.CaptureScreen(1, 2, 40, 40) diff --git a/examples/main.go b/examples/main.go index 374a20d..12ec84a 100644 --- a/examples/main.go +++ b/examples/main.go @@ -146,7 +146,11 @@ func bitmap() { color := robotgo.GetColor(bitmap, 1, 2) fmt.Println("color...", color) - cx, cy := robotgo.FindColor(bitmap, color, 1.0) + cx, cy := robotgo.FindColor(bitmap, robotgo.CHex(color), 1.0) + fmt.Println("pos...", cx, cy) + cx, cy = robotgo.FindColor(bitmap, 0xAADCDC) + fmt.Println("pos...", cx, cy) + cx, cy = robotgo.FindColorCS(388, 179, 300, 300, 0xAADCDC) fmt.Println("pos...", cx, cy) bit := robotgo.CaptureScreen(1, 2, 40, 40)