use of jp.wasabeef.fresco.processors.GrayscalePostprocessor in project DevRing by LJYcoder.
the class FrescoManager method getImageRequest.
/**
* 构建、获取ImageRequest
*
* @param uri 加载路径
* @param simpleDraweeView 加载的图片控件
* @param loadOption 临时加载选项
* @return ImageRequest
*/
private ImageRequest getImageRequest(Uri uri, SimpleDraweeView simpleDraweeView, LoadOption loadOption) {
int width;
int height;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
width = simpleDraweeView.getWidth();
height = simpleDraweeView.getHeight();
} else {
width = simpleDraweeView.getMaxWidth();
height = simpleDraweeView.getMaxHeight();
}
// 根据加载路径生成ImageRequest的构造者
ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
// 调整解码图片的大小
if (width > 0 && height > 0) {
builder.setResizeOptions(new ResizeOptions(width, height));
}
// 是否开启渐进式加载,仅支持JPEG图片
builder.setProgressiveRenderingEnabled(true);
if (loadOption != null) {
// 图片变换处理
CombinePostProcessors.Builder processorBuilder = new CombinePostProcessors.Builder();
if (loadOption.getBlurRadius() > 0) {
processorBuilder.add(new BlurPostprocessor(mContext, loadOption.getBlurRadius()));
}
if (loadOption.isGray()) {
processorBuilder.add(new GrayscalePostprocessor());
}
builder.setPostprocessor(processorBuilder.build());
}
return builder.build();
}
use of jp.wasabeef.fresco.processors.GrayscalePostprocessor in project DevRing by LJYcoder.
the class FrescoManager method getImageRequest.
/**
* 构建、获取ImageRequest
*
* @param uri 加载路径
* @param simpleDraweeView 加载的图片控件
* @param loadOption 临时加载选项
* @return ImageRequest
*/
private ImageRequest getImageRequest(Uri uri, SimpleDraweeView simpleDraweeView, LoadOption loadOption) {
int width;
int height;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
width = simpleDraweeView.getWidth();
height = simpleDraweeView.getHeight();
} else {
width = simpleDraweeView.getMaxWidth();
height = simpleDraweeView.getMaxHeight();
}
// 根据加载路径生成ImageRequest的构造者
ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
// 调整解码图片的大小
if (width > 0 && height > 0) {
builder.setResizeOptions(new ResizeOptions(width, height));
}
// 是否开启渐进式加载,仅支持JPEG图片
builder.setProgressiveRenderingEnabled(true);
if (loadOption != null) {
// 图片变换处理
CombinePostProcessors.Builder processorBuilder = new CombinePostProcessors.Builder();
if (loadOption.getBlurRadius() > 0) {
processorBuilder.add(new BlurPostprocessor(mContext, loadOption.getBlurRadius()));
}
if (loadOption.isGray()) {
processorBuilder.add(new GrayscalePostprocessor());
}
builder.setPostprocessor(processorBuilder.build());
if (!loadOption.isUseMemoryCache()) {
// Fresco貌似不支持禁用内存缓存?
}
if (!loadOption.isUseDiskCache()) {
builder.disableDiskCache();
}
} else {
if (!mImageConfig.isUseMemoryCache()) {
// Fresco貌似不支持禁用内存缓存?
}
if (!mImageConfig.isUseDiskCache()) {
builder.disableDiskCache();
}
}
return builder.build();
}
Aggregations