pub struct ImagePath { /* private fields */ }Expand description
A wrapper for a path that is a file. It can be either an animated wallpaper or a static wallpaper.
Implementations§
Source§impl ImagePath
impl ImagePath
pub fn new(path: PathBuf) -> Option<Self>
Sourcepub fn is_animated(&mut self, settings: &Settings) -> bool
pub fn is_animated(&mut self, settings: &Settings) -> bool
Checks if the given path is an animated wallpaper, if the value has been set before it will return the cached value, else it will check if the path is an animated wallpaper and cache the result.
An animated wallperper can be either a file or a folder. If it is a folder it must be contained in the wallpaper directory. If it is a file it must be contained in a folder that is contained in the wallpaper directory.
Example:
wallpaper_dir
|— folder1
| |— wallpaper1
|– wallpaper2
folder1 is an animated wallpaper wallpaper1 is an animated wallpaper wallpaper2 is not an animated wallpaper
Sourcepub fn get_animated_wallpaper_name(&self) -> String
pub fn get_animated_wallpaper_name(&self) -> String
Gets the name of the folder that contains the given path. If the folder name is not cached it will cache it.
§Panics
If the path is not an animated wallpaper it may panic.