I have a rectangle: Rect r = new Rect();. I want to rotate the object r45 degrees. I checked the solutions and found that this can be done using matrices:
Matrix m = new Matrix();
m.setRotate(degrees, point.x, point.y);
m.mapRect(r);
The problem is that the whey skip rto m.mapRect(r);, she complains what rshould be of type RectF. I managed to do this like:
RectF r2 = new RectF(r);
Matrix m = new Matrix();
m.setRotate(degrees, point.x, point.y);
m.mapRect(r2);
But the problem is that I need an object of type Rectnot RectF. Because I am passing an object rto an outer class that accepts an object Rect.
Is there any other way to rotate a rectangle of ra shape type Rectexcept for this method and without rotating the entire canvas (the canvas contains some other elements)?
Thank you in advance!
Sincerely, Dimitar Georgiev