Enum DecodeFormat

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DecodeFormat>

    public enum DecodeFormat
    extends java.lang.Enum<DecodeFormat>
    Options for setting the value of Bitmap.getConfig() for Bitmaps returned by ResourceDecoders.

    Note - In some cases it may not be possible to obey the requested setting, not all Downsamplers support setting formats and certain images may not be able to be loaded as certain configurations. Therefore this class represents a preference rather than a requirement.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      PREFER_ARGB_8888
      Bitmaps returned by the ResourceDecoder.
      PREFER_RGB_565
      Bitmaps decoded from image formats that support and/or use alpha (some types of PNGs, GIFs etc) should return Bitmap.Config.ARGB_8888 for Bitmap.getConfig().
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static DecodeFormat DEFAULT
      The default value for DecodeFormat.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DecodeFormat valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DecodeFormat[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • PREFER_ARGB_8888

        public static final DecodeFormat PREFER_ARGB_8888
        Bitmaps returned by the ResourceDecoder. should return Bitmap.Config.ARGB_8888 for Bitmap.getConfig() when possible.

        On Android O+, this format will use ARGB_8888 only when it's not possible to use Bitmap.Config.HARDWARE. More information is available about hardware Bitmaps here: https://goo.gl/tn2A6k. If you need to disable hardware Bitmaps for a particular request, use BaseRequestOptions.disallowHardwareConfig().

        GIF images decoded by BitmapFactory currently use an internal hidden format that is returned as null from Bitmap.getConfig(). Since we cannot force BitmapFactory to always return our desired config, this setting is a preference, not a promise.

      • PREFER_RGB_565

        public static final DecodeFormat PREFER_RGB_565
        Bitmaps decoded from image formats that support and/or use alpha (some types of PNGs, GIFs etc) should return Bitmap.Config.ARGB_8888 for Bitmap.getConfig(). Bitmaps decoded from formats that don't support or use alpha should return Bitmap.Config.RGB_565 for Bitmap.getConfig().

        On Android O+, this format will use RGB_565 only when it's not possible to use Bitmap.Config.HARDWARE.

    • Field Detail

      • DEFAULT

        public static final DecodeFormat DEFAULT
        The default value for DecodeFormat.
    • Method Detail

      • values

        public static DecodeFormat[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DecodeFormat c : DecodeFormat.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DecodeFormat valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null