RelativeRectFast

Created by svennahler on 17.09.16.

open class RelativeRectFast

Constructors

RelativeRectFast
Link copied to clipboard

Create a new empty BigRect. All coordinates are initialized to 0.

open fun RelativeRectFast()
RelativeRectFast
Link copied to clipboard
open fun RelativeRectFast(ref: RectF, left: Float, top: Float, right: Float, bottom: Float)
RelativeRectFast
Link copied to clipboard
open fun RelativeRectFast(ref: Rect, left: Float, top: Float, right: Float, bottom: Float)
RelativeRectFast
Link copied to clipboard

Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller must ensure that left <= right and top <= bottom.

open fun RelativeRectFast(left: Double, top: Double, right: Double, bottom: Double, sourceAspect: Double)
RelativeRectFast
Link copied to clipboard

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

open fun RelativeRectFast(r: RelativeRectFast)
RelativeRectFast
Link copied to clipboard

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

open fun RelativeRectFast(ref: Rect, r: Rect)
RelativeRectFast
Link copied to clipboard

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

open fun RelativeRectFast(ref: Rect, r: RectF)
RelativeRectFast
Link copied to clipboard

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

open fun RelativeRectFast(ref: RectF, r: Rect)
RelativeRectFast
Link copied to clipboard

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

open fun RelativeRectFast(ref: RectF, r: RectF)

Functions

bottom
Link copied to clipboard
open fun bottom(): Double
centerX
Link copied to clipboard

the horizontal center of the rectangle. This does not check for a valid rectangle (i.e. left <= right)

fun centerX(): Double
centerY
Link copied to clipboard

the vertical center of the rectangle. This does not check for a valid rectangle (i.e. top <= bottom)

fun centerY(): Double
contains
Link copied to clipboard

Returns true iff the specified rectangle r is inside or equal to this rectangle. An empty rectangle never contains another rectangle.

open fun contains(r: RelativeRectFast): Boolean

Returns true if (x,y) 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 x,y to be contained: left <= x < right and top <= y < bottom. An empty rectangle never contains any point.

open fun contains(x: Double, y: Double): 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. An empty rectangle never contains another rectangle.

open fun contains(left: Double, top: Double, right: Double, bottom: Double): Boolean
convertAspect
Link copied to clipboard
open fun convertAspect(aspect: Double): Double
describeContents
Link copied to clipboard
open fun describeContents(): Int
equals
Link copied to clipboard
open fun equals(object: Any): Boolean
flipHorizontal
Link copied to clipboard
open fun flipHorizontal()
flipVertical
Link copied to clipboard
open fun flipVertical()
flipYCords
Link copied to clipboard
open fun flipYCords()
getMultiRect
Link copied to clipboard
open fun getMultiRect(multiRect: MultiRect, ref: Rect): MultiRect
getRectF
Link copied to clipboard
open fun getRectF(ref: Rect): RectF
open fun getRectF(ref: RectF): RectF
getRelativeRectCenterInside
Link copied to clipboard
open fun getRelativeRectCenterInside(imageWidthValue: Float, imageHeightValue: Float, viewWidthValue: Float, viewHeightValue: Float): RelativeRectFast
hashCode
Link copied to clipboard
open fun hashCode(): Int
height
Link copied to clipboard

the rectangle's height. This does not check for a valid rectangle (i.e. top <= bottom) so the result may be negative.

fun height(): Double
inset
Link copied to clipboard

Inset the rectangle by (dx,dy). If dx is positive, then the sides are moved inwards, making the rectangle narrower. If dx is negative, then the sides are moved outwards, making the rectangle wider. The same holds true for dy and the top and bottom.

open fun inset(dx: Double, dy: Double)
intersect
Link copied to clipboard

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. No check is performed to see if either rectangle is empty. To just test for intersection, use intersects()

open fun intersect(r: RelativeRectFast): 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. No check is performed to see if either rectangle is empty. Note: To just test for intersection, use intersects()

open fun intersect(left: Double, top: Double, right: Double, bottom: Double): Boolean
intersects
Link copied to clipboard

Returns true iff the two specified rectangles intersect. In no event are either of the rectangles modified. To record the intersection, use intersect() or setIntersect().

open fun intersects(a: RelativeRectFast, b: RelativeRectFast): Boolean

Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. No check is performed to see if either rectangle is empty. To record the intersection, use intersect() or setIntersect().

open fun intersects(left: Double, top: Double, right: Double, bottom: Double): Boolean
isEmpty
Link copied to clipboard

