mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
add scale example
This commit is contained in:
parent
e3833dda5e
commit
5c5348e88e
1 changed files with 24 additions and 0 deletions
24
examples/scale/main.go
Normal file
24
examples/scale/main.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-vgo/robotgo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
width, height := robotgo.GetScaleSize()
|
||||
fmt.Println("GetScreenSize: ", width, height)
|
||||
|
||||
bitmap := robotgo.CaptureScreen(0, 0, width, height)
|
||||
robotgo.SaveBitmap(bitmap, "test.png")
|
||||
|
||||
s := robotgo.Scale()
|
||||
robotx := 35 * s / 100
|
||||
roboty := 25 * s / 100
|
||||
bit1 := robotgo.CaptureScreen(0, 0, robotx, roboty)
|
||||
robotgo.SaveBitmap(bit1, "test2.png")
|
||||
|
||||
clo := robotgo.GetPixelColor(robotx, roboty)
|
||||
fmt.Println("GetPixelColor...", clo)
|
||||
}
|
||||
Loading…
Reference in a new issue