Documentation
¶
Overview ¶
Package capture defines the screen capture contract shared by the platform backends: DXGI Desktop Duplication on Windows, ScreenCaptureKit on macOS, and PipeWire or KMS on Linux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAccessLost = errors.New("capture: access lost")
ErrAccessLost means the source must be reopened (mode change, secure desktop, fullscreen switch).
var ErrTimeout = errors.New("capture: no new frame")
ErrTimeout means no new image arrived in the wait window: the screen did not change. It is not a failure.
Functions ¶
This section is empty.
Types ¶
type Display ¶
type Display struct {
ID string
Name string
Adapter gpu.Adapter
// X and Y are the display's top-left corner on the desktop, in pixels
// (Windows; 0, 0 for the primary display).
X, Y int
Width int
Height int
Refresh float64
HDR bool
Primary bool
}
Display describes one capturable output.
type Frame ¶
type Frame struct {
Surface uintptr
Adapter gpu.LUID
Format Format
Width int
Height int
// Presented is when the compositor showed this image, on the monotonic
// clock of the platform (QPC on Windows, mach_absolute_time on macOS).
Presented time.Duration
// Acquired is when the source handed the frame to the caller, same clock.
Acquired time.Duration
// Dirty lists changed rectangles when the backend reports them; nil means
// the whole frame may have changed.
Dirty []Rect
}
Frame is a GPU surface owned by the source until Release is called on it. Surface is the platform handle: an ID3D11Texture2D* on Windows, a CVPixelBufferRef (IOSurface backed) on macOS.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cursor reads the host's system cursor: whether it shows, whether an app holds the mouse, and where it is.
|
Package cursor reads the host's system cursor: whether it shows, whether an app holds the mouse, and where it is. |
|
Package display lists the capturable displays of this machine and opens one with the platform's capture backend: DXGI Desktop Duplication on Windows, ScreenCaptureKit on macOS.
|
Package display lists the capturable displays of this machine and opens one with the platform's capture backend: DXGI Desktop Duplication on Windows, ScreenCaptureKit on macOS. |
|
Package dxgi captures a Windows display with DXGI Desktop Duplication.
|
Package dxgi captures a Windows display with DXGI Desktop Duplication. |
|
Package sck captures a macOS display with ScreenCaptureKit through purego, with no cgo.
|
Package sck captures a macOS display with ScreenCaptureKit through purego, with no cgo. |