Documentation ¶
Overview ¶
Package offscreen provides placeholder implementations of goosi interfaces to allow for offscreen testing and capturing of apps.
Index ¶
- Variables
- func Main(f func(goosi.App))
- type App
- type Drawer
- func (dw *Drawer) ConfigImageDefaultFormat(idx int, width int, height int, layers int)
- func (dw *Drawer) Copy(idx, layer int, dp image.Point, sr image.Rectangle, op draw.Op, flipY bool) error
- func (dw *Drawer) DestBounds() image.Rectangle
- func (dw *Drawer) EndDraw()
- func (dw *Drawer) MaxTextures() int
- func (dw *Drawer) Scale(idx, layer int, dr image.Rectangle, sr image.Rectangle, op draw.Op, flipY bool) error
- func (dw *Drawer) SetGoImage(idx, layer int, img image.Image, flipY bool)
- func (dw *Drawer) SetMaxTextures(maxTextures int)
- func (dw *Drawer) StartDraw(descIdx int)
- func (dw *Drawer) Surface() any
- func (dw *Drawer) SyncImages()
- func (dw *Drawer) UseTextureSet(descIdx int)
- type Window
Constants ¶
This section is empty.
Variables ¶
var TheApp = &App{AppSingle: base.NewAppSingle[*Drawer, *Window]()}
TheApp is the single goosi.App for the offscreen platform
Functions ¶
Types ¶
type App ¶ added in v0.0.15
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 goosi.App implementation for the offscreen platform
func (*App) GetScreens ¶ added in v0.0.23
func (a *App) GetScreens()
type Drawer ¶ added in v0.0.15
type Drawer struct { // MaxTxts is the max number of textures MaxTxts int // Image is the target render image Image *image.RGBA // Images is a stack of images indexed by render scene index and then layer number Images [][]*image.RGBA }
Drawer is the implementation of goosi.Drawer for the offscreen platform
func (*Drawer) ConfigImageDefaultFormat ¶ added in v0.0.15
ConfigImageDefaultFormat configures the draw image at the given index to fit the default image format specified by the given width, height, and number of layers.
func (*Drawer) Copy ¶ added in v0.0.15
func (dw *Drawer) Copy(idx, layer int, dp image.Point, sr image.Rectangle, op draw.Op, flipY bool) error
Copy copies texture at given index and layer to render target. dp is the destination point, sr is the source region (set to image.ZR zero rect for all), op is the drawing operation: Src = copy source directly (blit), Over = alpha blend with existing flipY = flipY axis when drawing this image
func (*Drawer) DestBounds ¶ added in v0.0.15
DestBounds returns the bounds of the render destination
func (*Drawer) EndDraw ¶ added in v0.0.15
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.
func (*Drawer) MaxTextures ¶ added in v0.0.15
MaxTextures returns the max number of textures for drawing
func (*Drawer) Scale ¶ added in v0.0.15
func (dw *Drawer) Scale(idx, layer int, dr image.Rectangle, sr image.Rectangle, op draw.Op, flipY bool) error
Scale copies texture at given index and layer to render target, scaling the region defined by src and sr to the destination such that sr in src-space is mapped to dr in dst-space. dr is the destination rectangle sr is the source region (set to image.ZR zero rect for all), op is the drawing operation: Src = copy source directly (blit), Over = alpha blend with existing flipY = flipY axis when drawing this image
func (*Drawer) SetGoImage ¶ added in v0.0.15
SetGoImage sets given Go image as a drawing source to given image index, and layer, used in subsequent Draw methods. A standard Go image is rendered upright on a standard surface. Set flipY to true to flip.
func (*Drawer) SetMaxTextures ¶ added in v0.0.15
SetMaxTextures updates the max number of textures for drawing Must call this prior to doing any allocation of images.
func (*Drawer) StartDraw ¶ added in v0.0.15
StartDraw starts image drawing rendering process on render target No images can be added or set after this point. descIdx is the descriptor set to use -- choose this based on the bank of 16 texture values if number of textures > MaxTexturesPerSet. This is a no-op on offscreen; if rendering logic is done here instead of EndDraw, everything is delayed by one render because Scale and Copy are called after StartDraw but before EndDraw, and we need them to be called before actually rendering the image to the capture channel.
func (*Drawer) SyncImages ¶ added in v0.0.15
func (dw *Drawer) SyncImages()
SyncImages must be called after images have been updated, to sync memory up to the GPU.
func (*Drawer) UseTextureSet ¶ added in v0.0.15
UseTextureSet selects the descriptor set to use -- choose this based on the bank of 16 texture values if number of textures > MaxTexturesPerSet.
type Window ¶ added in v0.0.15
type Window struct { base.WindowSingle[*App] }
Window is the implementation of goosi.Window for the offscreen platform.