Class Crop
java.lang.Object
com.cloudinary.android.preprocess.Crop
- All Implemented Interfaces:
com.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>
public class Crop
extends java.lang.Object
implements com.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>
Preprocess for cropping. Send an instance to
PreprocessChain.addStep(Preprocess) to crop an image.
Points must form a diagonal within the bounds of the image.
If the points form the same diagonal size as the original image, it will be returned unchanged.-
Constructor Summary
Constructors Constructor Description Crop(android.graphics.Point p1, android.graphics.Point p2)Create a new crop 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
-
Crop
public Crop(android.graphics.Point p1, android.graphics.Point p2)Create a new crop preprocess.- Parameters:
p1- First point that form the diagonal.p2- Second point that form the diagonal.
-
-
Method Details
-
execute
public android.graphics.Bitmap execute(android.content.Context context, android.graphics.Bitmap resource) throws com.cloudinary.android.preprocess.PreprocessExceptionExecute the preprocessing phase. This will crop the image if needed, making sure that the points form a diagonal within the bounds of the bitmap.- Specified by:
executein interfacecom.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>- Parameters:
context- Android contextresource- The Bitmap to crop- Returns:
- The cropped bitmap (or the original bitmap if the points form the same diagonal size).
- Throws:
com.cloudinary.android.preprocess.PreprocessException
-