Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to convert from a RectF to a Rect in Android?

I would like to convert from a RectF to a Rect in Android. Currently I have:

RectF rectF = new RectF();
rectF.set( ... some values ... );

...

Rect rect = new Rect((int)rectF.left,
                     (int)rectF.top,
                     (int)rectF.right,
                     (int)rectF.bottom));

Is there a better way?

like image 316
superdave Avatar asked May 08 '13 19:05

superdave


1 Answers

Ah ha -- found the answer:

rectF.round(rect);

-- or --

rectF.roundOut(rect);
like image 186
superdave Avatar answered Sep 30 '22 20:09

superdave