main.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2016-2017 The go-vgo Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // https://github.com/go-vgo/robotgo/blob/master/LICENSE
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. package main
  11. import (
  12. "fmt"
  13. "github.com/go-vgo/robotgo"
  14. // "go-vgo/robotgo"
  15. )
  16. func main() {
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // Read the screen
  19. ////////////////////////////////////////////////////////////////////////////////
  20. abitMap := robotgo.CaptureScreen()
  21. fmt.Println("abitMap...", abitMap)
  22. gbitMap := robotgo.BCaptureScreen()
  23. fmt.Println("BCaptureScreen...", gbitMap.Width)
  24. // fmt.Println("...", gbitmap.Width, gbitmap.BytesPerPixel)
  25. // gets the screen width and height
  26. sx, sy := robotgo.GetScreenSize()
  27. fmt.Println("...", sx, sy)
  28. // gets the pixel color at 100, 200.
  29. color := robotgo.GetPixelColor(100, 200)
  30. fmt.Println("color----", color, "-----------------")
  31. // gets the pixel color at 10, 20.
  32. color2 := robotgo.GetPixelColor(10, 20)
  33. fmt.Println("color---", color2)
  34. }