Java Code Examples for com.bumptech.glide.load.resource.bitmap.TransformationUtils#centerCrop()

The following examples show how to use com.bumptech.glide.load.resource.bitmap.TransformationUtils#centerCrop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoundedCorners.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
private Bitmap centerCrop(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
  final Bitmap toReuse     = pool.get(outWidth, outHeight, getSafeConfig(toTransform));
  final Bitmap transformed = TransformationUtils.centerCrop(toReuse, toTransform, outWidth, outHeight);

  if (toReuse != null && toReuse != transformed && !pool.put(toReuse)) {
    toReuse.recycle();
  }

  return transformed;
}
 
Example 2
Source File: GlideTransformUtils.java    From DevUtils with Apache License 2.0 4 votes vote down vote up
@Override
protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) {
    Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight);
    return blurBitmap(mContext, bitmap, 20, outWidth, outHeight);
}
 
Example 3
Source File: GlideRoundTransform.java    From DrySister with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
    Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight);
    return roundCrop(pool, bitmap);
}
 
Example 4
Source File: CropSquareTransformation.java    From glide-transformations with Apache License 2.0 4 votes vote down vote up
@Override
protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
                           @NonNull Bitmap toTransform, int outWidth, int outHeight) {
  this.size = Math.max(outWidth, outHeight);
  return TransformationUtils.centerCrop(pool, toTransform, size, size);
}