I have a rectangle: Rect r = new Rect();. I want to rotate the r object to 45 degrees. I checked for solutions and I found that it can be done with matrices:
Matrix m = new Matrix();
// point is the point about which to rotate.
m.setRotate(degrees, point.x, point.y);
m.mapRect(r);
The problem is that whey I pass the r to m.mapRect(r); it complains that r should be from type RectF. I managed to do it like:
RectF r2 = new RectF(r);
Matrix m = new Matrix();
// point is the point about which to rotate.
m.setRotate(degrees, point.x, point.y);
m.mapRect(r2);
But the problem is that I need object from type Rect not RectF . Because I am passing the r object to external class which is taking a Rect object.
Is there another way to rotate the rectangle r form type Rect except this method and without rotationg the whole canvas(canvas contains some other elements)?
Thank you in advance!
Best regards, Dimitar Georgiev