display

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: GPL-3.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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