com.nostra13.universalimageloader.core.decode
Class BaseImageDecoder

java.lang.Object
  extended by com.nostra13.universalimageloader.core.decode.BaseImageDecoder
All Implemented Interfaces:
ImageDecoder

public class BaseImageDecoder
extends Object
implements ImageDecoder

Decodes images to Bitmap, scales them to needed size

Since:
1.8.3
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)
See Also:
ImageDecodingInfo

Nested Class Summary
protected static class BaseImageDecoder.ExifInfo
           
protected static class BaseImageDecoder.ImageFileInfo
           
 
Field Summary
protected static String ERROR_CANT_DECODE_IMAGE
           
protected static String LOG_FLIP_IMAGE
           
protected static String LOG_ROTATE_IMAGE
           
protected static String LOG_SCALE_IMAGE
           
protected static String LOG_SUBSAMPLE_IMAGE
           
protected  boolean loggingEnabled
           
 
Constructor Summary
BaseImageDecoder(boolean loggingEnabled)
           
 
Method Summary
protected  android.graphics.Bitmap considerExactScaleAndOrientatiton(android.graphics.Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo, int rotation, boolean flipHorizontal)
           
 android.graphics.Bitmap decode(ImageDecodingInfo decodingInfo)
          Decodes image from URI into Bitmap.
protected  BaseImageDecoder.ExifInfo defineExifOrientation(String imageUri)
           
protected  BaseImageDecoder.ImageFileInfo defineImageSizeAndRotation(InputStream imageStream, ImageDecodingInfo decodingInfo)
           
protected  InputStream getImageStream(ImageDecodingInfo decodingInfo)
           
protected  android.graphics.BitmapFactory.Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo)
           
protected  InputStream resetStream(InputStream imageStream, ImageDecodingInfo decodingInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_SUBSAMPLE_IMAGE

protected static final String LOG_SUBSAMPLE_IMAGE
See Also:
Constant Field Values

LOG_SCALE_IMAGE

protected static final String LOG_SCALE_IMAGE
See Also:
Constant Field Values

LOG_ROTATE_IMAGE

protected static final String LOG_ROTATE_IMAGE
See Also:
Constant Field Values

LOG_FLIP_IMAGE

protected static final String LOG_FLIP_IMAGE
See Also:
Constant Field Values

ERROR_CANT_DECODE_IMAGE

protected static final String ERROR_CANT_DECODE_IMAGE
See Also:
Constant Field Values

loggingEnabled

protected final boolean loggingEnabled
Constructor Detail

BaseImageDecoder

public BaseImageDecoder(boolean loggingEnabled)
Parameters:
loggingEnabled - Whether debug logs will be written to LogCat. Usually should match ImageLoaderConfiguration.writeDebugLogs()
Method Detail

decode

public android.graphics.Bitmap decode(ImageDecodingInfo decodingInfo)
                               throws IOException
Decodes image from URI into Bitmap. Image is scaled close to incoming target size during decoding (depend on incoming parameters).

Specified by:
decode in interface ImageDecoder
Parameters:
decodingInfo - Needed data for decoding image
Returns:
Decoded bitmap
Throws:
IOException - if some I/O exception occurs during image reading
UnsupportedOperationException - if image URI has unsupported scheme(protocol)

getImageStream

protected InputStream getImageStream(ImageDecodingInfo decodingInfo)
                              throws IOException
Throws:
IOException

defineImageSizeAndRotation

protected BaseImageDecoder.ImageFileInfo defineImageSizeAndRotation(InputStream imageStream,
                                                                    ImageDecodingInfo decodingInfo)
                                                             throws IOException
Throws:
IOException

defineExifOrientation

protected BaseImageDecoder.ExifInfo defineExifOrientation(String imageUri)

prepareDecodingOptions

protected android.graphics.BitmapFactory.Options prepareDecodingOptions(ImageSize imageSize,
                                                                        ImageDecodingInfo decodingInfo)

resetStream

protected InputStream resetStream(InputStream imageStream,
                                  ImageDecodingInfo decodingInfo)
                           throws IOException
Throws:
IOException

considerExactScaleAndOrientatiton

protected android.graphics.Bitmap considerExactScaleAndOrientatiton(android.graphics.Bitmap subsampledBitmap,
                                                                    ImageDecodingInfo decodingInfo,
                                                                    int rotation,
                                                                    boolean flipHorizontal)


Copyright © 2011-2014. All Rights Reserved.