19fc12334a7d14347cd6951d0653264b2597bd3a0Sam Juddpackage com.bumptech.glide.load;
276fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd
3162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Juddimport android.os.Build;
4162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd
576fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd/**
6fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd * Options for setting the value of {@link android.graphics.Bitmap#getConfig()} for {@link android.graphics.Bitmap}s
7fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd * returned by a {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder}.
876fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd *
976fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd * <p>
10fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd *     Note - In some cases it may not be possible to obey the requested setting, not all
11fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd *     {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder}s support setting formats and certain images may
12fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd *     not be able to be loaded as certain configurations. Therefore this class represents a preference rather than a
13fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd *     requirement.
1476fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd * </p>
1576fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd */
1676fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Juddpublic enum DecodeFormat {
1776fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd    /**
18fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd     * All bitmaps returned by the {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder} should return
19fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd     * {@link android.graphics.Bitmap.Config#ARGB_8888} for {@link android.graphics.Bitmap#getConfig()}.
2076fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     */
2176fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd    ALWAYS_ARGB_8888,
2276fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd
2376fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd    /**
2476fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     * Bitmaps decoded from image formats that support and/or use alpha (some types of PNGs, GIFs etc) should
25fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd     * return {@link android.graphics.Bitmap.Config#ARGB_8888} for {@link android.graphics.Bitmap#getConfig()}. Bitmaps
26fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd     * decoded from formats that don't support or use alpha should return
27fe090f50f3040f4d478143a3e0ffa8cdf813fefcSam Judd     * {@link android.graphics.Bitmap.Config#RGB_565} for {@link android.graphics.Bitmap#getConfig()}.
2876fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     *
2976fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     */
30162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd    PREFER_RGB_565;
31162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd
32162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd    /** The default value for DecodeFormat. */
33162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd    public static final DecodeFormat DEFAULT = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT
34162c0ca87fa61299bfd13b18fe8bea76772e05f0Sam Judd            ? ALWAYS_ARGB_8888 : PREFER_RGB_565;
3576fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd}
36