offscreen

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 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{AppSingle: base.NewAppSingle[*Drawer, *Window]()}

TheApp is the single system.App for the offscreen platform

Functions

func Init

func Init()

Types

type App

type App struct {
	base.AppSingle[*Drawer, *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

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
}

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

func (*Drawer) DestBounds

func (dw *Drawer) DestBounds() image.Rectangle

DestBounds returns the bounds of the render destination

func (*Drawer) EndDraw

func (dw *Drawer) EndDraw()

EndDraw ends image drawing rendering process on render target. This is the function that actually sends the image to the capture channel.

type Window

type Window struct {
	base.WindowSingle[*App]
}

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

func (*Window) Handle

func (w *Window) Handle() any

Jump to

Keyboard shortcuts

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