Expand description
SFA stands for Single File Assets. Although it says ‘Assets’, It only really supports images You can use this library to encode and decode such files for, say animatable sprites. It converts the given images to PNG for storage.
Functions§
- decode
- Decodes an SFA file from disk and returns a result of dynamic Error
or the expected
HashMap<String, image::DynamicImage>
. The values can then be converted for use with other graphics generating libraries. - decode_
from_ reader - Decodes sfa file from a reader object that implements
the trait
std::io::Read
. It returns a in memory HashMap with keys beingString
objects which are the original names of files and the values areimage::DynamicImage
which are always in PNG format. You might want to use this function for reading from TcpStreams or some in memory buffer. It does not matter if the stream is buffered or not because all the data is read in one go. So for network streams the data will be downloaded first and then processed. - encode
- Encode the given input image files into a sfa file. sfa file stores the images in PNG format only thus you might loose some quality while saving in JPEG or lossfully formated images. Thus using a lossless format for input is recommended.