I used this function in my Android program:
public void drawBitmap (Bitmap bitmap, float left, float top, Paint paint)
However, I want to draw my bitmap not in the position 0 x 0, but in the position 10 x 10 (in PIXELS). The drawBitmap function, however, only accepts float numbers…
How can I achieve this??
Thank you in advance!
Have you tried
drawBitmap(bitmap, 10.f, 10.f, ... )? Considering the transformation matrix of the canvas is set to the identity matrix, that is.The reason those parameters are
floatis probably that theCanvasdoes not operate in an integer space (pixels), but in a user specified space defined by a transformation matrix. If you where to set a custom transformation matrix to scale by2then using0.5, 0.5would end up mapping to pixel1, 1. This means you could also set a custom transformation to translate by10, 10and then just simply draw the bitmap without specifying a destination.