Can you draw a Bitmap to a Canvas by telling it to draw Bitmap's X,Y at Canvas' X1,Y1? Rather than drawing Bitmap's 0,0 at Canvas X1, Y1?
1 Answer
That's truly possible the Canvas.drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) is here to help. You can specify src region to draw. Look at Canvas docs for more.
Also you may use Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height) to extract that part of original image you want to render. Then just render extracted Bitmap as ususal. More info about the method is available on Google's docs.
1 Comment
JimBadger
Thanks for the answer, and there's definitely some useful reading in there. However, you've made me realise my explanation is unclear. I still want to draw ALL of Bitmap1 next to Bitmap 2...I just want to centre the drawing of Bitmap1 on the Canvas at X1,Y1 AROUND the Bitmap's X,Y. Don't worry if this makes no sense to you, I know I'm mangling what I'm trying to say! :)