RectKt

public final class RectKt


Summary

Public methods

static final @NonNull Rect
RectKt.and(@NonNull Rect receiver, @NonNull Rect r)

Returns the intersection of two rectangles as a new rectangle.

static final @NonNull RectF
RectKt.and(@NonNull RectF receiver, @NonNull RectF r)

Returns the intersection of two rectangles as a new rectangle.

static final int

Returns "left", the first component of the rectangle.

static final float

Returns "left", the first component of the rectangle.

static final int

Returns "top", the second component of the rectangle.

static final float

Returns "top", the second component of the rectangle.

static final int

Returns "right", the third component of the rectangle.

static final float

Returns "right", the third component of the rectangle.

static final int

Returns "bottom", the fourth component of the rectangle.

static final float

Returns "bottom", the fourth component of the rectangle.

static final boolean

Returns true if the specified point is inside the rectangle.

static final boolean

Returns true if the specified point is inside the rectangle.

static final @NonNull Region
RectKt.minus(@NonNull Rect receiver, @NonNull Rect r)

Returns the difference of this rectangle and the specified rectangle as a new region.

static final @NonNull Region

Returns the difference of this rectangle and the specified rectangle as a new region.

static final @NonNull Rect
RectKt.minus(@NonNull Rect receiver, int xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified amount on both X and Y axis.

static final @NonNull RectF
RectKt.minus(@NonNull RectF receiver, float xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified amount on both X and Y axis.

static final @NonNull Rect
RectKt.minus(@NonNull Rect receiver, @NonNull Point xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified point.

static final @NonNull RectF
RectKt.minus(@NonNull RectF receiver, @NonNull PointF xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified point.

static final @NonNull Rect
RectKt.or(@NonNull Rect receiver, @NonNull Rect r)

Returns the union of two rectangles as a new rectangle.

static final @NonNull RectF
RectKt.or(@NonNull RectF receiver, @NonNull RectF r)

Returns the union of two rectangles as a new rectangle.

static final @NonNull Rect
RectKt.plus(@NonNull Rect receiver, @NonNull Rect r)

Performs the union of this rectangle and the specified rectangle and returns the result as a new rectangle.

static final @NonNull RectF
RectKt.plus(@NonNull RectF receiver, @NonNull RectF r)

Performs the union of this rectangle and the specified rectangle and returns the result as a new rectangle.

static final @NonNull Rect
RectKt.plus(@NonNull Rect receiver, int xy)

Returns a new rectangle representing this rectangle offset by the specified amount on both X and Y axis.

static final @NonNull RectF
RectKt.plus(@NonNull RectF receiver, float xy)

Returns a new rectangle representing this rectangle offset by the specified amount on both X and Y axis.

static final @NonNull Rect
RectKt.plus(@NonNull Rect receiver, @NonNull Point xy)

Returns a new rectangle representing this rectangle offset by the specified point.

static final @NonNull RectF
RectKt.plus(@NonNull RectF receiver, @NonNull PointF xy)

Returns a new rectangle representing this rectangle offset by the specified point.

static final @NonNull Rect
RectKt.times(@NonNull Rect receiver, int factor)

Returns a new rectangle representing this rectangle's components each scaled by factor.

static final @NonNull RectF
RectKt.times(@NonNull RectF receiver, int factor)

Returns a new rectangle representing this rectangle's components each scaled by factor.

static final @NonNull RectF
RectKt.times(@NonNull RectF receiver, float factor)

Returns a new rectangle representing this rectangle's components each scaled by factor.

static final @NonNull Rect

Returns a Rect representation of this rectangle.

static final @NonNull RectF

Returns a RectF representation of this rectangle.

static final @NonNull Region

Returns a Region representation of this rectangle.

static final @NonNull Region

Returns a Region representation of this rectangle.

static final @NonNull RectF

Transform this rectangle in place using the supplied Matrix and returns this rectangle.

static final @NonNull Region
RectKt.xor(@NonNull Rect receiver, @NonNull Rect r)

Returns the union minus the intersection of two rectangles as a new region.

static final @NonNull Region
RectKt.xor(@NonNull RectF receiver, @NonNull RectF r)

Returns the union minus the intersection of two rectangles as a new region.

Public methods

RectKt.and

@NonNull
public static final Rect RectKt.and(@NonNull Rect receiver, @NonNull Rect r)

Returns the intersection of two rectangles as a new rectangle. If the rectangles do not intersect, returns a copy of the left hand side rectangle.

RectKt.and

@NonNull
public static final RectF RectKt.and(@NonNull RectF receiver, @NonNull RectF r)

Returns the intersection of two rectangles as a new rectangle. If the rectangles do not intersect, returns a copy of the left hand side rectangle.

RectKt.component1

@NonNull
public static final int RectKt.component1(@NonNull Rect receiver)

Returns "left", the first component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component1

@NonNull
public static final float RectKt.component1(@NonNull RectF receiver)

Returns "left", the first component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component2

@NonNull
public static final int RectKt.component2(@NonNull Rect receiver)

Returns "top", the second component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component2

@NonNull
public static final float RectKt.component2(@NonNull RectF receiver)

Returns "top", the second component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component3

@NonNull
public static final int RectKt.component3(@NonNull Rect receiver)

Returns "right", the third component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component3

@NonNull
public static final float RectKt.component3(@NonNull RectF receiver)

Returns "right", the third component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component4

@NonNull
public static final int RectKt.component4(@NonNull Rect receiver)

Returns "bottom", the fourth component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.component4

@NonNull
public static final float RectKt.component4(@NonNull RectF receiver)

Returns "bottom", the fourth component of the rectangle.

This method allows to use destructuring declarations when working with rectangles, for example:

val (left, top, right, bottom) = myRectangle

RectKt.contains

@NonNull
public static final boolean RectKt.contains(@NonNull Rect receiver, @NonNull Point p)

Returns true if the specified point is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a point to be contained: left <= x < right and top <= y < bottom. An empty rectangle never contains any point.

RectKt.contains

@NonNull
public static final boolean RectKt.contains(@NonNull RectF receiver, @NonNull PointF p)

Returns true if the specified point is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a point to be contained: left <= x < right and top <= y < bottom. An empty rectangle never contains any point.

RectKt.minus

@NonNull
public static final Region RectKt.minus(@NonNull Rect receiver, @NonNull Rect r)

Returns the difference of this rectangle and the specified rectangle as a new region.

RectKt.minus

@NonNull
public static final Region RectKt.minus(@NonNull RectF receiver, @NonNull RectF r)

Returns the difference of this rectangle and the specified rectangle as a new region. This rectangle is first converted to a Rect using RectF.toRect.

RectKt.minus

@NonNull
public static final Rect RectKt.minus(@NonNull Rect receiver, int xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified amount on both X and Y axis.

RectKt.minus

@NonNull
public static final RectF RectKt.minus(@NonNull RectF receiver, float xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified amount on both X and Y axis.

RectKt.minus

@NonNull
public static final Rect RectKt.minus(@NonNull Rect receiver, @NonNull Point xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified point.

RectKt.minus

@NonNull
public static final RectF RectKt.minus(@NonNull RectF receiver, @NonNull PointF xy)

Returns a new rectangle representing this rectangle offset by the negation of the specified point.

RectKt.or

@NonNull
public static final Rect RectKt.or(@NonNull Rect receiver, @NonNull Rect r)

Returns the union of two rectangles as a new rectangle.

RectKt.or

@NonNull
public static final RectF RectKt.or(@NonNull RectF receiver, @NonNull RectF r)

Returns the union of two rectangles as a new rectangle.

RectKt.plus

@NonNull
public static final Rect RectKt.plus(@NonNull Rect receiver, @NonNull Rect r)

Performs the union of this rectangle and the specified rectangle and returns the result as a new rectangle.

RectKt.plus

@NonNull
public static final RectF RectKt.plus(@NonNull RectF receiver, @NonNull RectF r)

Performs the union of this rectangle and the specified rectangle and returns the result as a new rectangle.

RectKt.plus

@NonNull
public static final Rect RectKt.plus(@NonNull Rect receiver, int xy)

Returns a new rectangle representing this rectangle offset by the specified amount on both X and Y axis.

RectKt.plus

@NonNull
public static final RectF RectKt.plus(@NonNull RectF receiver, float xy)

Returns a new rectangle representing this rectangle offset by the specified amount on both X and Y axis.

RectKt.plus

@NonNull
public static final Rect RectKt.plus<