Package com.avrix.ui

Class NanoImage

java.lang.Object
com.avrix.ui.NanoImage

public class NanoImage extends Object
A utility class for loading images and caching them.
  • Field Details

    • imagesCacheMap

      public static Map<String,Integer> imagesCacheMap
      Map to store image identifiers associated with their names.
    • imagesCachePath

      public static Path imagesCachePath
      Path to the image cache directory.
  • Constructor Details

    • NanoImage

      public NanoImage()
  • Method Details

    • loadImage

      public static int loadImage(String jarFilePath, String internalFilePath)
      Loads an image from a JAR file.
      Parameters:
      jarFilePath - Path to the JAR file
      internalFilePath - Path to the image inside the JAR
      Returns:
      the image ID, or -1 if loading failed
    • loadImage

      public static int loadImage(Path path)
      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

      public static int loadImage(URL url)
      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

      public static int loadImage(String urlString)
      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

      public static boolean isImageFile(String fileExtension)
      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.