From 3578a97a2839742aa952549d2f20f5a544c96abc Mon Sep 17 00:00:00 2001 From: vcaesar Date: Fri, 17 May 2019 10:47:50 -0400 Subject: [PATCH] update bitmap examples code --- examples/bitmap/main.go | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/examples/bitmap/main.go b/examples/bitmap/main.go index 9999ff2..f6e9c4e 100644 --- a/examples/bitmap/main.go +++ b/examples/bitmap/main.go @@ -122,6 +122,26 @@ func bitmapTest(bmp robotgo.CBitmap) { fmt.Println("FindBitmap------", fx, fy) } +func findBitmap(bmp robotgo.CBitmap) { + fx, fy := robotgo.FindBitmap(robotgo.ToMMBitmapRef(bmp)) + fmt.Println("findBitmap: ", fx, fy) + + fx, fy = robotgo.FindCBitmap(bmp) + fmt.Println("findCBitmap: ", fx, fy) + fx, fy = robotgo.FindCBitmap(bmp, nil, 0.1) + fmt.Println("findCBitmap: ", fx, fy) + + // open image bitmap + openbit := robotgo.OpenBitmap("test.tif") + fmt.Println("openBitmap...", openbit) + + fx, fy = robotgo.FindBitmap(openbit) + fmt.Println("FindBitmap------", fx, fy) + + fx, fy = robotgo.FindPic("test.tif") + fmt.Println("FindPic------", fx, fy) +} + func bitmap() { //////////////////////////////////////////////////////////////////////////////// // Bitmap @@ -157,24 +177,6 @@ func bitmap() { // robotgo.FreeBitmap(bitmap) } -func findBitmap(bmp robotgo.CBitmap) { - fx, fy := robotgo.FindBitmap(robotgo.ToMMBitmapRef(bmp)) - fmt.Println("findBitmap: ", fx, fy) - - fx, fy = robotgo.FindCBitmap(bmp) - fmt.Println("findCBitmap: ", fx, fy) - - // open image bitmap - openbit := robotgo.OpenBitmap("test.tif") - fmt.Println("openBitmap...", openbit) - - fx, fy = robotgo.FindBitmap(openbit) - fmt.Println("FindBitmap------", fx, fy) - - fx, fy = robotgo.FindPic("test.tif") - fmt.Println("FindPic------", fx, fy) -} - func main() { bitmap() }