shot

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: EPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
var ErrNoImage = errors.New("shot: no in-memory capture")

ErrNoImage means CaptureImage cannot serve this capture; use Capture.

View Source
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.

View Source
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 ClearFocus

func ClearFocus(int64)

ClearFocus is for macOS only.

func Finish

func Finish(path string) error

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

func Meta(widget int64) string

Meta is what the pixels depend on besides the code: snapcheck compares it before comparing images.

func NavDone()
func NavStarted()

func PlaceOnRetina

func PlaceOnRetina(int64) bool

PlaceOnRetina is for macOS only.

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.

func WindowPNG

func WindowPNG(handle int64, path string) error

WindowPNG is Capture without the frame.

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

func Capture(widget int64, path string) (Frame, error)

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

func CaptureImage(int64) (*image.NRGBA, Frame, error)

CaptureImage is only there on macOS, where the PNG round trip is the cost of a shot.

func CaptureView

func CaptureView(handle int64, path string) (Frame, error)

CaptureView is Capture where the window holds the popover's own pixels.

func Compose

func Compose(path string, base Frame, overPath string, over Frame) (Frame, error)

Compose draws the capture at overPath onto the one at path where the frames say; the canvas grows where the second window reaches past the first. It returns the frame of the result.

Jump to

Keyboard shortcuts

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