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.