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:
Serializable, Comparable<ImageScaleType>

public enum ImageScaleType
extends Enum<ImageScaleType>

Type of image scaling during decoding.

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

Enum Constant Summary
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 (1, 2, 3, ...).
IN_SAMPLE_POWER_OF_2
          Image will be reduces 2-fold until next reduce step make image smaller target size.
NONE
          Image won't be scaled
NONE_SAFE
          Image will be scaled down only if image size is greater than maximum acceptable texture size.
 
Method Summary
static ImageScaleType valueOf(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

NONE

public static final ImageScaleType NONE
Image won't be scaled


NONE_SAFE

public static final ImageScaleType NONE_SAFE
Image will be scaled down only if image size is greater than maximum acceptable texture size. Usually it's 2048x2048.
If Bitmap is expected to display than it must not exceed this size (otherwise you'll get the exception "OpenGLRenderer: Bitmap too large to be uploaded into a texture".
Image will be subsampled in an integer number of times (1, 2, 3, ...) to maximum texture size of device.


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.


IN_SAMPLE_INT

public static final ImageScaleType IN_SAMPLE_INT
Image will be subsampled in an integer number of times (1, 2, 3, ...). 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.

NOTE: For creating result Bitmap (of exact size) additional Bitmap will be created with Bitmap.createBitmap(...).
Cons: Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)
Pros: Requires more memory in one time for creation of result Bitmap.


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.

NOTE: For creating result Bitmap (of exact size) additional Bitmap will be created with Bitmap.createBitmap(...).
Cons: Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)
Pros: Requires more memory in one time for creation of result Bitmap.

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(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2011-2014. All Rights Reserved.