nl_tokens: Setup the base matrix so that the image is centered and scaled properly .
pl_tokens: private void getProperBaseMatrix ( RotateBitmap bitmap , Matrix matrix ) { float viewWidth = getWidth ( ) ; float viewHeight = getHeight ( ) ; float w = bitmap . getWidth ( ) ; float h = bitmap . getHeight ( ) ; matrix . reset ( ) ; // We limit up-scaling to 2x otherwise the result may look bad if it's // a small icon. float widthScale = Math . <mask> ( viewWidth / w , 2.0f ) ; float heightScale = Math . min ( viewHeight / h , 2.0f ) ; float scale = Math . min ( widthScale , heightScale ) ; matrix . postConcat ( bitmap . getRotateMatrix ( ) ) ; matrix . postScale ( scale , scale ) ; matrix . postTranslate ( ( viewWidth - w * scale ) / 2F , ( viewHeight - h * scale ) / 2F ) ; }