I want to show only zoomed part of image using RectF bounds from orignal bitmal.
below is my sample code
fun getZoomedBitmap(orignalBitmap: Bitmap,zoomedRectF: RectF) : Bitmap{
val zoomMatrix = Matrix()
val scaleX = orignalBitmap.width / zoomedRectF.width()
val scaleY = orignalBitmap.height / zoomedRectF.height()
val translateX = -zoomedRectF.left * scaleX
val translateY = -zoomedRectF.top * scaleY
zoomMatrix.setScale(scaleX,scaleY)
zoomMatrix.postTranslate(translateX,translateY)
val zoomBitmap = Bitmap.createBitmap(zoomedRectF.width().toInt(),zoomedRectF.height().toInt(),Bitmap.Config.ARGB_8888)
val canvas = Canvas(zoomBitmap)
canvas.drawBitmap(orignalBitmap,zoomMatrix,null)
return zoomBitmap;
}