com.nostra13.universalimageloader.core.assist
Enum ImageScaleType

java.lang.Object
  extended by java.lang.Enum<ImageScaleType>
      extended by com.nostra13.universalimageloader.core.assist.ImageScaleType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ImageScaleType>

public enum ImageScaleType
extends java.lang.Enum<ImageScaleType>

Type of image scaling during decoding.

Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Enum Constant Summary
EXACT
          Deprecated. Will be deleted in the future. Use IN_SAMPLE_INT.
EXACTLY
          Image will scaled-down exactly to target size (scaled width or height or both will be equal to target size; depends on ImageView's scale type).
EXACTLY_STRETCHED
          Image will scaled exactly to target size (scaled width or height or both will be equal to target size; depends on ImageView's scale type).
IN_SAMPLE_INT
          Image will be subsampled in an integer number of times.
IN_SAMPLE_POWER_OF_2
          Image will be reduces 2-fold until next reduce step make image smaller target size.
POWER_OF_2
          Deprecated. Will be deleted in the future. Use IN_SAMPLE_POWER_OF_2.
 
Method Summary
static ImageScaleType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ImageScaleType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

POWER_OF_2

@Deprecated
public static final ImageScaleType POWER_OF_2
Deprecated. Will be deleted in the future. Use IN_SAMPLE_POWER_OF_2.
The same as IN_SAMPLE_POWER_OF_2


IN_SAMPLE_POWER_OF_2

public static final ImageScaleType IN_SAMPLE_POWER_OF_2
Image will be reduces 2-fold until next reduce step make image smaller target size.
It's fast type and it's preferable for usage in lists/grids/galleries (and other adapter-views) .
Relates to BitmapFactory.Options#inSampleSize
Note: If original image size is smaller than target size then original image won't be scaled.


EXACT

@Deprecated
public static final ImageScaleType EXACT
Deprecated. Will be deleted in the future. Use IN_SAMPLE_INT.
The same as IN_SAMPLE_INT


IN_SAMPLE_INT

public static final ImageScaleType IN_SAMPLE_INT
Image will be subsampled in an integer number of times. Use it if memory economy is quite important.
Relates to BitmapFactory.Options#inSampleSize
Note: If original image size is smaller than target size then original image won't be scaled.


EXACTLY

public static final ImageScaleType EXACTLY
Image will scaled-down exactly to target size (scaled width or height or both will be equal to target size; depends on ImageView's scale type). Use it if memory economy is critically important.
Note: If original image size is smaller than target size then original image won't be scaled.

Important note: For creating result Bitmap (of exact size) additional Bitmap will be created with Bitmap.createScaledBitmap(...). So this scale type requires more memory for creation of result Bitmap, but then save memory by keeping in memory smaller Bitmap (comparing with IN_SAMPLE... scale types).


EXACTLY_STRETCHED

public static final ImageScaleType EXACTLY_STRETCHED
Image will scaled exactly to target size (scaled width or height or both will be equal to target size; depends on ImageView's scale type). Use it if memory economy is critically important.
Note: If original image size is smaller than target size then original image will be stretched to target size.

Important note: For creating result Bitmap (of exact size) additional Bitmap will be created with Bitmap.createScaledBitmap(...). So this scale type requires more memory for creation of result Bitmap, but then save memory by keeping in memory smaller Bitmap (comparing with IN_SAMPLE... scale types).

Method Detail

values

public static ImageScaleType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ImageScaleType c : ImageScaleType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ImageScaleType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null


Copyright © 2011-2013. All Rights Reserved.