Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Bitmap;

public class Main {
    private static Bitmap getSquareBitmap(Bitmap srcBitmap) {
        int size = Math.min(srcBitmap.getWidth(), srcBitmap.getHeight());
        int paddingX = (srcBitmap.getWidth() - size) / 2;
        int paddingY = (srcBitmap.getHeight() - size) / 2;

        return Bitmap.createBitmap(srcBitmap, paddingX, paddingY, size, size);
    }
}