本文整理汇总了Java中com.nostra13.universalimageloader.core.decode.ImageDecodingInfo类的典型用法代码示例。如果您正苦于以下问题:Java ImageDecodingInfo类的具体用法?Java ImageDecodingInfo怎么用?Java ImageDecodingInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageDecodingInfo类属于com.nostra13.universalimageloader.core.decode包,在下文中一共展示了ImageDecodingInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
File targetFile = this.configuration.diskCache.get(this.uri);
if (targetFile == null || !targetFile.exists()) {
return false;
}
Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight), ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build()));
if (!(bmp == null || this.configuration.processorForDiskCache == null)) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey);
bmp = this.configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey);
}
}
if (bmp == null) {
return false;
}
boolean saved = this.configuration.diskCache.save(this.uri, bmp);
bmp.recycle();
return saved;
}
示例2: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
File targetFile = this.configuration.diskCache.get(this.uri);
if (targetFile == null || !targetFile.exists()) {
return false;
}
Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE
.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight)
, ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this
.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build()));
if (!(bmp == null || this.configuration.processorForDiskCache == null)) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey);
bmp = this.configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey);
}
}
if (bmp == null) {
return false;
}
boolean saved = this.configuration.diskCache.save(this.uri, bmp);
bmp.recycle();
return saved;
}
示例3: tryLoadBitmap
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
Bitmap bitmap = null;
try {
java.io.File imageFile = diskCache.get(getMessage().get_id());
if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
ViewScaleType viewScaleType = imageAware.getScaleType();
ImageSize imageSize = ImageSizeUtils.defineTargetSizeForView(imageAware, new ImageSize(MainApp.CONTEXT.getResources().getDisplayMetrics().widthPixels, MainApp.CONTEXT.getResources().getDisplayMetrics().heightPixels));
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),
ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()), getMessage().get_id(), imageSize, viewScaleType,
new BaseImageDownloader(MainApp.CONTEXT), options);
bitmap = decoder.decode(decodingInfo);
MainApp.memoryCache.put(getMessage().get_id(), bitmap);
}
} catch (Exception ignored) {
ignored.printStackTrace();
}
return bitmap;
}
示例4: prepareDecodingOptions
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
protected BitmapFactory.Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
ImageScaleType scaleType = decodingInfo.getImageScaleType();
int scale;
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
ImageSize targetSize = decodingInfo.getTargetSize();
boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
}
if (scale > 1 && loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
}
BitmapFactory.Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例5: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/** Decodes image file into Bitmap, resize it and save it back */
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}
示例6: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/**
* Decodes image file into Bitmap, resize it and save it back
*/
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}
示例7: decode
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
@Override
public Bitmap decode(ImageDecodingInfo imageDecodingInfo) throws IOException {
if (isThumbnailUri(Uri.parse(imageDecodingInfo.getOriginalImageUri()))) {
String originUrl = imageDecodingInfo.getOriginalImageUri();
String strId = originUrl.substring(16, originUrl.length());
long imageId = Long.parseLong(strId);
Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(
contentResolver, imageId, MediaStore.Images.Thumbnails.MINI_KIND, null);
// check the orientation of image
int rotation = 0;
Cursor mediaCursor = contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{"orientation"}, "_ID=" + imageId, null, null);
if (mediaCursor != null && mediaCursor.getCount() != 0) {
while (mediaCursor.moveToNext()) {
rotation = mediaCursor.getInt(0);
break;
}
}
if (mediaCursor != null && !mediaCursor.isClosed()) {
try {
mediaCursor.close();
} catch (Exception e) {
}
}
if (rotation != 0) {
return rotateImage(bitmap, rotation);
}
return bitmap;
} else {
return baseImageDecoder.decode(imageDecodingInfo);
}
}
示例8: decode
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/**
* Decodes image from URI into {@link Bitmap}. Image is scaled close to incoming {@linkplain ImageSize target size}
* during decoding (depend on incoming parameters).
*
* @param decodingInfo Needed data for decoding image
* @return Decoded bitmap
* @throws IOException if some I/O exception occurs during image reading
* @throws UnsupportedOperationException if image URI has unsupported scheme(protocol)
*/
@Override
public Bitmap decode(ImageDecodingInfo decodingInfo) throws IOException {
Bitmap decodedBitmap;
ImageFileInfo imageInfo;
InputStream imageStream = getImageStream(decodingInfo);
if (imageStream == null) {
L.e(ERROR_NO_IMAGE_STREAM, decodingInfo.getImageKey());
return null;
}
try {
imageInfo = defineImageSizeAndRotation(imageStream, decodingInfo);
imageStream = resetStream(imageStream, decodingInfo);
BitmapFactory.Options decodingOptions = prepareDecodingOptions(imageInfo.imageSize, decodingInfo);
decodedBitmap = BitmapFactory.decodeStream(imageStream, null, decodingOptions);
} finally {
IoUtils.closeSilently(imageStream);
}
if (decodedBitmap == null) {
L.e(ERROR_CANT_DECODE_IMAGE, decodingInfo.getImageKey());
} else {
decodedBitmap = considerExactScaleAndOrientatiton(decodedBitmap, decodingInfo, imageInfo.exif.rotation,
imageInfo.exif.flipHorizontal);
}
return decodedBitmap;
}
示例9: defineImageSizeAndRotation
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
protected ImageFileInfo defineImageSizeAndRotation(InputStream imageStream, ImageDecodingInfo decodingInfo)
throws IOException {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(imageStream, null, options);
ExifInfo exif;
String imageUri = decodingInfo.getImageUri();
if (decodingInfo.shouldConsiderExifParams() && canDefineExifParams(imageUri, options.outMimeType)) {
exif = defineExifOrientation(imageUri);
} else {
exif = new ExifInfo();
}
return new ImageFileInfo(new ImageSize(options.outWidth, options.outHeight, exif.rotation), exif);
}
示例10: resetStream
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
protected InputStream resetStream(InputStream imageStream, ImageDecodingInfo decodingInfo) throws IOException {
try {
imageStream.reset();
} catch (IOException e) {
IoUtils.closeSilently(imageStream);
imageStream = getImageStream(decodingInfo);
}
return imageStream;
}
示例11: considerExactScaleAndOrientatiton
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo,
int rotation, boolean flipHorizontal) {
Matrix m = new Matrix();
// Scale to exact size if need
ImageScaleType scaleType = decodingInfo.getImageScaleType();
if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation);
float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo
.getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED);
if (Float.compare(scale, 1f) != 0) {
m.setScale(scale, scale);
if (loggingEnabled) {
L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey());
}
}
}
// Flip bitmap if need
if (flipHorizontal) {
m.postScale(-1, 1);
if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
}
// Rotate bitmap if need
if (rotation != 0) {
m.postRotate(rotation);
if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey());
}
Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap
.getHeight(), m, true);
if (finalBitmap != subsampledBitmap) {
subsampledBitmap.recycle();
}
return finalBitmap;
}
示例12: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/** Decodes image file into Bitmap, resize it and save it back */
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(memoryCacheKey);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(memoryCacheKey, bmp);
bmp.recycle();
}
}
return saved;
}
示例13: a
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
private boolean a(int i1, int j1)
{
File file = C.o.get(a);
if (file != null && file.exists())
{
ImageSize imagesize = new ImageSize(i1, j1);
DisplayImageOptions displayimageoptions = (new DisplayImageOptions.Builder()).cloneFrom(c).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo imagedecodinginfo = new ImageDecodingInfo(H, com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.FILE.wrap(file.getAbsolutePath()), a, imagesize, ViewScaleType.FIT_INSIDE, h(), displayimageoptions);
Bitmap bitmap = G.decode(imagedecodinginfo);
if (bitmap != null && C.f != null)
{
Object aobj[] = new Object[1];
aobj[0] = H;
L.d("Process image before cache on disk [%s]", aobj);
bitmap = C.f.process(bitmap);
if (bitmap == null)
{
Object aobj1[] = new Object[1];
aobj1[0] = H;
L.e("Bitmap processor for disk cache returned null [%s]", aobj1);
}
}
Bitmap bitmap1 = bitmap;
if (bitmap1 != null)
{
boolean flag = C.o.save(a, bitmap1);
bitmap1.recycle();
return flag;
}
}
return false;
}
示例14: decodeImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/**
* 根据图片资源地址进行解码图片
* @param imageUri 图片资源地址
* @return
* @throws IOException
*/
private Bitmap decodeImage(String imageUri) throws IOException {
ViewScaleType viewScaleType = imageAware.getScaleType();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey, imageUri, uri, targetSize, viewScaleType,
getDownloader(), options);
return decoder.decode(decodingInfo);
}
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:13,代码来源:LoadAndDisplayImageTask.java
示例15: resizeAndSaveImage
import com.nostra13.universalimageloader.core.decode.ImageDecodingInfo; //导入依赖的package包/类
/**
* Decodes image file into Bitmap, resize it and save it back
* 解码图片 进行图片尺寸修改,然后保存
*/
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
//构建图片尺寸size对象
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
//图片显示配置参数构建
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
//获取解码之后的图片
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
//图片重新保存本地文件系统
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:35,代码来源:LoadAndDisplayImageTask.java