Example usage for android.graphics Matrix preRotate

List of usage examples for android.graphics Matrix preRotate

Introduction

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

Prototype

public boolean preRotate(float degrees, float px, float py) 

Source Link

Document

Preconcats the matrix with the specified rotation.

Usage

From source file:Main.java

public static boolean setImageToScreenMatrix(Matrix dst, RectF image, RectF screen, int rotation) {
    RectF rotatedImage = new RectF();
    dst.setRotate(rotation, image.centerX(), image.centerY());
    if (!dst.mapRect(rotatedImage, image)) {
        return false; // fails for rotations that are not multiples of 90
                      // degrees
    }/*w  w  w. ja  v  a 2s  .co  m*/
    boolean rToR = dst.setRectToRect(rotatedImage, screen, Matrix.ScaleToFit.CENTER);
    boolean rot = dst.preRotate(rotation, image.centerX(), image.centerY());
    return rToR && rot;
}