Returns true if the rectangle is empty (left >= right or top >= bottom)

fun isEmpty(): Boolean
left
Link copied to clipboard
open fun left(): Double
limitTo
Link copied to clipboard
open fun limitTo(left: Double, top: Double, right: Double, bottom: Double)
open fun limitTo(left: Double, top: Double, right: Double, bottom: Double, saveSize: Boolean)
obtainMultiRect
Link copied to clipboard
open fun obtainMultiRect(ref: MultiRect): MultiRect
open fun obtainMultiRect(ref: Rect): MultiRect
open fun obtainMultiRect(x: Double, y: Double, width: Double, height: Double): MultiRect
open fun obtainMultiRect(x: Int, y: Int, width: Int, height: Int): MultiRect
offset
Link copied to clipboard

Offset the rectangle by adding dx to its left and right coordinates, and adding dy to its top and bottom coordinates.

open fun offset(dx: Double, dy: Double)
offsetTo
Link copied to clipboard

Offset the rectangle to a specific (left, top) position, keeping its width and height the same.

open fun offsetTo(newLeft: Double, newTop: Double)
printShortString
Link copied to clipboard

Print short representation to given writer.

open fun printShortString(pw: PrintWriter)
right
Link copied to clipboard
open fun right(): Double
round
Link copied to clipboard

Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.

open fun round(ref: Rect): Rect
open fun round(ref: RectF): Rect
roundOut
Link copied to clipboard

Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.

open fun roundOut(ref: Rect): Rect
open fun roundOut(ref: RectF): Rect
scale
Link copied to clipboard
open fun scale(scale: Double)
scaleInCenter
Link copied to clipboard
open fun scaleInCenter(scale: Double)
set
Link copied to clipboard

Copy the coordinates from src into this rectangle.

open fun set(src: RelativeRectFast)
open fun set(ref: Rect, src: Rect)
open fun set(ref: Rect, src: RectF)
open fun set(ref: RectF, src: Rect)
open fun set(ref: RectF, src: RectF)

Set the rectangle's coordinates to the specified values. Note: no range checking is performed, so it is up to the caller to ensure that left <= right and top <= bottom.

open fun set(left: Double, top: Double, right: Double, bottom: Double)
open fun set(ref: Rect, left: Float, top: Float, right: Float, bottom: Float)
open fun set(ref: RectF, left: Float, top: Float, right: Float, bottom: Float)
setEmpty
Link copied to clipboard

Set the rectangle to (0,0,0,0)

open fun setEmpty()
setIntersect
Link copied to clipboard

If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. No check is performed to see if either rectangle is empty. To just test for intersection, use intersects()

open fun setIntersect(a: RelativeRectFast, b: RelativeRectFast): Boolean
similar
Link copied to clipboard
open fun similar(object: Any): Boolean
similarValues
Link copied to clipboard
open fun similarValues(thatLeft: Double, thatTop: Double, thatRight: Double, thatBottom: Double): Boolean
sort
Link copied to clipboard

Swap top/bottom or left/right if there are flipped (i.e. left > right and/or top > bottom). This can be called if the edges are computed separately, and may have crossed over each other. If the edges are already correct (i.e. left <= right and top <= bottom) then nothing is done.

open fun sort()
top
Link copied to clipboard
open fun top(): Double
toShortString
Link copied to clipboard

Return a string representation of the rectangle in a compact form.

open fun toShortString(): String
open fun toShortString(sb: StringBuilder): String
toString
Link copied to clipboard
open fun toString(): String
translateCoordinateSystem
Link copied to clipboard
open fun translateCoordinateSystem(newCoordinateSystem: RelativeRectFast): RelativeRectFast
union
Link copied to clipboard

Update this Rect to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle.

open fun union(r: RelativeRectFast)
open fun union(left: Double, top: Double, right: Double, bottom: Double)

Update this Rect to enclose itself and the [x,y] coordinate. There is no check to see that this rectangle is non-empty.

open fun union(x: Double, y: Double)
width
Link copied to clipboard

the rectangle's width. This does not check for a valid rectangle (i.e. left <= right) so the result may be negative.

fun width(): Double
writeToParcel
Link copied to clipboard
open fun writeToParcel(dest: Parcel, flags: Int)

Properties

CREATOR
Link copied to clipboard
val CREATOR: Creator<RelativeRectFast>
sourceAspect
Link copied to clipboard
protected open var sourceAspect: Double