Documentation
¶
Overview ¶
Package screenshot captures screen-shot image as image.RGBA. Mac, Windows, Linux, FreeBSD, OpenBSD and NetBSD are supported.
Index ¶
- Variables
- func Capture(x, y, width, height int) (*image.RGBA, error)
- func CaptureDisplay(displayIndex int) (*image.RGBA, error)
- func CaptureInto(x, y, width, height int, img *image.RGBA) error
- func CaptureRect(rect image.Rectangle) (*image.RGBA, error)
- func GetDisplayBounds(displayIndex int) (rect image.Rectangle)
- func NumActiveDisplays() (num int)
- type Capturer
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("screenshot does not support your platform")
ErrUnsupported is returned when the platform or architecture used to compile the program does not support screenshot, e.g. if you're compiling without CGO on Darwin
Functions ¶
func CaptureDisplay ¶
CaptureDisplay captures whole region of displayIndex'th display, starts at 0 for primary display.
func CaptureInto ¶
Capture returns screen capture of specified desktop region. x and y represent distance from the upper-left corner of primary display. Y-axis is downward direction. This means coordinates system is similar to Windows OS.
func CaptureRect ¶
CaptureRect captures specified region of desktop.
func GetDisplayBounds ¶
GetDisplayBounds returns the bounds of displayIndex'th display. The main display is displayIndex = 0.
func NumActiveDisplays ¶
func NumActiveDisplays() (num int)
NumActiveDisplays returns the number of active displays.
Types ¶
type Capturer ¶
type Capturer struct {
// contains filtered or unexported fields
}
Capturer reuses an image buffer for successive screenshots to reduce allocations.
func NewCapturer ¶
func NewCapturer() *Capturer
NewCapturer creates a Capturer for reusing the image buffer between captures.
func (*Capturer) Capture ¶
Capture captures the configured region, reusing the image buffer when possible.
func (*Capturer) Image ¶
Image returns the most recently captured image, or nil if no capture has succeeded or the buffer was discarded after changing the capture region.
func (*Capturer) SetDisplay ¶
SetDisplay sets the capture region to the bounds of the display at index.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
capture_display
command
Capture a single display and save it as a PNG image.
|
Capture a single display and save it as a PNG image. |
|
capture_into
command
Capture into an image buffer allocated by the caller.
|
Capture into an image buffer allocated by the caller. |
|
capturer
command
Capture repeatedly with a reusable image buffer.
|
Capture repeatedly with a reusable image buffer. |