Example usage for android.graphics Matrix postScale

List of usage examples for android.graphics Matrix postScale

Introduction

In this page you can find the example usage for android.graphics Matrix postScale.

Prototype

public boolean postScale(float sx, float sy) 

Source Link

Document

Postconcats the matrix with the specified scale.

Usage

From source file:Main.java

public static Bitmap PicZoom(Bitmap bmp, int width, int height) {
    int bmpWidth = bmp.getWidth();
    int bmpHeght = bmp.getHeight();
    Matrix matrix = new Matrix();
    matrix.postScale((float) width / bmpWidth, (float) height / bmpHeght);
    return Bitmap.createBitmap(bmp, 0, 0, bmpWidth, bmpHeght, matrix, true);
}

From source file:Main.java

public static Bitmap smallBitmap(Bitmap bitmap, float scale) {
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();
    Matrix matrix = new Matrix();
    matrix.postScale(scale, scale);
    Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
    return newbmp;
}

From source file:Main.java

public static Bitmap resizeBitmap(Bitmap bitmap, float sx, float sy) {
    Bitmap newBitmap;//  ww  w .  j  a v a2 s.c o  m
    Matrix matrix = new Matrix();
    matrix.postScale(sx, sy);
    newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
    return newBitmap;
}

From source file:Main.java

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;
}

From source file:Main.java

public static Bitmap zoomBitmap(Bitmap bitmap, float sx, float sy) {
    Matrix matrix = new Matrix();
    matrix.postScale(sx, sy);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap scale(Bitmap bitmap, float scale) {
    Matrix matrix = new Matrix();
    matrix.postScale(scale, scale);
    Bitmap outBitmap = Bitmap.createBitmap(bitmap, 0, 0, (int) (bitmap.getWidth()), (int) (bitmap.getHeight()),
            matrix, true);//from   w  w  w  .  j av a 2s .c  o m
    bitmap.recycle();
    return outBitmap;
}

From source file:Main.java

public static Bitmap zoom(Bitmap bitmap, float zf) {
    Matrix matrix = new Matrix();
    matrix.postScale(zf, zf);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap zoomBitmap(Bitmap bitmap, float scale) {
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    Matrix matrix = new Matrix();
    matrix.postScale(scale, scale);
    Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
    return newbmp;
}

From source file:Main.java

static public Bitmap scaleBitmap(Bitmap bitmap, float scaleX, float scaleY) {
    Matrix matrix = new Matrix();
    matrix.postScale(scaleX, scaleY);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap scale(Bitmap org, float xRate, float yRate) {

    final int orgWidth = org.getWidth();
    final int orgHeight = org.getHeight();

    Matrix matrix = new Matrix();
    matrix.postScale(xRate, yRate);

    return Bitmap.createBitmap(org, 0, 0, orgWidth, orgHeight, matrix, true);
}