Android Guides | Samples

Android.Graphics.RectF Class

RectF holds four float coordinates for a rectangle.

See Also: RectF

Syntax

[Android.Runtime.Register("android/graphics/RectF", DoNotGenerateAcw=true)]
public class RectF : Object, IParcelable, IDisposable

Remarks

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. Note: most methods do not check to see that the coordinates are sorted correctly (i.e. left <= right and top <= bottom).

[Android Documentation]

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Graphics.RectF are listed below.

See Also: Object

Public Constructors

Create a new empty RectF.
Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).
Create a new rectangle with the specified coordinates.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

BottomSingle.
[read-only]
static
CreatorIParcelableCreator.
[read-only]
IsEmptyBoolean. Returns true if the rectangle is empty (left >= right or top >= bottom)
LeftSingle.
RightSingle.
TopSingle.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

CenterX() : Single
CenterY() : Single
Contains(RectF) : Boolean
Returns true iff the specified rectangle r is inside or equal to this rectangle.
Contains(Single, Single) : Boolean
Returns true if (x,y) is inside the rectangle.
Contains(Single, Single, Single, Single) : Boolean
Returns true iff the 4 specified sides of a rectangle are inside or equal to this rectangle. i.e. is this rectangle a superset of the specified rectangle.
DescribeContents() : Int32
Parcelable interface methods
Height() : Single
Inset(Single, Single)
Inset the rectangle by (dx,dy).
Intersect(RectF) : Boolean
If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
Intersect(Single, Single, Single, Single) : Boolean
If the rectangle specified by left,top,right,bottom intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
static
Intersects(RectF, RectF) : Boolean
Returns true iff the two specified rectangles intersect.
Intersects(Single, Single, Single, Single) : Boolean
Returns true if this rectangle intersects the specified rectangle.
Offset(Single, Single)
Offset the rectangle by adding dx to its left and right coordinates, and adding dy to its top and bottom coordinates.
OffsetTo(Single, Single)
Offset the rectangle to a specific (left, top) position, keeping its width and height the same.
ReadFromParcel(Parcel)
Set the rectangle's coordinates from the data stored in the specified parcel.
Round(Rect)
Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
RoundOut(Rect)
Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
Set(Rect)
Copy the coordinates from src into this rectangle.
Set(RectF)
Copy the coordinates from src into this rectangle.
Set(Single, Single, Single, Single)
Set the rectangle's coordinates to the specified values.
SetEmpty()
Set the rectangle to (0,0,0,0)
SetIntersect(RectF, RectF) : Boolean
If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
Sort()
Swap top/bottom or left/right if there are flipped (i.e. left > right and/or top > bottom).
ToShortString() : String
Return a string representation of the rectangle in a compact form.
Union(RectF)
Update this Rect to enclose itself and the specified rectangle.
Union(Single, Single)
Update this Rect to enclose itself and the [x,y] coordinate.
Union(Single, Single, Single, Single)
Update this Rect to enclose itself and the specified rectangle.
Width() : Single
WriteToParcel(Parcel, ParcelableWriteFlags)
Write this rectangle to the specified parcel.