mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 07:33:55 +00:00
update scale example code close #153
This commit is contained in:
parent
e01416e3c2
commit
f4cff13c0a
@ -7,15 +7,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
//
|
||||||
|
// syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
||||||
|
|
||||||
width, height := robotgo.GetScaleSize()
|
width, height := robotgo.GetScaleSize()
|
||||||
fmt.Println("GetScreenSize: ", width, height)
|
fmt.Println("get scale screen size: ", width, height)
|
||||||
|
|
||||||
bitmap := robotgo.CaptureScreen(0, 0, width, height)
|
bitmap := robotgo.CaptureScreen(0, 0, width, height)
|
||||||
robotgo.SaveBitmap(bitmap, "test.png")
|
robotgo.SaveBitmap(bitmap, "test.png")
|
||||||
|
|
||||||
|
sx := robotgo.ScaleX()
|
||||||
s := robotgo.Scale()
|
s := robotgo.Scale()
|
||||||
robotx := 35 * s / 100
|
robotx := 35 * s / 100
|
||||||
roboty := 25 * s / 100
|
roboty := 25 * s / 100
|
||||||
|
fmt.Println("scale: ", sx, s, " pos: ", robotx, roboty)
|
||||||
|
|
||||||
bit1 := robotgo.CaptureScreen(0, 0, robotx, roboty)
|
bit1 := robotgo.CaptureScreen(0, 0, robotx, roboty)
|
||||||
robotgo.SaveBitmap(bit1, "test2.png")
|
robotgo.SaveBitmap(bit1, "test2.png")
|
||||||
|
Loading…
Reference in New Issue
Block a user