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.Matrix;

public class Main {

    public static Bitmap scaleBitmapSoft(Bitmap temp, float scaleSize) {
        if (!canUse(temp)) {
            return null;
        }
        Matrix m = new Matrix();
        m.postScale(scaleSize, scaleSize, 0, 0);
        return Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), m, true);
    }

    public static boolean canUse(Bitmap bmp) {
        return bmp != null && !bmp.isRecycled();
    }
}