screenshot

package
v0.1.88 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 5 Imported by: 0

README

Screenshot of Recorded Ops

Example from gio tests

import 	(
    "gioui.org/gpu/headless"
)

width := lineWidth
height := 100
cap := image.NewRGBA(image.Rect(0, 0, width, height))
w, _ := headless.NewWindow(width, height)
defer w.Release()

ops := new(op.Ops)
gtx := layout.Context{
    Constraints: layout.Constraints{Max: image.Pt(width, height)},
    Ops:         ops,
}

w.Frame(ops)
w.Screenshot(cap)
b := new(bytes.Buffer)
_ = png.Encode(b, cap)
screenshotName := tc.name + ".png"
_ = os.WriteFile(screenshotName, b.Bytes(), 0o644)
t.Logf("wrote %q", screenshotName)

Create a Recording


import 	(
    "gioui.org/op"
)
//gtx layout.Context
macro := op.Record(gtx.Ops)
// call node.Layout(gtx) or similar
callOp := macro.Stop()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TakeScreenshot

func TakeScreenshot(width, height int, drawOps op.CallOp) image.Image

Types

This section is empty.

Jump to

Keyboard shortcuts

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