public static Bitmap clipSquare ( @ NonNull final Bitmap bitmap , final int borderWidth , @ ColorInt final int borderColor ) { Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; return clipSquare ( bitmap , bitmap . getWidth ( ) >= bitmap . getHeight ( ) ? bitmap . getHeight ( ) : bitmap . getWidth ( ) , borderWidth , borderColor ) ; }
Clips the long edge of a bitmap if its width and height are not equal in order to transform it into a square . Additionally a border will be added .