What is the difference between Rect and RectF in the Android SDK?
android.graphics.RectF. RectF holds four float coordinates for a rectangle. The rectangle is represented by the coordinates of its 4 edges (left, top, right, bottom). These fields can be accessed directly. Use width() and height() to retrieve the rectangle's width and height.
android.graphics.Path. The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.
Using Rect
you define its edges using integers and using RectF
they are defined as floats.
Looking at them more carefully I have spotted a few differences actually. I will only list what one implementation has more compared to the other one.
Rect
RectF
So apparently there are some differences.
Rect is final, RectF can be extended
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