BitmapRequestBuilder(LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> loadProvider, Class<TranscodeType> transcodeClass, GenericRequestBuilder<ModelType, ?, ?, ?> other) { super(loadProvider, transcodeClass, other); this.bitmapPool = other.glide.getBitmapPool(); this.decodeFormat = other.glide.getDecodeFormat(); imageDecoder = new StreamBitmapDecoder(bitmapPool, decodeFormat); videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool, decodeFormat); }
public FileDescriptorBitmapDataLoadProvider(BitmapPool bitmapPool, DecodeFormat decodeFormat) { cacheDecoder = new FileToStreamDecoder<Bitmap>(new StreamBitmapDecoder(bitmapPool, decodeFormat)); sourceDecoder = new FileDescriptorBitmapDecoder(bitmapPool, decodeFormat); encoder = new BitmapEncoder(); sourceEncoder = NullEncoder.get(); }
/** * Sets the preferred format for {@link Bitmap}s decoded in this request. Defaults to * {@link DecodeFormat#PREFER_RGB_565}. This replaces any previous calls to {@link #imageDecoder(ResourceDecoder)}, * {@link #videoDecoder(ResourceDecoder)}, {@link #decoder(ResourceDecoder)} and * {@link #cacheDecoder(ResourceDecoder)}} with default decoders with the appropriate * options set. * * <p> * Note - If using a {@link Transformation} that expect bitmaps to support transparency, this should always be * set to ALWAYS_ARGB_8888. RGB_565 requires fewer bytes per pixel and is generally preferable, but it does not * support transparency. * </p> * * @see DecodeFormat * * @param format The format to use. * @return This request builder. */ public BitmapRequestBuilder<ModelType, TranscodeType> format(DecodeFormat format) { this.decodeFormat = format; imageDecoder = new StreamBitmapDecoder(downsampler, bitmapPool, format); videoDecoder = new FileDescriptorBitmapDecoder(new VideoBitmapDecoder(), bitmapPool, format); super.cacheDecoder(new FileToStreamDecoder<Bitmap>(new StreamBitmapDecoder(downsampler, bitmapPool, format))); super.decoder(new ImageVideoBitmapDecoder(imageDecoder, videoDecoder)); return this; }