本文整理汇总了Java中com.bumptech.glide.load.resource.bitmap.BitmapEncoder类的典型用法代码示例。如果您正苦于以下问题:Java BitmapEncoder类的具体用法?Java BitmapEncoder怎么用?Java BitmapEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BitmapEncoder类属于com.bumptech.glide.load.resource.bitmap包,在下文中一共展示了BitmapEncoder类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFallbackPicture
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
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);
}
示例2: GifFrameManager
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
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();
}
}
示例3: encodeFormat
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
/**
* Sets the value for key
* {@link com.bumptech.glide.load.resource.bitmap.BitmapEncoder#COMPRESSION_FORMAT}.
*/
@CheckResult
public RequestOptions encodeFormat(@NonNull Bitmap.CompressFormat format) {
return set(BitmapEncoder.COMPRESSION_FORMAT, Preconditions.checkNotNull(format));
}
示例4: encodeQuality
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
/**
* Sets the value for key
* {@link BitmapEncoder#COMPRESSION_QUALITY}.
*/
@CheckResult
public RequestOptions encodeQuality(@IntRange(from = 0, to = 100) int quality) {
return set(BitmapEncoder.COMPRESSION_QUALITY, quality);
}
示例5: encodeFormat
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
/**
* Sets the value for key
* {@link com.bumptech.glide.load.resource.bitmap.BitmapEncoder#COMPRESSION_FORMAT}.
*/
public RequestOptions encodeFormat(@NonNull Bitmap.CompressFormat format) {
return set(BitmapEncoder.COMPRESSION_FORMAT, Preconditions.checkNotNull(format));
}
示例6: encodeQuality
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder; //导入依赖的package包/类
/**
* Sets the value for key
* {@link BitmapEncoder#COMPRESSION_QUALITY}.
*/
public RequestOptions encodeQuality(int quality) {
return set(BitmapEncoder.COMPRESSION_QUALITY, quality);
}