public class CenterInside extends BitmapTransformation
ImageView.ScaleType.CENTER_INSIDE
in order to center it in Target. If not, then it is scaled so that one of the dimensions of
the image will be equal to the given dimension and the other will be less than the given
dimension (maintaining the image's aspect ratio).CHARSET, STRING_CHARSET_NAME
Constructor and Description |
---|
CenterInside() |
CenterInside(BitmapPool bitmapPool)
Deprecated.
Use
CenterInside() . |
CenterInside(Context context)
Deprecated.
Use
CenterInside() . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
For caching to work correctly, implementations must implement this method and
Transformation.hashCode() . |
int |
hashCode()
For caching to work correctly, implementations must implement this method and
Transformation.equals(Object) . |
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. |
void |
updateDiskCacheKey(MessageDigest messageDigest)
Adds all uniquely identifying information to the given digest.
|
transform
public CenterInside()
@Deprecated public CenterInside(Context context)
CenterInside()
.context
- Ignored.@Deprecated public CenterInside(BitmapPool bitmapPool)
CenterInside()
.bitmapPool
- Ignored.protected Bitmap transform(@NonNull BitmapPool pool, @NonNull 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 height does not
need to match exactly).public boolean equals(Object o)
Transformation
Transformation.hashCode()
.public int hashCode()
Transformation
Transformation.equals(Object)
.public void updateDiskCacheKey(MessageDigest messageDigest)
Key
Note - Using MessageDigest.reset()
inside of this method will result
in undefined behavior.