public final class TransformationUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
PAINT_FLAGS |
Modifier and Type | Method and Description |
---|---|
static Bitmap |
centerCrop(Bitmap recycled,
Bitmap toCrop,
int width,
int height)
A potentially expensive operation to crop the given Bitmap so that it fills the given dimensions.
|
static Bitmap |
fitCenter(Bitmap toFit,
BitmapPool pool,
int width,
int height)
An expensive operation to resize the given Bitmap down so that it fits within the given dimensions maintain
the original proportions.
|
static int |
getExifOrientationDegrees(int exifOrientation)
Get the # of degrees an image must be rotated to match the given exif orientation.
|
static int |
getOrientation(String pathToOriginal)
Deprecated.
No longer used by Glide, scheduled to be removed in Glide 4.0
|
static Bitmap |
orientImage(String pathToOriginal,
Bitmap imageToOrient)
Deprecated.
No longer used by Glide, scheduled to be removed in Glide 4.0
|
static Bitmap |
rotateImage(Bitmap imageToOrient,
int degreesToRotate)
This is an expensive operation that copies the image in place with the pixels rotated.
|
static Bitmap |
rotateImageExif(Bitmap toOrient,
BitmapPool pool,
int exifOrientation)
Rotate and/or flip the image to match the given exif orientation.
|
static void |
setAlpha(Bitmap toTransform,
Bitmap outBitmap)
Sets the alpha of the Bitmap we're going to re-use to the alpha of the Bitmap we're going to transform.
|
public static final int PAINT_FLAGS
public static Bitmap centerCrop(Bitmap recycled, Bitmap toCrop, int width, int height)
recycled
- A mutable Bitmap with dimensions width and height that we can load the cropped portion of toCrop
into.toCrop
- The Bitmap to resize.width
- The width in pixels of the final Bitmap.height
- The height in pixels of the final Bitmap.public static Bitmap fitCenter(Bitmap toFit, BitmapPool pool, int width, int height)
toFit
- The Bitmap to shrink.pool
- The BitmapPool to try to reuse a bitmap from.width
- The width in pixels the final image will fit within.height
- The height in pixels the final image will fit within.public static void setAlpha(Bitmap toTransform, Bitmap outBitmap)
Bitmap.hasAlpha()
} consistent before and after the transformation for
transformations that don't add or remove transparent pixels.@Deprecated public static int getOrientation(String pathToOriginal)
pathToOriginal
- Path to original image file that may have exif data.@Deprecated public static Bitmap orientImage(String pathToOriginal, Bitmap imageToOrient)
pathToOriginal
- Path to original image file that may have exif data.imageToOrient
- Image Bitmap to orient.public static Bitmap rotateImage(Bitmap imageToOrient, int degreesToRotate)
imageToOrient
- Image Bitmap to orient.degreesToRotate
- number of degrees to rotate the image by. If zero the original image is returned
unmodified.public static int getExifOrientationDegrees(int exifOrientation)
exifOrientation
- The exif orientation [1-8]public static Bitmap rotateImageExif(Bitmap toOrient, BitmapPool pool, int exifOrientation)
toOrient
- The bitmap to rotate/flip.pool
- A pool that may or may not contain an image of the necessary dimensions.exifOrientation
- the exif orientation [1-8].