Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.*;

public class Main {
    private static Paint scalePaint = new Paint();

    public static Bitmap scale(Bitmap b, float scale) {
        Bitmap res = Bitmap.createBitmap((int) (b.getWidth() * scale + .5f), (int) (b.getHeight() * scale + .5f),
                b.getConfig());
        Canvas c = new Canvas(res);
        c.scale(scale, scale);
        c.drawBitmap(b, 0, 0, scalePaint);
        return res;
    }
}