display

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: GPL-3.0 Imports: 2 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 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