Documentation
¶
Index ¶
- func DPIScale() float64
- func DrawScaled(dst, src *ebiten.Image, mode string, par float64)
- func NewUnmanagedImage(w, h int) *ebiten.Image
- func ScaleAndCenter(displayW, displayH, sourceW, sourceH float64, screenW, screenH int) (scaleX, scaleY, offsetX, offsetY float64)
- func Size(mode string, screenW, screenH, sourceW, sourceH int, par float64) (float64, float64)
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
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
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).
Types ¶
This section is empty.