Class 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      android.graphics.Bitmap execute​(android.content.Context context, android.graphics.Bitmap resource)
      Execute the preprocessing phase.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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:
        execute in interface com.cloudinary.android.preprocess.Preprocess<android.graphics.Bitmap>
        Parameters:
        context - Android context
        resource - The Bitmap to resize
        Returns:
        The scaled down bitmap (or the original bitmap if it's within bounds).