Home | History | Annotate | Download | only in bitmap
      1 package com.bumptech.glide.load.resource.bitmap;
      2 
      3 import android.content.Context;
      4 import android.graphics.Bitmap;
      5 
      6 import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
      7 
      8 /**
      9  * Scales the image uniformly (maintaining the image's aspect ratio) so that one of the dimensions of the image
     10  * will be equal to the given dimension and the other will be less than the given dimension.
     11  */
     12 public class FitCenter extends BitmapTransformation {
     13 
     14     public FitCenter(Context context) {
     15         super(context);
     16     }
     17 
     18     public FitCenter(BitmapPool bitmapPool) {
     19         super(bitmapPool);
     20     }
     21 
     22     @Override
     23     protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
     24         return TransformationUtils.fitCenter(toTransform, pool, outWidth, outHeight);
     25     }
     26 
     27     @Override
     28     public String getId() {
     29         return "FitCenter.com.bumptech.glide.load.resource.bitmap";
     30     }
     31 }
     32 
     33 
     34