Example usage for android.graphics Matrix preScale

List of usage examples for android.graphics Matrix preScale

Introduction

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

Prototype

public boolean preScale(float sx, float sy) 

Source Link

Document

Preconcats the matrix with the specified scale.

Usage

From source file:Main.java

public static Bitmap flip(Bitmap src) {
    Matrix m = new Matrix();
    m.preScale(-1, 1);
    Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);
    return dst;//  w  w  w  .  j  a va2s  .  com
}

From source file:Main.java

public static Bitmap LoadFlipedVertical(Bitmap src) {
    Matrix matrix = new Matrix();
    matrix.preScale(1.0f, -1.0f);
    return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap LoadFliped(Bitmap src) {
    Matrix matrix = new Matrix();
    matrix.preScale(-1.0f, 1.0f);

    return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap flipBitmap(Bitmap src) {
    Matrix m = new Matrix();
    m.preScale(-1, 1);
    Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);
    dst.setDensity(DisplayMetrics.DENSITY_DEFAULT);
    return dst;//from   w w  w  .  jav  a2 s .c  om
}

From source file:Main.java

/**
 * Method to flip vertically a Bitmap.//from   w ww  .ja  v  a 2  s . c  om
 *
 * @param source The original Bitmap.
 * @return The flipped Bitmap.
 */
public static Bitmap flipVertically(Bitmap source) {
    Matrix m = new Matrix();
    m.preScale(1, -1);
    return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), m, false);
}

From source file:Main.java

/**
 * TODO doc//from   www . ja  v a 2 s .c  om
 *
 * @param source
 * @return
 */
public static Bitmap flipVerticallyBitmap(Bitmap source) {
    Matrix m = new Matrix();
    m.preScale(1, -1);
    return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), m, false);
}

From source file:Main.java

/**
 * Get a mirror Bitmap/* w w w.j  ava  2  s . c  o  m*/
 *
 * @param sourceBitmap Bitmap to Change
 * @return Mirror bitmap
 */
public static Bitmap getMirrorBitmap(Bitmap sourceBitmap) {
    Matrix m = new Matrix();
    m.preScale(-1, 1);
    Bitmap dst = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(), m,
            false);
    dst.setDensity(DisplayMetrics.DENSITY_DEFAULT);
    return dst;
}

From source file:Main.java

public static Bitmap mirrorImage(@NonNull Bitmap resultBitmap) {
    Matrix matrix = new Matrix();
    matrix.preScale(-1.0f, 1.0f);

    Bitmap returnBitmap = Bitmap.createBitmap(resultBitmap, 0, 0, resultBitmap.getWidth(),
            resultBitmap.getHeight(), matrix, false);

    resultBitmap.recycle();/*from ww  w .j  a  va 2 s.co  m*/

    return returnBitmap;
}

From source file:Main.java

/**
 * reversal bitmap at left-right/*  w  w  w  . java 2  s.co  m*/
 * 
 * @param originalImage
 * @return the bitmap after reversal
 */
public static Bitmap createReversal(Bitmap originalImage) {
    int width = originalImage.getWidth();
    int height = originalImage.getHeight();

    Matrix matrix = new Matrix();
    matrix.preScale(-1.0f, 1.0f);

    return Bitmap.createBitmap(originalImage, 0, 0, width, height, matrix, false);
}

From source file:Main.java

public static Bitmap mirrorBitmap(Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.preScale(-1.0f, 1.0f);
    Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
    return newBitmap;
}