display

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPIScale

func DPIScale() float64

DPIScale returns the device scale factor for the current monitor. Returns 1.0 if the monitor is not available (e.g. in test environments).

func DrawScaled added in v0.4.2

func DrawScaled(dst, src *ebiten.Image, mode string, par float64)

DrawScaled draws src into dst, scaled and centered to fit dst using the given aspect ratio mode and pixel aspect ratio. Nearest filtering preserves pixel-art crispness. src's bounds determine the source size, so a cropped sub-image scales by its cropped dimensions.

func NewUnmanagedImage added in v0.4.5

func NewUnmanagedImage(w, h int) *ebiten.Image

NewUnmanagedImage creates an off-atlas ebiten image of the given size. Render targets are large, drawn individually, and used as draw sources, so they must not be placed on ebiten's texture atlas: ebiten would promote them onto giant source-atlas pages that stay mostly empty and accumulate across rebuilds. Unmanaged images are never atlased and are freed immediately on Deallocate.

func ScaleAndCenter

func ScaleAndCenter(displayW, displayH, sourceW, sourceH float64, screenW, screenH int) (scaleX, scaleY, offsetX, offsetY float64)

ScaleAndCenter computes scale factors and centering offsets to fit a display-sized image (displayW x displayH) from a source (sourceW x sourceH) into the screen (screenW x screenH).

func Size

func Size(mode string, screenW, screenH, sourceW, sourceH int, par float64) (float64, float64)

Size computes the display dimensions for the given aspect ratio mode, fitting within screenW x screenH while preserving the chosen ratio. sourceW/sourceH are the native pixel dimensions and par is the pixel aspect ratio (used only for "dar" mode).

Types

This section is empty.

Jump to

Keyboard shortcuts

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