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 zoomBitmap(Bitmap source, float w, float h) {
        int height = source.getHeight();
        int width = source.getWidth();
        Matrix matrix = new Matrix();
        matrix.postScale(w / width, h / height);
        Bitmap bitmap = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
        return bitmap;
    }
}