http://www.lephone.net/thread-1191-1-1.html
首先我们来介绍一下BitmapFactory.Options这个类,它是实现我们目标的关键。
下面先看看它都有哪些成员
Fields
|
|||||||||||
public
Bitmap
|
inBitmap
|
If set, decode methods that take the Options object will attempt to reuse this bitmap when loading content.
|
|||||||||
public int
|
inDensity
|
The pixel density to use for the bitmap.
|
|||||||||
public boolean
|
inDither
|
If dither is true, the decoder will attempt to dither the decoded image.
|
|||||||||
public boolean
|
inInputShareable
|
This field works in conjuction with inPurgeable.
|
|||||||||
public boolean
|
inJustDecodeBounds
|
If set to true, the decoder will return null (no bitmap), but the out...
|
|||||||||
public boolean
|
inMutable
|
If set, decode methods will always return a mutable Bitmap instead of an immutable one.
|
|||||||||
public boolean
|
inPreferQualityOverSpeed
|
If inPreferQualityOverSpeed is set to true, the decoder will try to decode the reconstructed image to a higher quality even at the expense of the decoding speed.
|
|||||||||
public
Bitmap.Config
|
inPreferredConfig
|
If this is non-null, the decoder will try to decode into this internal configuration.
|
|||||||||
public boolean
|
inPurgeable
|
If this is set to true, then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory.
|
|||||||||
public int
|
inSampleSize
|
If set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory.
|
|||||||||
public boolean
|
inScaled
|
When this flag is set, if
inDensity and
inTargetDensity are not 0, the bitmap will be scaled to match
inTargetDensity when loaded, rather than relying on the graphics system scaling it each time it is drawn to a Canvas.
|
|||||||||
public int
|
inScreenDensity
|
The pixel density of the actual screen that is being used.
|
|||||||||
public int
|
inTargetDensity
|
The pixel density of the destination this bitmap will be drawn to.
|
|||||||||
public byte[]
|
inTempStorage
|
Temp storage to use for decoding.
|
|||||||||
public boolean
|
mCancel
|
Flag to indicate that cancel has been called on this object.
|
|||||||||
public int
|
outHeight
|
The resulting height of the bitmap, set independent of the state of inJustDecodeBounds.
|
|||||||||
public
String
|
outMimeType
|
If known, this string is set to the mimetype of the decoded image.
|
|||||||||
public int
|
outWidth
|
The resulting width of the bitmap, set independent of the state of inJustDecodeBounds.
|