Skip to content Skip to sidebar Skip to footer

Android Positioning A DrawBitmap That Uses Rect

I searched through this site to find out how to rotate a image back and forth and came up with my own with the help of other post on this site, it works great, the only problem is

Solution 1:

This is a piece of code from that other post you referenced:

Rect src = new Rect(0, 0, width, height);
Rect dst = new Rect(x, y, x + width, y + height);

It's the x and y in the dst Rect that determine the location of the bitmap.

Your code:

Rect src = new Rect(width - width, height - height, width, height);
Rect dst = new Rect(width - width, height - height,   width,  height);

Is going to always draw it at 0, 0 because width - width will be 0 and height - height will be 0.


Post a Comment for "Android Positioning A DrawBitmap That Uses Rect"