Package com.avrix.ui
Class NanoImage
java.lang.Object
com.avrix.ui.NanoImage
A utility class for loading images and caching them.
-
Field Summary
Modifier and TypeFieldDescriptionMap to store image identifiers associated with their names.static Path
Path to the image cache directory. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isImageFile
(String fileExtension) Checks if the given file extension is a supported image type.static int
Loads an image from a URL string and returns its ID.static int
Loads an image from a JAR file.static int
Loads an image from a URL and returns its ID.static int
Loads an image from a file path and returns its ID.
-
Field Details
-
imagesCacheMap
Map to store image identifiers associated with their names. -
imagesCachePath
Path to the image cache directory.
-
-
Constructor Details
-
NanoImage
public NanoImage()
-
-
Method Details
-
loadImage
Loads an image from a JAR file.- Parameters:
jarFilePath
- Path to the JAR fileinternalFilePath
- Path to the image inside the JAR- Returns:
- the image ID, or -1 if loading failed
-
loadImage
Loads an image from a file path and returns its ID. The image is cached for future use.- Parameters:
path
- the path to the image file- Returns:
- the image ID, or -1 if loading failed
-
loadImage
Loads an image from a URL and returns its ID. The image is cached for future use.- Parameters:
url
- the URL of the image- Returns:
- the image ID, or -1 if loading failed
-
loadImage
Loads an image from a URL string and returns its ID. The image is cached for future use.- Parameters:
urlString
- the URL string of the image- Returns:
- the image ID, or -1 if loading failed
-
isImageFile
Checks if the given file extension is a supported image type.- Parameters:
fileExtension
- The file extension to check.- Returns:
- true if the file extension is a supported image type; false otherwise.
-