private static void checkFinalImageBounds ( Bitmap source , int x , int y , int width , int height ) { Preconditions . checkArgument ( x + width <= source . getWidth ( ) , "x + width must be <= bitmap.width()" ) ; Preconditions . checkArgument ( y + height <= source . getHeight ( ) , "y + height must be <= bitmap.height()" ) ; }
Common code for checking that x + width and y + height are within image bounds