Code example for Matrix

Methods: postConcat, postScale, postTranslate, reset

0
		float viewHeight = getHeight();
 
		float w = bitmap.getWidth();
		float h = bitmap.getHeight();
		// int rotation = bitmap.getRotation(); 
		matrix.reset();
 
		// We limit up-scaling to 2x otherwise the result may look bad if it's 
		// a small icon. 
		float widthScale = Math.min(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);
	} 
 
	// Combine the base matrix and the supp matrix to make the final matrix. 
	protected Matrix getImageViewMatrix() {