From ef847f361386a4e2a2f5eae80946f5c3912469c4 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sat, 16 Mar 2019 12:17:17 -0400 Subject: [PATCH] update bitmap example code --- examples/bitmap/main.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/bitmap/main.go b/examples/bitmap/main.go index a50799f..ac73659 100644 --- a/examples/bitmap/main.go +++ b/examples/bitmap/main.go @@ -53,17 +53,9 @@ func findColor(bmp robotgo.CBitmap) { fmt.Println("count...", cnt1) } -func bitmapTool(bmp robotgo.CBitmap) { +func bitmapString(bmp robotgo.CBitmap) { bitmap := robotgo.ToMMBitmapRef(bmp) - // bitmap := robotgo.CaptureScreen(10, 20, 30, 40) - abool := robotgo.PointInBounds(bitmap, 1, 2) - fmt.Println("point in bounds...", abool) - - // returns new bitmap object created from a portion of another - bitpos := robotgo.GetPortion(bitmap, 10, 10, 11, 10) - fmt.Println(bitpos) - // creates bitmap from string by bitmap bitstr := robotgo.TostringBitmap(bitmap) fmt.Println("bitstr...", bitstr) @@ -73,6 +65,18 @@ func bitmapTool(bmp robotgo.CBitmap) { sbitmap := robotgo.BitmapStr(bitstr) fmt.Println("bitmap str...", sbitmap) robotgo.SaveBitmap(sbitmap, "teststr.png") +} + +func bitmapTool(bmp robotgo.CBitmap) { + bitmap := robotgo.ToMMBitmapRef(bmp) + + // bitmap := robotgo.CaptureScreen(10, 20, 30, 40) + abool := robotgo.PointInBounds(bitmap, 1, 2) + fmt.Println("point in bounds...", abool) + + // returns new bitmap object created from a portion of another + bitpos := robotgo.GetPortion(bitmap, 10, 10, 11, 10) + fmt.Println(bitpos) // saves image to absolute filepath in the given format robotgo.SaveBitmap(bitmap, "test.png") @@ -141,6 +145,7 @@ func bitmap() { bitmapTest(cbit) findBitmap(cbit) + bitmapString(cbit) bitmapTool(cbit) decode()