Draw Portion Of Image On Canvas
I have an image of size 265x256 and I want to draw the top-left and right-bottom portion of size 16x16 at random location on Canvas Can someone please share the concept or code to
Solution 1:
I think you can use Canvas method
publicvoiddrawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint)
where documentation states second argument src as
If the source rectangle is not null, it specifies the subset of the bitmap to draw.
So you can pass the rectangle of the source bitmap that you want to draw in the second argument.
Post a Comment for "Draw Portion Of Image On Canvas"