mirror of
https://github.com/XZB-1248/Spark
synced 2025-09-26 20:21:11 +08:00
29 lines
435 B
Go
29 lines
435 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package desktop
|
|
|
|
import (
|
|
"github.com/kbinani/screenshot"
|
|
"image"
|
|
)
|
|
|
|
type screen struct {
|
|
displayIndex int
|
|
}
|
|
|
|
func (s *screen) init(displayIndex int) {
|
|
s.displayIndex = displayIndex
|
|
}
|
|
|
|
func (s *screen) capture(img *image.RGBA, _ image.Rectangle) error {
|
|
image, err := screenshot.CaptureDisplay(displayIndex)
|
|
if err == nil {
|
|
*img = *image
|
|
}
|
|
return err
|
|
}
|
|
|
|
func (s *screen) release() {
|
|
}
|