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 java.lang.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 java.lang.String ERROR_CANT_DECODE_IMAGE
           
protected static java.lang.String LOG_FLIP_IMAGE
           
protected static java.lang.String LOG_ROTATE_IMAGE
           
protected static java.lang.String LOG_SABSAMPLE_IMAGE
           
protected static java.lang.String LOG_SCALE_IMAGE
           
protected  boolean loggingEnabled
           
 
Constructor Summary
BaseImageDecoder(boolean loggingEnabled)
           
 
Method Summary
protected  android.graphics.Bitmap considerExactScaleAndOrientaiton(android.graphics.Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo, int rotation, boolean flipHorizontal)
           
 android.graphics.Bitmap decode(ImageDecodingInfo decodingInfo)
          Decodes image from URI into Bitmap.
protected  android.graphics.Bitmap decodeStream(java.io.InputStream imageStream, android.graphics.BitmapFactory.Options decodingOptions)
           
protected  BaseImageDecoder.ExifInfo defineExifOrientation(java.lang.String imageUri)
           
protected  BaseImageDecoder.ImageFileInfo defineImageSizeAndRotation(java.io.InputStream imageStream, ImageDecodingInfo decodingInfo)
           
protected  java.io.InputStream getImageStream(ImageDecodingInfo decodingInfo)
           
protected  android.graphics.BitmapFactory.Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo)
           
protected  java.io.InputStream resetStream(java.io.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_SABSAMPLE_IMAGE

protected static final java.lang.String LOG_SABSAMPLE_IMAGE
See Also:
Constant Field Values

LOG_SCALE_IMAGE

protected static final java.lang.String LOG_SCALE_IMAGE
See Also:
Constant Field Values

LOG_ROTATE_IMAGE

protected static final java.lang.String LOG_ROTATE_IMAGE
See Also:
Constant Field Values

LOG_FLIP_IMAGE

protected static final java.lang.String LOG_FLIP_IMAGE
See Also:
Constant Field Values

ERROR_CANT_DECODE_IMAGE

protected static final java.lang.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 java.io.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:
java.io.IOException - if some I/O exception occurs during image reading
java.lang.UnsupportedOperationException - if image URI has unsupported scheme(protocol)

getImageStream

protected java.io.InputStream getImageStream(ImageDecodingInfo decodingInfo)
                                      throws java.io.IOException
Throws:
java.io.IOException

defineImageSizeAndRotation

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

defineExifOrientation

protected BaseImageDecoder.ExifInfo defineExifOrientation(java.lang.String imageUri)

prepareDecodingOptions

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

resetStream

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

decodeStream

protected android.graphics.Bitmap decodeStream(java.io.InputStream imageStream,
                                               android.graphics.BitmapFactory.Options decodingOptions)
                                        throws java.io.IOException
Throws:
java.io.IOException

considerExactScaleAndOrientaiton

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


Copyright © 2011-2013. All Rights Reserved.