Bitmap Full Screen Scale - Android android.graphics

Android examples for android.graphics:Bitmap Operation

Description

Bitmap Full Screen Scale

Demo Code


//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap FullScreenScale(Bitmap bm, float wRatio,
            float hRatio) {
        float width = bm.getWidth(); 
        float height = bm.getHeight();
        Matrix m1 = new Matrix();
        m1.postScale(wRatio, hRatio);/*w  w  w. j a  v a  2 s  .c om*/
        Bitmap bmResult = Bitmap.createBitmap(bm, 0, 0, (int) width,
                (int) height, m1, true);      
        return bmResult;
    }
}

Related Tutorials