Class FitCenter
- java.lang.Object
-
- com.bumptech.glide.load.resource.bitmap.BitmapTransformation
-
- com.bumptech.glide.load.resource.bitmap.FitCenter
-
- All Implemented Interfaces:
Key,Transformation<android.graphics.Bitmap>
public class FitCenter extends BitmapTransformation
Scales the image uniformly (maintaining the image's aspect ratio) 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.
-
-
Field Summary
-
Fields inherited from interface com.bumptech.glide.load.Key
CHARSET, STRING_CHARSET_NAME
-
-
Constructor Summary
Constructors Constructor Description FitCenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)For caching to work correctly, implementations must implement this method andKey.hashCode().inthashCode()For caching to work correctly, implementations must implement this method andKey.equals(Object).protected android.graphics.Bitmaptransform(BitmapPool pool, android.graphics.Bitmap toTransform, int outWidth, int outHeight)Transforms the givenBitmapbased on the given dimensions and returns the transformed result.voidupdateDiskCacheKey(java.security.MessageDigest messageDigest)Adds all uniquely identifying information to the given digest.-
Methods inherited from class com.bumptech.glide.load.resource.bitmap.BitmapTransformation
transform
-
-
-
-
Method Detail
-
transform
protected android.graphics.Bitmap transform(@NonNull BitmapPool pool, @NonNull android.graphics.Bitmap toTransform, int outWidth, int outHeight)Description copied from class:BitmapTransformationTransforms the givenBitmapbased 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.- Specified by:
transformin classBitmapTransformation- Parameters:
pool- ABitmapPoolthat can be used to obtain and return intermediateBitmaps used in this transformation. For everyBitmapobtained from the pool during this transformation, aBitmapmust also be returned.toTransform- TheBitmapto 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).
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:KeyFor caching to work correctly, implementations must implement this method andKey.hashCode().
-
hashCode
public int hashCode()
Description copied from interface:KeyFor caching to work correctly, implementations must implement this method andKey.equals(Object).
-
updateDiskCacheKey
public void updateDiskCacheKey(@NonNull java.security.MessageDigest messageDigest)Description copied from interface:KeyAdds all uniquely identifying information to the given digest.Note - Using
MessageDigest.reset()inside of this method will result in undefined behavior.
-
-