Java 类com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder 实例源码

项目:q-mail    文件:ContactPictureLoader.java   
private void loadFallbackPicture(Address address, ImageView imageView) {
    Context context = imageView.getContext();

    Glide.with(context)
            .using(new FallbackGlideModelLoader(), FallbackGlideParams.class)
            .from(FallbackGlideParams.class)
            .as(Bitmap.class)
            .transcode(new BitmapToGlideDrawableTranscoder(context), GlideDrawable.class)
            .decoder(new FallbackGlideBitmapDecoder(context))
            .encoder(new BitmapEncoder(Bitmap.CompressFormat.PNG, 0))
            .cacheDecoder(new FileToStreamDecoder<>(new StreamBitmapDecoder(context)))
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .load(new FallbackGlideParams(address))
            // for some reason, following 2 lines fix loading issues.
            .dontAnimate()
            .override(mPictureSizeInPx, mPictureSizeInPx)
            .into(imageView);
}
项目:saarang-iosched    文件:GifFrameManager.java   
public GifFrameManager(Context context, GifDecoder decoder, Handler mainHandler,
        Transformation<Bitmap> transformation) {
    this.context = context;
    this.decoder = decoder;
    this.mainHandler = mainHandler;
    this.transformation = transformation;
    calculator = new MemorySizeCalculator(context);
    frameLoader = new GifFrameModelLoader();
    frameResourceDecoder = new GifFrameResourceDecoder();

    if (!decoder.isTransparent()) {
        // For non transparent gifs, we can beat the performance of our gif decoder for each frame by decoding jpegs
        // from disk.
        cacheDecoder = new StreamBitmapDecoder(context);
        encoder = new BitmapEncoder(Bitmap.CompressFormat.JPEG, 70);
    } else {
        // For transparent gifs, we would have to encode as pngs which is actually slower than our gif decoder so we
        // avoid writing frames to the disk cache entirely.
        cacheDecoder = NullCacheDecoder.get();
        encoder = SkipCache.get();
    }
}
项目:AppDevFestSudeste2015    文件:GifFrameManager.java   
public GifFrameManager(Context context, GifDecoder decoder, Handler mainHandler,
        Transformation<Bitmap> transformation) {
    this.context = context;
    this.decoder = decoder;
    this.mainHandler = mainHandler;
    this.transformation = transformation;
    calculator = new MemorySizeCalculator(context);
    frameLoader = new GifFrameModelLoader();
    frameResourceDecoder = new GifFrameResourceDecoder();

    if (!decoder.isTransparent()) {
        // For non transparent gifs, we can beat the performance of our gif decoder for each frame by decoding jpegs
        // from disk.
        cacheDecoder = new StreamBitmapDecoder(context);
        encoder = new BitmapEncoder(Bitmap.CompressFormat.JPEG, 70);
    } else {
        // For transparent gifs, we would have to encode as pngs which is actually slower than our gif decoder so we
        // avoid writing frames to the disk cache entirely.
        cacheDecoder = NullCacheDecoder.get();
        encoder = SkipCache.get();
    }
}
项目:devfestnorte-app    文件:GifFrameManager.java   
public GifFrameManager(Context context, GifDecoder decoder, Handler mainHandler,
        Transformation<Bitmap> transformation) {
    this.context = context;
    this.decoder = decoder;
    this.mainHandler = mainHandler;
    this.transformation = transformation;
    calculator = new MemorySizeCalculator(context);
    frameLoader = new GifFrameModelLoader();
    frameResourceDecoder = new GifFrameResourceDecoder();

    if (!decoder.isTransparent()) {
        // For non transparent gifs, we can beat the performance of our gif decoder for each frame by decoding jpegs
        // from disk.
        cacheDecoder = new StreamBitmapDecoder(context);
        encoder = new BitmapEncoder(Bitmap.CompressFormat.JPEG, 70);
    } else {
        // For transparent gifs, we would have to encode as pngs which is actually slower than our gif decoder so we
        // avoid writing frames to the disk cache entirely.
        cacheDecoder = NullCacheDecoder.get();
        encoder = SkipCache.get();
    }
}
项目:saarang-iosched    文件:GifFrameManager.java   
public GifFrameManager(Context context, GifDecoder decoder, Handler mainHandler,
        Transformation<Bitmap> transformation) {
    this.context = context;
    this.decoder = decoder;
    this.mainHandler = mainHandler;
    this.transformation = transformation;
    calculator = new MemorySizeCalculator(context);
    frameLoader = new GifFrameModelLoader();
    frameResourceDecoder = new GifFrameResourceDecoder();

    if (!decoder.isTransparent()) {
        // For non transparent gifs, we can beat the performance of our gif decoder for each frame by decoding jpegs
        // from disk.
        cacheDecoder = new StreamBitmapDecoder(context);
        encoder = new BitmapEncoder(Bitmap.CompressFormat.JPEG, 70);
    } else {
        // For transparent gifs, we would have to encode as pngs which is actually slower than our gif decoder so we
        // avoid writing frames to the disk cache entirely.
        cacheDecoder = NullCacheDecoder.get();
        encoder = SkipCache.get();
    }
}
项目:GlidePlus    文件:ImageWrapperStreamResourceDecoder.java   
public ImageWrapperStreamResourceDecoder(Context context) {
    StreamBitmapDecoder streamBitmapDecoder = new StreamBitmapDecoder(context);
    FileDescriptorBitmapDecoder fileDescriptorBitmapDecoder = new FileDescriptorBitmapDecoder(context);
    ImageVideoBitmapDecoder imageVideoBitmapDecoder = new ImageVideoBitmapDecoder(streamBitmapDecoder, fileDescriptorBitmapDecoder);
    GifResourceDecoder gifResourceDecoder = new GifResourceDecoder();
    BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
    this.gifBitmapDecoder = new ImageWrapperResourceDecoder(imageVideoBitmapDecoder, gifResourceDecoder, bitmapPool);
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:AppDevFestSudeste2015    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:devfestnorte-app    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
/**
 * Load images using the given {@link Downsampler}. Replaces any existing image decoder. Defaults to
 * {@link Downsampler#AT_LEAST}. Will be ignored if the data represented by the model is a video. This replaces any
 * previous calls to {@link #imageDecoder(ResourceDecoder)}  and {@link #decoder(ResourceDecoder)} with default
 * decoders with the appropriate options set.
 *
 * @see #imageDecoder
 *
 * @param downsampler The downsampler
 * @return This RequestBuilder
 */
private BitmapRequestBuilder<ModelType, TranscodeType> downsample(Downsampler downsampler) {
    this.downsampler = downsampler;
    imageDecoder = new StreamBitmapDecoder(downsampler, bitmapPool, decodeFormat);
    super.decoder(new ImageVideoBitmapDecoder(imageDecoder, videoDecoder));
    return this;
}
项目:AppDevFestSudeste2015    文件:BitmapRequestBuilder.java   
/**
 * Load images using the given {@link Downsampler}. Replaces any existing image decoder. Defaults to
 * {@link Downsampler#AT_LEAST}. Will be ignored if the data represented by the model is a video. This replaces any
 * previous calls to {@link #imageDecoder(ResourceDecoder)}  and {@link #decoder(ResourceDecoder)} with default
 * decoders with the appropriate options set.
 *
 * @see #imageDecoder
 *
 * @param downsampler The downsampler
 * @return This RequestBuilder
 */
private BitmapRequestBuilder<ModelType, TranscodeType> downsample(Downsampler downsampler) {
    this.downsampler = downsampler;
    imageDecoder = new StreamBitmapDecoder(downsampler, bitmapPool, decodeFormat);
    super.decoder(new ImageVideoBitmapDecoder(imageDecoder, videoDecoder));
    return this;
}
项目:devfestnorte-app    文件:BitmapRequestBuilder.java   
/**
 * Load images using the given {@link Downsampler}. Replaces any existing image decoder. Defaults to
 * {@link Downsampler#AT_LEAST}. Will be ignored if the data represented by the model is a video. This replaces any
 * previous calls to {@link #imageDecoder(ResourceDecoder)}  and {@link #decoder(ResourceDecoder)} with default
 * decoders with the appropriate options set.
 *
 * @see #imageDecoder
 *
 * @param downsampler The downsampler
 * @return This RequestBuilder
 */
private BitmapRequestBuilder<ModelType, TranscodeType> downsample(Downsampler downsampler) {
    this.downsampler = downsampler;
    imageDecoder = new StreamBitmapDecoder(downsampler, bitmapPool, decodeFormat);
    super.decoder(new ImageVideoBitmapDecoder(imageDecoder, videoDecoder));
    return this;
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
/**
 * Load images using the given {@link Downsampler}. Replaces any existing image decoder. Defaults to
 * {@link Downsampler#AT_LEAST}. Will be ignored if the data represented by the model is a video. This replaces any
 * previous calls to {@link #imageDecoder(ResourceDecoder)}  and {@link #decoder(ResourceDecoder)} with default
 * decoders with the appropriate options set.
 *
 * @see #imageDecoder
 *
 * @param downsampler The downsampler
 * @return This RequestBuilder
 */
private BitmapRequestBuilder<ModelType, TranscodeType> downsample(Downsampler downsampler) {
    this.downsampler = downsampler;
    imageDecoder = new StreamBitmapDecoder(downsampler, bitmapPool, decodeFormat);
    super.decoder(new ImageVideoBitmapDecoder(imageDecoder, videoDecoder));
    return this;
}