Update README.md and example

This commit is contained in:
vcaesar 2021-09-13 12:28:23 -04:00
parent aae0a14e7f
commit 9468b8fdde
3 changed files with 42 additions and 5 deletions

View File

@ -130,6 +130,11 @@ import (
func main() {
robotgo.ScrollMouse(10, "up")
robotgo.Scroll(100, 200)
robotgo.MoveMouse(10, 10)
robotgo.Drag(10, 10)
robotgo.MouseClick("left", true)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0)
}
@ -189,6 +194,9 @@ func main() {
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color---- ", color)
sx, sy := robotgo.GetScreenSize()
fmt.Println("get screen size: ", sx, sy)
}
```
@ -208,9 +216,19 @@ func main() {
// use `defer robotgo.FreeBitmap(bit)` to free the bitmap
defer robotgo.FreeBitmap(bitmap)
fmt.Println("...", bitmap)
fmt.Println("bitmap...", bitmap)
img := robotgo.ToImage(bitmap)
robotgo.SavePng(img, "test_1.png")
fx, fy := robotgo.FindBitmap(bitmap)
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
fx, fy := robotgo.FindBitmap(bit2)
fmt.Println("FindBitmap------ ", fx, fy)
arr := robotgo.FindEveryBitmap(bit2)
fmt.Println("Find every bitmap: ", arr)
robotgo.SaveBitmap(bitmap, "test.png")
fx, fy = robotgo.FindBitmap(bitmap)
fmt.Println("FindBitmap------ ", fx, fy)
robotgo.SaveBitmap(bitmap, "test.png")

View File

@ -128,6 +128,11 @@ import (
func main() {
robotgo.ScrollMouse(10, "up")
robotgo.Scroll(100, 200)
robotgo.MoveMouse(10, 10)
robotgo.Drag(10, 10)
robotgo.MouseClick("left", true)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0)
}
@ -187,6 +192,9 @@ func main() {
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color----", color)
sx, sy := robotgo.GetScreenSize()
fmt.Println("get screen size: ", sx, sy)
}
```
@ -205,9 +213,20 @@ func main() {
bitmap := robotgo.CaptureScreen(10, 20, 30, 40)
// use `defer robotgo.FreeBitmap(bit)` to free the bitmap
defer robotgo.FreeBitmap(bitmap)
fmt.Println("...", bitmap)
fmt.Println("bitmap...", bitmap)
img := robotgo.ToImage(bitmap)
robotgo.SavePng(img, "test_1.png")
fx, fy := robotgo.FindBitmap(bitmap)
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
fx, fy := robotgo.FindBitmap(bit2)
fmt.Println("FindBitmap------ ", fx, fy)
arr := robotgo.FindEveryBitmap(bit2)
fmt.Println("Find every bitmap: ", arr)
robotgo.SaveBitmap(bitmap, "test.png")
fx, fy = robotgo.FindBitmap(bitmap)
fmt.Println("FindBitmap------", fx, fy)
robotgo.SaveBitmap(bitmap, "test.png")

View File

@ -63,7 +63,7 @@ func screen() {
// gets the screen width and height
sx, sy := robotgo.GetScreenSize()
fmt.Println("...", sx, sy)
fmt.Println("get screen size: ", sx, sy)
color()
}