Created
April 28, 2014 17:38
-
-
Save davidtavarez/11378831 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Bitmap getCropBitmap (Bitmap origialBitmap,int left, int top, int right, int bottom){ | |
int targetWidth = right-left; | |
int targetHeight = bottom-top; | |
Bitmap cutBitmap = Bitmap.createBitmap(targetWidth,targetHeight, Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(cutBitmap); | |
Rect desRect = new Rect(0, 0, targetWidth, targetHeight); | |
Rect srcRect = new Rect(left, top, right, bottom); | |
canvas.drawBitmap(origialBitmap, srcRect, desRect, null); | |
return cutBitmap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment