offscreen

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package offscreen provides placeholder implementations of system interfaces to allow for offscreen testing and capturing of apps.

Index

Constants

This section is empty.

Variables

View Source
var TheApp = &App{AppMulti: base.NewAppMulti[*Window]()}

TheApp is the single system.App for the offscreen platform

Functions

func Init

func Init()

Types

type App

type App struct {
	base.AppMulti[*Window]

	// TempDataDir is the path of the app data directory, used as the
	// return value of [App.DataDir]. It is set to a temporary directory,
	// as offscreen tests should not be dependent on user preferences and
	// other data.
	TempDataDir string
}

App is the system.App implementation for the offscreen platform. It is multi-window but only has one screen.

func (*App) DataDir

func (a *App) DataDir() string

func (*App) GetScreens

func (a *App) GetScreens()

func (*App) NewWindow

func (a *App) NewWindow(opts *system.NewWindowOptions) (system.Window, error)

NewWindow creates a new window with the given options. It waits for the underlying system window to be created first. Also, it hides all other windows and shows the new one.

func (*App) Platform

func (a *App) Platform() system.Platforms

func (*App) QuitClean

func (a *App) QuitClean() bool

type Drawer

type Drawer struct {
	system.DrawerBase

	Window *Window
}

Drawer is the implementation of system.Drawer for the offscreen platform

func (*Drawer) End

func (dw *Drawer) End()

func (*Drawer) GetImage

func (dw *Drawer) GetImage() *image.RGBA

GetImage returns the rendered image. It is called through an interface in core.Body.AssertRender.

func (*Drawer) Start

func (dw *Drawer) Start()

type Window

type Window struct {
	base.WindowMulti[*App, *Drawer]
}

Window is the implementation of system.Window for the offscreen platform.

func (*Window) Screen

func (w *Window) Screen() *system.Screen

Jump to

Keyboard shortcuts

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