@ Nullable public static Matrix getTransformationMatrix ( final EncodedImage encodedImage , final RotationOptions rotationOptions ) { Matrix transformationMatrix = null ; if ( JpegTranscoderUtils . INVERTED_EXIF_ORIENTATIONS . contains ( encodedImage . getExifOrientation ( ) ) ) { // Use exif orientation to rotate since we can't use the rotation angle for inverted exif // orientations final int exifOrientation = getForceRotatedInvertedExifOrientation ( rotationOptions , encodedImage ) ; transformationMatrix = getTransformationMatrixFromInvertedExif ( exifOrientation ) ; } else { // Use actual rotation angle in degrees to rotate final int rotationAngle = getRotationAngle ( rotationOptions , encodedImage ) ; if ( rotationAngle != 0 ) { transformationMatrix = new Matrix ( ) ; transformationMatrix . setRotate ( rotationAngle ) ; } } return transformationMatrix ; }
Compute the transformation matrix needed to rotate the image . If no transformation is needed it returns null .