Class Limit
java.lang.Object
com.cloudinary.android.preprocess.Limit
- All Implemented Interfaces:
com.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>
public class Limit
extends java.lang.Object
implements com.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>
Preprocess implementation for resizing. Send an instance to
PreprocessChain.addStep(Preprocess)
to scale down any image larger then height/width. The scaling retains aspect ratio while
making sure the height and width are within the requested maximum bounds. If the original image is smaller
than height and width, it will be returned unchanged.-
Constructor Summary
Constructors Constructor Description Limit(int width, int height)Create a new Resize preprocess -
Method Summary
Modifier and Type Method Description android.graphics.Bitmapexecute(android.content.Context context, android.graphics.Bitmap resource)Execute the preprocessing phase.
-
Constructor Details
-
Limit
public Limit(int width, int height)Create a new Resize preprocess- Parameters:
width- Maximum allowed width for the image. Will scale down to comply.height- Maximum allowed height for the image. Will scale down to comply.
-
-
Method Details
-
execute
public android.graphics.Bitmap execute(android.content.Context context, android.graphics.Bitmap resource)Execute the preprocessing phase. This will check the dimensions and scale down the image if needed, making sure both height and width are within maximum bounds.- Specified by:
executein interfacecom.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>- Parameters:
context- Android contextresource- The Bitmap to resize- Returns:
- The scaled down bitmap (or the original bitmap if it's within bounds).
-