devimage

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 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

Overview

Package devimage builds the image sources that asset hot reload hands a running game: an image's bytes read from disk in place of where it was loaded from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reloaded

func Reloaded(src core.ImageSource, uri string, data []byte, ratio float32, same func(a, b string) bool) (core.ImageSource, bool)

Reloaded returns src showing data, the new bytes of the file uri names, when that file is the one a screen of ratio pixels per point shows for src (Shown), and false otherwise; same reports whether two URIs name the same file. The result is named after the file shown, so an "asset:" name such as hero@2x.png keeps the density it gives, while a source with several scales is left alone when uri is a scale the screen does not show.

func Shown

func Shown(src core.ImageSource, ratio float32) string

Shown returns the URI of the file the core loads for src on a screen of ratio pixels per point, as it picks among src's Scales: src's URI for a single file or the 1x pick, the variant Variants names for the scale picked, else the "asset:" file named with that scale's suffix (asset:a.png at 2 is asset:a@2x.png).

func WithData

func WithData(src core.ImageSource, data []byte) core.ImageSource

WithData returns src showing data, the bytes of an image file read from disk, in place of what src named. It keeps src's URI, so an "asset:" name such as hero@2x.png keeps its density, and its declared Size, and drops its Scales, Variants, Pixels and Offscreen, since data is one file at one scale. The core names an image with bytes by their digest, so the result loads afresh even where src's URI was already cached.

Types

This section is empty.

Jump to

Keyboard shortcuts

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