do Scale with Matrix - Android Graphics

Android examples for Graphics:Bitmap Scale

Description

do Scale with Matrix

Demo Code


//package com.java2s;
import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap doScale(Bitmap b, float scale) {
        Matrix matrix = new Matrix();
        matrix.postScale(scale, scale);//from   www . jav a2s. c  o  m
        b = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(),
                matrix, true);
        return b;
    }
}

Related Tutorials