1、对图片剪接和限定显示区域
drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint);
官方解释如下
Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle. If the source rectangle is not null, it specifies the subset of the bitmap to draw.
大概意思是:如果src不为null的话,按src截取subBitmap,并将subBitmap通过自动缩放/平移去适应目标矩形(dst);如果src为null的画,subBitmap就是原bitmap
参数解释:
Rect src: 对图片进行裁截(src.left,src.top默认为0,0),若是空null则显示整个图片
RectF dst:是 裁剪后的图片在Canvas画布中显示的区域(裁剪区会被自动缩放/平移以适应它)
参考:
[官网Canvas drawBitmap](https://developer.android.com/reference/android/graphics/Canvas.html#drawBitmap(android.graphics.Bitmap, android.graphics.Rect, android.graphics.Rect, android.graphics.Paint))
drawBitmap基本用法