mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
Update README.md and example
This commit is contained in:
parent
aae0a14e7f
commit
9468b8fdde
22
README.md
22
README.md
@ -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")
|
||||
|
23
README_zh.md
23
README_zh.md
@ -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")
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user