Package pi.resources

Enum Class ImageFormat

java.lang.Object
java.lang.Enum<ImageFormat>
pi.resources.ImageFormat
All Implemented Interfaces:
Serializable, Comparable<ImageFormat>, Constable

public enum ImageFormat extends Enum<ImageFormat>
Contains all known image file-formats supported by the engine.
Author:
Steffen Wilke, Matthias Wilke
See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static ImageFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ImageFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public static ImageFormat get(String imageFormat)
      Gets the ImageFormat of the specified format string.
      Parameters:
      imageFormat - The format string from which to extract the format.
      Returns:
      The format of the specified string or UNDEFINED if not supported.
    • isSupported

      public static boolean isSupported(File file)
      Determines whether the extension of the specified file is supported by the engine.
      Parameters:
      file - The file to check for.
      Returns:
      True if the extension is part of this enum; otherwise false.
    • isSupported

      public static boolean isSupported(String fileName)
      Determines whether the extension of the specified file is supported by the engine.
      Parameters:
      fileName - The name of the file to check for.
      Returns:
      True if the extension is part of this enum; otherwise false.
    • getAllExtensions

      public static String[] getAllExtensions()
    • toFileExtension

      public String toFileExtension()
      Converts this format instance to a file format string that can be used as an extension (e.g. .png).
      It adds a leading '.' to the lower-case string representation of this instance.
      Returns:
      The file extension string for this instance.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ImageFormat>