|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.load.resource.bitmap.BitmapTransformation com.bumptech.glide.load.resource.bitmap.CenterCrop
public class CenterCrop
Scale the image so that either the width of the image matches the given width and the height of the image is greater than the given height or vice versa, and then crop the larger dimension to match the given dimension. Does not maintain the image's aspect ratio
Constructor Summary | |
---|---|
CenterCrop(BitmapPool bitmapPool)
|
|
CenterCrop(Context context)
|
Method Summary | |
---|---|
String |
getId()
A method to get a unique identifier for this particular transformation that can be used as part of a cache key. |
protected Bitmap |
transform(BitmapPool pool,
Bitmap toTransform,
int outWidth,
int outHeight)
Transforms the given Bitmap based on the given dimensions and returns the transformed
result. |
Methods inherited from class com.bumptech.glide.load.resource.bitmap.BitmapTransformation |
---|
transform |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CenterCrop(Context context)
public CenterCrop(BitmapPool bitmapPool)
Method Detail |
---|
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight)
BitmapTransformation
Bitmap
based on the given dimensions and returns the transformed
result.
The provided Bitmap, toTransform, should not be recycled or returned to the pool. Glide will automatically recycle and/or reuse toTransform if the transformation returns a different Bitmap. Similarly implementations should never recycle or return Bitmaps that are returned as the result of this method. Recycling or returning the provided and/or the returned Bitmap to the pool will lead to a variety of runtime exceptions and drawing errors. See #408 for an example. If the implementation obtains and discards intermediate Bitmaps, they may safely be returned to the BitmapPool and/or recycled.
outWidth and outHeight will never be Target.SIZE_ORIGINAL
, this
class converts them to be the size of the Bitmap we're going to transform before calling this method.
transform
in class BitmapTransformation
pool
- A BitmapPool
that can be used to obtain and
return intermediate Bitmap
s used in this transformation. For every
Bitmap
obtained from the pool during this transformation, a
Bitmap
must also be returned.toTransform
- The Bitmap
to transform.outWidth
- The ideal width of the transformed bitmap (the transformed width does not need to match exactly).outHeight
- The ideal height of the transformed bitmap (the transformed heightdoes not need to match
exactly).public String getId()
Transformation
If this transformation does not affect the data that will be stored in cache, returning an empty string here is acceptable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |