draw only a portion of a Drawable/Bitmap

前端 未结 2 892
予麋鹿
予麋鹿 2021-01-05 15:41

I was wondering if it is possible to draw only a portion of a bitmap after it is loaded into memory without creating a new Bitmap. I see Drawable has a setBounds method but

2条回答
  •  無奈伤痛
    2021-01-05 16:02

    Assuming you have a main canvas to draw to, you can use one of the drawBitmap methods of the Canvas class to draw a subset of the loaded bitmap.

    public void drawBitmap (Bitmap bitmap, Rect src, Rect dst, Paint paint)

提交回复
热议问题