display

package
v0.178.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p Provider)

Register sets the display provider (called from init).

func ResizeImage

func ResizeImage(src image.Image, targetWidth, targetHeight int) image.Image

ResizeImage resizes an image to target dimensions using bilinear interpolation This provides better quality than nearest neighbor for LLM visual understanding

Types

type DisplayController

type DisplayController interface {
	// Screen operations
	CaptureScreenBytes(ctx context.Context, region *Region) ([]byte, error)
	CaptureScreen(ctx context.Context, region *Region) (image.Image, error)
	GetScreenDimensions(ctx context.Context) (width, height int, err error)

	// Mouse operations
	GetCursorPosition(ctx context.Context) (x, y int, err error)
	MoveMouse(ctx context.Context, x, y int) error
	ClickMouse(ctx context.Context, button MouseButton, clicks int) error
	ScrollMouse(ctx context.Context, clicks int, direction string) error

	// Keyboard operations
	TypeText(ctx context.Context, text string, delayMs int) error
	SendKeyCombo(ctx context.Context, combo string) error

	// Lifecycle
	Close() error
}

DisplayController abstracts the desktop input and screen-capture operations.

type DisplayInfo

type DisplayInfo struct {
	Name string
}

DisplayInfo contains metadata about the display backend

type MouseButton

type MouseButton int

MouseButton represents a mouse button

const (
	MouseButtonLeft MouseButton = iota
	MouseButtonMiddle
	MouseButtonRight
)

func ParseMouseButton

func ParseMouseButton(s string) MouseButton

ParseMouseButton parses a string into a MouseButton

func (MouseButton) String

func (b MouseButton) String() string

String returns the string representation of a mouse button

type Provider

type Provider interface {
	GetController() (DisplayController, error)
	GetDisplayInfo() DisplayInfo
	IsAvailable() bool
}

Provider creates DisplayController instances.

func DetectDisplay

func DetectDisplay() (Provider, error)

DetectDisplay returns the display provider when it is available.

type Region

type Region struct {
	X      int
	Y      int
	Width  int
	Height int
}

Region represents a rectangular area on the screen

type RobotProvider

type RobotProvider struct{}

RobotProvider implements the display.Provider interface on robotgo.

func (*RobotProvider) GetController

func (p *RobotProvider) GetController() (DisplayController, error)

func (*RobotProvider) GetDisplayInfo

func (p *RobotProvider) GetDisplayInfo() DisplayInfo

func (*RobotProvider) IsAvailable

func (p *RobotProvider) IsAvailable() bool

Jump to

Keyboard shortcuts

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