screen

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SRCCOPY        = 0x00CC0020
	DIB_RGB_COLORS = 0
	BI_RGB         = 0

	// GetSystemMetrics constants
	SM_XVIRTUALSCREEN  = 76
	SM_YVIRTUALSCREEN  = 77
	SM_CXVIRTUALSCREEN = 78
	SM_CYVIRTUALSCREEN = 79
)

GDI Constants

Variables

This section is empty.

Functions

func CaptureRegion

func CaptureRegion(x, y, w, h int32) (*image.RGBA, error)

CaptureRegion captures a specific region of the virtual desktop. x, y: Virtual desktop coordinates (allowed to be negative). w, h: Pixel dimensions of the region to capture.

func CaptureVirtualDesktop

func CaptureVirtualDesktop() (*image.RGBA, error)

CaptureVirtualDesktop captures the entire virtual desktop (all monitors). It returns an *image.RGBA ready for OpenCV or other processing. It requires the process to be Per-Monitor DPI Aware.

func CaptureVirtualDesktopWithOptions

func CaptureVirtualDesktopWithOptions(opts CaptureOptions) (*image.RGBA, error)

CaptureVirtualDesktopWithOptions captures the virtual desktop with custom options.

func ImageToVirtual

func ImageToVirtual(imageX, imageY int32) (int32, int32)

ImageToVirtual converts coordinates from a "Full Virtual Desktop Screenshot" to actual Windows Virtual Desktop coordinates.

Use this when you capture the entire multi-monitor desktop as a single image (origin 0,0) and find a match at (imageX, imageY).

Returns (x, y) ready for use with winput.MoveMouseTo / winput.ClickMouseAt.

Constraints: 1. The image MUST be a capture of the entire virtual desktop (all monitors). 2. The capture process MUST be Per-Monitor DPI Aware (matching winput). 3. Do NOT modify the returned negative coordinates; they are valid.

Types

type BITMAPINFOHEADER

type BITMAPINFOHEADER struct {
	BiSize          uint32
	BiWidth         int32
	BiHeight        int32
	BiPlanes        uint16
	BiBitCount      uint16
	BiCompression   uint32
	BiSizeImage     uint32
	BiXPelsPerMeter int32
	BiYPelsPerMeter int32
	BiClrUsed       uint32
	BiClrImportant  uint32
}

type CaptureOptions

type CaptureOptions struct {
	PreserveAlpha bool
	MaxMemoryMB   int // Max memory usage in MB, 0 means default limit (500MB)
}

CaptureOptions defines configuration for screen capture.

type Monitor

type Monitor struct {
	Handle     uintptr
	Bounds     Rect
	WorkArea   Rect // Excludes taskbar
	Primary    bool
	DeviceName string
}

Monitor represents a physical display device.

func Monitors

func Monitors() ([]Monitor, error)

Monitors returns a list of all active monitors.

type Point

type Point struct {
	X int32
	Y int32
}

Point represents a point in the Virtual Desktop coordinate system. Coordinates can be negative (e.g., secondary monitor to the left of primary).

type Rect

type Rect struct {
	Left   int32
	Top    int32
	Right  int32
	Bottom int32
}

Rect represents a rectangle in the Virtual Desktop coordinate system.

func VirtualBounds

func VirtualBounds() Rect

VirtualBounds returns the bounding rectangle of the entire virtual desktop. This includes all monitors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL