question: private void translateMatrixAfterRotate ( int axis , float trans , float prevImageSize , float imageSize , int prevViewSize , int viewSize , int drawableSize ) { if ( imageSize < viewSize ) { m [ axis ] = ( viewSize - ( drawableSize * m [ Matrix . MSCALE_X ] ) ) * 0.5f ; } else if ( trans > 0 ) { m [ axis ] = - ( ( imageSize - viewSize ) * 0.5f ) ; } else { float percentage = ( Math . abs ( trans ) + ( 0.5f * prevViewSize ) ) / prevImageSize ; m [ axis ] = - ( ( percentage * imageSize ) - ( viewSize * 0.5f ) ) ; } }
target:  After rotating, the matrix needs to be translated. This function finds the area of image  which was previously centered and adjusts translations so that is again the center, post-rotation.