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;

import android.util.Log;

public class Main {
    public static Bitmap zoomBitmap(Bitmap bitmap, float scale) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        Log.e("ss", "width=" + width);
        Log.e("ss", "height=" + height);
        Matrix matrix = new Matrix();
        //float scaleWidht = ((float)w / width);
        //float scaleHeight = ((float)h / height);
        matrix.postScale(scale, scale);
        Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
        return newbmp;
    }
}