net.tsz.afinal.bitmap.core
类 BitmapDecoder

java.lang.Object
  继承者 net.tsz.afinal.bitmap.core.BitmapDecoder

public class BitmapDecoder
extends java.lang.Object


方法摘要
static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
          Calculate an inSampleSize for use in a BitmapFactory.Options object when decoding bitmaps using the decode* methods from BitmapFactory.
static Bitmap decodeSampledBitmapFromDescriptor(java.io.FileDescriptor fileDescriptor, int reqWidth, int reqHeight)
          Decode and sample down a bitmap from a file input stream to the requested width and height.
static Bitmap decodeSampledBitmapFromFile(java.lang.String filename, int reqWidth, int reqHeight)
          Decode and sample down a bitmap from a file to the requested width and height.
static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight)
          Decode and sample down a bitmap from resources to the requested width and height.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

decodeSampledBitmapFromResource

public static Bitmap decodeSampledBitmapFromResource(Resources res,
                                                     int resId,
                                                     int reqWidth,
                                                     int reqHeight)
Decode and sample down a bitmap from resources to the requested width and height.

参数:
res - The resources object containing the image data
resId - The resource id of the image data
reqWidth - The requested width of the resulting bitmap
reqHeight - The requested height of the resulting bitmap
返回:
A bitmap sampled down from the original with the same aspect ratio and dimensions that are equal to or greater than the requested width and height

decodeSampledBitmapFromFile

public static Bitmap decodeSampledBitmapFromFile(java.lang.String filename,
                                                 int reqWidth,
                                                 int reqHeight)
Decode and sample down a bitmap from a file to the requested width and height.

参数:
filename - The full path of the file to decode
reqWidth - The requested width of the resulting bitmap
reqHeight - The requested height of the resulting bitmap
返回:
A bitmap sampled down from the original with the same aspect ratio and dimensions that are equal to or greater than the requested width and height

decodeSampledBitmapFromDescriptor

public static Bitmap decodeSampledBitmapFromDescriptor(java.io.FileDescriptor fileDescriptor,
                                                       int reqWidth,
                                                       int reqHeight)
Decode and sample down a bitmap from a file input stream to the requested width and height.

参数:
fileDescriptor - The file descriptor to read from
reqWidth - The requested width of the resulting bitmap
reqHeight - The requested height of the resulting bitmap
返回:
A bitmap sampled down from the original with the same aspect ratio and dimensions that are equal to or greater than the requested width and height

calculateInSampleSize

public static int calculateInSampleSize(BitmapFactory.Options options,
                                        int reqWidth,
                                        int reqHeight)
Calculate an inSampleSize for use in a BitmapFactory.Options object when decoding bitmaps using the decode* methods from BitmapFactory. This implementation calculates the closest inSampleSize that will result in the final decoded bitmap having a width and height equal to or larger than the requested width and height. This implementation does not ensure a power of 2 is returned for inSampleSize which can be faster when decoding but results in a larger bitmap which isn't as useful for caching purposes.

参数:
options - An options object with out* params already populated (run through a decode* method with inJustDecodeBounds==true
reqWidth - The requested width of the resulting bitmap
reqHeight - The requested height of the resulting bitmap
返回:
The value to be used for inSampleSize