Documentation
¶
Overview ¶
Package shot captures a Shell's window on linux for the snapshot commands (cmd/controlexample -snap, cmd/images).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoImage = errors.New("shot: no in-memory capture")
ErrNoImage means CaptureImage cannot serve this capture; use Capture.
var Fast bool
Fast makes the capture of a view inside a window capture skip the PNG round trip (macOS); set by a QA recorder shot.
var Passive bool
Passive makes Capture leave the focus alone, where it would bring the window to the front and activate it (Windows); an open popover closes when its window is deactivated.
Functions ¶
func Finish ¶
Finish brings the PNG to GOWT_SNAP_SIZE=<w>x<h> (outer size in points) at 2 px per point; a smaller capture scale is scaled up. The capture is stretched to the target when within 3% of it, else cropped or padded.
func HasWebView ¶
func HasWebView() bool
HasWebView reports whether a web view exists; its first paint comes a moment after the load finished.
func Meta ¶
Meta is what the pixels depend on besides the code: snapcheck compares it before comparing images.
func NavStarted ¶
func NavStarted()
func Settled ¶
func Settled() bool
Settled reports whether a snapshot can be taken: no web view, or one whose last load has completed or failed.
func WebViewCreated ¶
func WebViewCreated()
WebViewCreated, NavStarted and NavDone are called by package webview.
Types ¶
type Frame ¶
type Frame struct{ X, Y, W, H float64 }
Frame is where a captured window lies on the screen, y down; points, or pixels on Windows.
func Capture ¶
Capture writes the toplevel window of widget as a PNG with its frame: a window-manager frame is copied from the root window, client-side decorations are in the window's own surface minus the shadow margin. The Frame is where the PNG lies on the screen, in logical points.
func CaptureImage ¶
CaptureImage is only there on macOS, where the PNG round trip is the cost of a shot.
func CaptureView ¶
CaptureView is Capture where the window holds the popover's own pixels.