Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Bitmap getBitmapFromView(View view,int width,int height) {
- int widthSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);
- int heightSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);
- view.measure(widthSpec, heightSpec);
- view.layout(0, 0, width, height);
- Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- view.draw(canvas);
- return bitmap;
- }
- private static Bitmap flipBitmap(Bitmap src)
- {
- Matrix matrix = new Matrix();
- matrix.preScale(-1, 1);
- Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, false);
- dst.setDensity(DisplayMetrics.DENSITY_DEFAULT);
- return dst;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement