Enum Class PreferredColorSpace
- All Implemented Interfaces:
Serializable,Comparable<PreferredColorSpace>,java.lang.constant.Constable
On Android O, Glide will always request SRGB and will ignore this option if set. A bug on Android O prevents P3 images from being compressed correctly and can result in color distortion. We may eventually work around this in Glide if sufficient demand arises, but doing so will require a memory intensive conversion to SRGB prior to compressing Bitmaps to Glide's disk cache. This work around would also work only for Glide's compression, not for any compression that a caller performs on a Bitmap returned by Glide.
On Android P+, Glide supports SRGB and display P3. However, if display p3 is requested, we
will still decode to SRGB unless BitmapFactory.Options.outColorSpace is
also ColorSpace.Named.DISPLAY_P3. Preferring P3 for SRGB images adds
unnecessary CPU work to convert back and forth between the color spaces at decode time.
Using DISPLAY_P3 is wasteful if either the screen or the renderer do not support P3.
Currently Glide does not attempt to detect whether or not this support is present. Do not use
DISPLAY_P3 thinking that you're going to get higher quality by default. Only use DISPLAY_P3 if you're confident you understand color spaces, your application is working with a
display that supports wide gamut and you've set the appropriate options to render wide gamut
colors. If you've missed one or more of these steps, DISPLAY_P3 can lead to poor color
quality and washed out looking images. When in doubt, always use SRGB, which is Glide's
default.
As with DecodeFormat we cannot directly set color spaces, we can only suggest to the
framework which one we want. Setting one of these values is not a guarantee that any returned
Bitmap will actually use the requested color space.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPrefers to decode images usingColorSpace.Named.DISPLAY_P3.Prefers to decode images usingColorSpace.Named.SRGB. -
Method Summary
Modifier and TypeMethodDescriptionstatic PreferredColorSpaceReturns the enum constant of this class with the specified name.static PreferredColorSpace[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SRGB
Prefers to decode images usingColorSpace.Named.SRGB. -
DISPLAY_P3
Prefers to decode images usingColorSpace.Named.DISPLAY_P3.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-