Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Canvas;

import android.graphics.Rect;

public class Main {
    public static Bitmap cutBitmap(Bitmap mBitmap, Rect r, Bitmap.Config config) {
        int width = r.width();
        int height = r.height();

        Bitmap croppedImage = Bitmap.createBitmap(width, height, config);

        Canvas cvs = new Canvas(croppedImage);
        Rect dr = new Rect(0, 0, width, height);
        cvs.drawBitmap(mBitmap, r, dr, null);
        return croppedImage;
    }
}