Update examples

This commit is contained in:
vcaesar 2022-01-02 18:32:07 -04:00
parent cc2d0198ea
commit ca337b8505
3 changed files with 5 additions and 37 deletions

View File

@ -1,34 +0,0 @@
package main
import (
"fmt"
"github.com/go-vgo/robotgo"
)
func colorPicker() {
// click the left mouse button to get the value
m := robotgo.AddEvent("mleft")
if m {
x, y := robotgo.GetMousePos()
fmt.Println("mouse pos: ", x, y)
clo := robotgo.GetPixelColor(x, y)
fmt.Println("color: #", clo)
// clipboard
s1 := fmt.Sprint(x, ", ", y) + ": " + "#" + clo
err := robotgo.WriteAll(s1)
if err != nil {
fmt.Println("clipboard err: ", err)
}
}
}
func main() {
fmt.Println("color picker: ")
fmt.Println("click the left mouse button to get the value.")
for {
colorPicker()
}
}

View File

@ -14,7 +14,8 @@ func main() {
fmt.Println("get scale screen size: ", width, height)
bitmap := robotgo.CaptureScreen(0, 0, width, height)
robotgo.SaveBitmap(bitmap, "test.png")
// robotgo.SaveBitmap(bitmap, "test.png")
robotgo.Save(robotgo.ToImage(bitmap), "test.png")
sx := robotgo.ScaleX()
s := robotgo.Scale()
@ -27,7 +28,8 @@ func main() {
rx, ry, rw, rh := sx, sy, robotx, roboty
// bit1 := robotgo.CaptureScreen(10, 20, robotw, roboth)
bit1 := robotgo.CaptureScreen(rx, ry, rw, rh)
robotgo.SaveBitmap(bit1, "test2.png")
// robotgo.SaveBitmap(bit1, "test2.png")
robotgo.Save(robotgo.ToImage(bit1), "test2.png")
clo := robotgo.GetPixelColor(robotx, roboty)
fmt.Println("GetPixelColor...", clo)

View File

@ -27,7 +27,7 @@ func bitmap() {
fmt.Println("GoCaptureScreen...", gbitMap.Width)
// fmt.Println("...", gbitmap.Width, gbitmap.BytesPerPixel)
robotgo.SaveCapture("saveCapture.png", 10, 20, 100, 100)
// robotgo.SaveCapture("saveCapture.png", 10, 20, 100, 100)
}
func color() {