Class Downsampler

java.lang.Object
com.bumptech.glide.load.resource.bitmap.Downsampler

public final class Downsampler extends Object
Downsamples, decodes, and rotates images according to their exif orientation using BitmapFactory.
  • Field Details

    • DECODE_FORMAT

      public static final Option<DecodeFormat> DECODE_FORMAT
      Indicates the DecodeFormat that will be used in conjunction with the image format to determine the Bitmap.Config to provide to BitmapFactory.Options.inPreferredConfig when decoding the image.
    • PREFERRED_COLOR_SPACE

      public static final Option<PreferredColorSpace> PREFERRED_COLOR_SPACE
      Sets the PreferredColorSpace that will be used along with the version of Android and color space of the requested image to determine the final color space used to decode the image.

      Refer to PreferredColorSpace for details on how this option works and its various limitations.

    • DOWNSAMPLE_STRATEGY

      @Deprecated public static final Option<DownsampleStrategy> DOWNSAMPLE_STRATEGY
      Deprecated.
      Use DownsampleStrategy.OPTION directly instead.
      Indicates the DownsampleStrategy option that will be used to calculate the sample size to use to downsample an image given the original and target dimensions of the image.
    • FIX_BITMAP_SIZE_TO_REQUESTED_DIMENSIONS

      public static final Option<Boolean> FIX_BITMAP_SIZE_TO_REQUESTED_DIMENSIONS
      Ensure that the size of the bitmap is fixed to the requested width and height of the resource from the caller. The final resource dimensions may differ from the requested width and height, and thus setting this to true may result in the bitmap size differing from the resource dimensions.

      This can be used as a performance optimization for KitKat and above by fixing the size of the bitmap for a collection of requested resources so that the bitmap pool will not need to allocate new bitmaps for images of different sizes.

    • ALLOW_HARDWARE_CONFIG

      public static final Option<Boolean> ALLOW_HARDWARE_CONFIG
      Indicates that it's safe or unsafe to decode Bitmaps with Bitmap.Config.HARDWARE.

      Callers should almost never set this value to true manually. Glide will already do so when Glide believes it's safe to do (when no transformations are applied). Instead, callers can set this value to false to prevent Glide from decoding hardware bitmaps if Glide is unable to detect that hardware bitmaps are unsafe. For example, you should set this to false if you plan to draw it to a software Canvas or if you plan to inspect the Bitmaps pixels with Bitmap.getPixel(int, int) or Bitmap.getPixels(int[], int, int, int, int, int, int).

      Callers can disable hardware Bitmaps for all loads using GlideBuilder.setDefaultRequestOptions(RequestOptions).

      This option is ignored unless we're on Android O+.

  • Constructor Details

  • Method Details