1 package com.bumptech.glide.load; 2 3 import android.os.Build; 4 5 /** 6 * Options for setting the value of {@link android.graphics.Bitmap#getConfig()} for {@link android.graphics.Bitmap}s 7 * returned by a {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder}. 8 * 9 * <p> 10 * Note - In some cases it may not be possible to obey the requested setting, not all 11 * {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder}s support setting formats and certain images may 12 * not be able to be loaded as certain configurations. Therefore this class represents a preference rather than a 13 * requirement. 14 * </p> 15 */ 16 public enum DecodeFormat { 17 /** 18 * All bitmaps returned by the {@link com.bumptech.glide.load.resource.bitmap.BitmapDecoder} should return 19 * {@link android.graphics.Bitmap.Config#ARGB_8888} for {@link android.graphics.Bitmap#getConfig()}. 20 */ 21 ALWAYS_ARGB_8888, 22 23 /** 24 * Bitmaps decoded from image formats that support and/or use alpha (some types of PNGs, GIFs etc) should 25 * return {@link android.graphics.Bitmap.Config#ARGB_8888} for {@link android.graphics.Bitmap#getConfig()}. Bitmaps 26 * decoded from formats that don't support or use alpha should return 27 * {@link android.graphics.Bitmap.Config#RGB_565} for {@link android.graphics.Bitmap#getConfig()}. 28 * 29 */ 30 PREFER_RGB_565; 31 32 /** The default value for DecodeFormat. */ 33 public static final DecodeFormat DEFAULT = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT 34 ? ALWAYS_ARGB_8888 : PREFER_RGB_565; 35 } 36