#[non_exhaustive]pub struct ImageTable {
pub images: BTreeMap<&'static str, ImageInfo>,
}Expand description
Every image the game can draw, by bundle path (/-separated). Build it
with ImageTable::new, Default or ImageTable::load
(ADR-0039).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.images: BTreeMap<&'static str, ImageInfo>Size by path.
Implementations§
Source§impl ImageTable
impl ImageTable
Sourcepub const fn new(images: BTreeMap<&'static str, ImageInfo>) -> Self
pub const fn new(images: BTreeMap<&'static str, ImageInfo>) -> Self
The table of images, their sizes by path.
Sourcepub fn load(bundle: &Bundle, skip: &[&str]) -> Result<Self, Vec<ContentError>>
pub fn load(bundle: &Bundle, skip: &[&str]) -> Result<Self, Vec<ContentError>>
Reads the size of every PNG in bundle but those at the paths in
skip (e.g. a font atlas, checked on its own), reporting every bad
file.
Sourcepub fn load_with(
bundle: &Bundle,
formats: &Formats,
skip: &[&str],
) -> Result<Self, Vec<ContentError>>
pub fn load_with( bundle: &Bundle, formats: &Formats, skip: &[&str], ) -> Result<Self, Vec<ContentError>>
Like ImageTable::load, with the image formats of formats:
every file in bundle whose extension one of them claims
(Formats::claims), but those at the paths in skip, read by
them (ImageTable::from_files_with). With
Formats::standard it reads the files load reads.
Sourcepub fn from_files_with<'a>(
bundle: &Bundle,
formats: &Formats,
files: impl IntoIterator<Item = (&'static str, &'a [u8])>,
) -> Result<Self, Vec<ContentError>>
pub fn from_files_with<'a>( bundle: &Bundle, formats: &Formats, files: impl IntoIterator<Item = (&'static str, &'a [u8])>, ) -> Result<Self, Vec<ContentError>>
Like ImageTable::from_files, each file read by the image
formats of formats (Formats::decode). With
Formats::standard it gives what from_files gives for files
named .png.
Sourcepub fn from_files<'a>(
bundle: &Bundle,
files: impl IntoIterator<Item = (&'static str, &'a [u8])>,
) -> Result<Self, Vec<ContentError>>
pub fn from_files<'a>( bundle: &Bundle, files: impl IntoIterator<Item = (&'static str, &'a [u8])>, ) -> Result<Self, Vec<ContentError>>
The table of files (bundle path and contents), or every problem
found: a file that isn’t a PNG (or a one-bit picture in a PNG’s
place), an empty image, or one with a side
over MAX_SIDE. Errors name each file as bundle shows it.
Sourcepub fn id(&self, path: &str) -> Option<ImageId>
pub fn id(&self, path: &str) -> Option<ImageId>
The id of the image at path, or None if the table lacks it.
Trait Implementations§
Source§impl Clone for ImageTable
impl Clone for ImageTable
Source§fn clone(&self) -> ImageTable
fn clone(&self) -> ImageTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more