Whats the best way to convert a Rect variable to a RectF one? I am unable to cast it.
RectF rect = (RectF) currentRect; //produces an error
RectF rect = new RectF(currentRect);
As "new" shouldn't be done in onDraw,
// As class fields,
Rect rect = new Rect();
RectF rectF = new RectF();
...
onDraw(Canvas canvas) {
...
rectF.set(rect);
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With