public class RelativeRectAccurate
extends java.lang.Object
implements android.os.Parcelable
Modifier and Type | Field and Description |
---|---|
protected java.math.BigDecimal |
bottom |
static android.os.Parcelable.Creator<RelativeRectAccurate> |
CREATOR |
static java.math.BigDecimal |
HALF |
protected java.math.BigDecimal |
left |
static java.math.MathContext |
MATH_CONTEXT |
static java.math.BigDecimal |
ONE |
protected java.math.BigDecimal |
rangeOffsetX |
protected java.math.BigDecimal |
rangeOffsetY |
protected java.math.BigDecimal |
rangeScaleX |
protected java.math.BigDecimal |
rangeScaleY |
protected java.math.BigDecimal |
right |
protected java.math.BigDecimal |
sourceAspect |
protected java.math.BigDecimal |
top |
static java.math.BigDecimal |
TWO |
static java.math.BigDecimal |
ZERO |
Modifier | Constructor and Description |
---|---|
|
RelativeRectAccurate()
Create a new empty BigRect.
|
|
RelativeRectAccurate(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom,
java.math.BigDecimal sourceAspect)
Create a new rectangle with the specified coordinates.
|
protected |
RelativeRectAccurate(android.os.Parcel in) |
|
RelativeRectAccurate(android.graphics.RectF ref,
float left,
float top,
float right,
float bottom) |
|
RelativeRectAccurate(android.graphics.Rect ref,
float left,
float top,
float right,
float bottom) |
|
RelativeRectAccurate(android.graphics.RectF ref,
android.graphics.Rect r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectAccurate(android.graphics.RectF ref,
android.graphics.RectF r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectAccurate(android.graphics.Rect ref,
android.graphics.Rect r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectAccurate(android.graphics.Rect ref,
android.graphics.RectF r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectAccurate(RelativeRectAccurate r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectAccurate(RelativeRectFast r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
Modifier and Type | Method and Description |
---|---|
java.math.BigDecimal |
bottom() |
java.math.BigDecimal |
centerX() |
java.math.BigDecimal |
centerY() |
boolean |
contains(java.math.BigDecimal x,
java.math.BigDecimal y)
Returns true if (x,y) is inside the rectangle.
|
boolean |
contains(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom)
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.
|
boolean |
contains(RelativeRectAccurate r)
Returns true iff the specified rectangle r is inside or equal to this
rectangle.
|
java.math.BigDecimal |
convertAspect(java.math.BigDecimal aspect) |
int |
describeContents() |
boolean |
equals(java.lang.Object o) |
MultiRect |
getMultiRect(android.graphics.Rect ref) |
android.graphics.RectF |
getRectF(android.graphics.Rect ref) |
android.graphics.RectF |
getRectF(android.graphics.RectF ref) |
static RelativeRectAccurate |
getRelativeRectCenterInside(float imageWidthValue,
float imageHeightValue,
float viewWidthValue,
float viewHeightValue) |
java.math.BigDecimal |
getSourceAspect() |
int |
hashCode() |
java.math.BigDecimal |
height() |
void |
inset(java.math.BigDecimal dx,
java.math.BigDecimal dy)
Inset the rectangle by (dx,dy).
|
boolean |
intersect(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom)
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.
|
boolean |
intersect(RelativeRectAccurate r)
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.
|
boolean |
intersects(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom)
Returns true if this rectangle intersects the specified rectangle.
|
static boolean |
intersects(RelativeRectAccurate a,
RelativeRectAccurate b)
Returns true iff the two specified rectangles intersect.
|
boolean |
isEmpty()
Returns true if the rectangle is empty (left >= right or top >= bottom)
|
java.math.BigDecimal |
left() |
void |
limitTo(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom) |
void |
limitTo(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom,
boolean saveSize) |
void |
offset(java.math.BigDecimal dx,
java.math.BigDecimal dy)
Offset the rectangle by adding dx to its left and right coordinates, and
adding dy to its top and bottom coordinates.
|
void |
offsetTo(java.math.BigDecimal newLeft,
java.math.BigDecimal newTop)
Offset the rectangle to a specific (left, top) position,
keeping its width and height the same.
|
void |
printShortString(java.io.PrintWriter pw)
Print short representation to given writer.
|
java.math.BigDecimal |
right() |
android.graphics.Rect |
round(android.graphics.Rect ref)
Set the dst integer Rect by rounding this rectangle's coordinates
to their nearest integer values.
|
android.graphics.Rect |
round(android.graphics.RectF ref)
Set the dst integer Rect by rounding this rectangle's coordinates
to their nearest integer values.
|
android.graphics.Rect |
roundOut(android.graphics.Rect ref)
Set the dst integer Rect by rounding "out" this rectangle, choosing the
floor of top and left, and the ceiling of right and bottom.
|
android.graphics.Rect |
roundOut(android.graphics.RectF ref)
Set the dst integer Rect by rounding "out" this rectangle, choosing the
floor of top and left, and the ceiling of right and bottom.
|
void |
scale(java.math.BigDecimal scale) |
void |
scaleInCenter(java.math.BigDecimal scale) |
void |
set(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom)
Set the rectangle's coordinates to the specified values.
|
void |
set(android.graphics.RectF ref,
float left,
float top,
float right,
float bottom)
Set the rectangle's coordinates to the specified values.
|
void |
set(android.graphics.RectF ref,
android.graphics.Rect src)
Copy the coordinates from src into this rectangle.
|
void |
set(android.graphics.RectF ref,
android.graphics.RectF src)
Copy the coordinates from src into this rectangle.
|
void |
set(RelativeRectAccurate src)
Copy the coordinates from src into this rectangle.
|
void |
setEmpty()
Set the rectangle to (0,0,0,0)
|
boolean |
setIntersect(RelativeRectAccurate a,
RelativeRectAccurate b)
If rectangles a and b intersect, return true and set this rectangle to
that intersection, otherwise return false and do not change this
rectangle.
|
protected void |
setRef(android.graphics.Rect ref) |
protected void |
setRef(android.graphics.RectF ref) |
void |
setSourceAspect(java.math.BigDecimal sourceAspect) |
void |
sort()
Swap top/bottom or left/right if there are flipped (i.e. left > right
and/or top > bottom).
|
java.math.BigDecimal |
top() |
java.lang.String |
toShortString()
Return a string representation of the rectangle in a compact form.
|
java.lang.String |
toShortString(java.lang.StringBuilder sb)
Return a string representation of the rectangle in a compact form.
|
java.lang.String |
toString() |
RelativeRectAccurate |
translateCoordinateSystem(RelativeRectAccurate newCoordinateSystem) |
void |
union(java.math.BigDecimal x,
java.math.BigDecimal y)
Update this Rect to enclose itself and the [x,y] coordinate.
|
void |
union(java.math.BigDecimal left,
java.math.BigDecimal top,
java.math.BigDecimal right,
java.math.BigDecimal bottom)
Update this Rect to enclose itself and the specified rectangle.
|
void |
union(RelativeRectAccurate r)
Update this Rect to enclose itself and the specified rectangle.
|
java.math.BigDecimal |
width() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final java.math.MathContext MATH_CONTEXT
public static final java.math.BigDecimal ZERO
public static final java.math.BigDecimal HALF
public static final java.math.BigDecimal ONE
public static final java.math.BigDecimal TWO
@NonNull protected java.math.BigDecimal left
@NonNull protected java.math.BigDecimal top
@NonNull protected java.math.BigDecimal right
@NonNull protected java.math.BigDecimal bottom
protected java.math.BigDecimal rangeOffsetX
protected java.math.BigDecimal rangeOffsetY
protected java.math.BigDecimal rangeScaleX
protected java.math.BigDecimal rangeScaleY
protected java.math.BigDecimal sourceAspect
public static final android.os.Parcelable.Creator<RelativeRectAccurate> CREATOR
public RelativeRectAccurate()
public RelativeRectAccurate(@NonNull android.graphics.RectF ref, float left, float top, float right, float bottom)
public RelativeRectAccurate(@NonNull android.graphics.Rect ref, float left, float top, float right, float bottom)
public RelativeRectAccurate(@NonNull java.math.BigDecimal left, @NonNull java.math.BigDecimal top, @NonNull java.math.BigDecimal right, @NonNull java.math.BigDecimal bottom, @NonNull java.math.BigDecimal sourceAspect)
left
- The X coordinate of the left side of the rectangletop
- The Y coordinate of the top of the rectangleright
- The X coordinate of the right side of the rectanglebottom
- The Y coordinate of the bottom of the rectanglepublic RelativeRectAccurate(RelativeRectAccurate r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectAccurate(RelativeRectFast r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectAccurate(android.graphics.Rect ref, android.graphics.Rect r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectAccurate(android.graphics.Rect ref, android.graphics.RectF r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectAccurate(android.graphics.RectF ref, android.graphics.Rect r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectAccurate(android.graphics.RectF ref, android.graphics.RectF r)
r
- The rectangle whose coordinates are copied into the new
rectangle.protected RelativeRectAccurate(android.os.Parcel in)
public void setSourceAspect(java.math.BigDecimal sourceAspect)
public java.math.BigDecimal getSourceAspect()
protected void setRef(android.graphics.RectF ref)
protected void setRef(android.graphics.Rect ref)
@NonNull public java.math.BigDecimal top()
@NonNull public java.math.BigDecimal left()
@NonNull public java.math.BigDecimal right()
@NonNull public java.math.BigDecimal bottom()
public RelativeRectAccurate translateCoordinateSystem(RelativeRectAccurate newCoordinateSystem)
public static boolean intersects(RelativeRectAccurate a, RelativeRectAccurate b)
a
- The first rectangle being tested for intersectionb
- The second rectangle being tested for intersectionpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toShortString()
public java.lang.String toShortString(java.lang.StringBuilder sb)
public void printShortString(java.io.PrintWriter pw)
public final boolean isEmpty()
public final java.math.BigDecimal width()
public final java.math.BigDecimal height()
public final java.math.BigDecimal centerX()
public final java.math.BigDecimal centerY()
public void setEmpty()
public void limitTo(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
public void limitTo(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom, boolean saveSize)
public void set(android.graphics.RectF ref, float left, float top, float right, float bottom)
left
- The X coordinate of the left side of the rectangletop
- The Y coordinate of the top of the rectangleright
- The X coordinate of the right side of the rectanglebottom
- The Y coordinate of the bottom of the rectanglepublic void set(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
left
- The X coordinate of the left side of the rectangletop
- The Y coordinate of the top of the rectangleright
- The X coordinate of the right side of the rectanglebottom
- The Y coordinate of the bottom of the rectanglepublic void set(RelativeRectAccurate src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void set(android.graphics.RectF ref, android.graphics.RectF src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void set(android.graphics.RectF ref, android.graphics.Rect src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void offset(java.math.BigDecimal dx, java.math.BigDecimal dy)
dx
- The amount to add to the rectangle's left and right coordinatesdy
- The amount to add to the rectangle's top and bottom coordinatespublic void offsetTo(java.math.BigDecimal newLeft, java.math.BigDecimal newTop)
newLeft
- The new "left" coordinate for the rectanglenewTop
- The new "top" coordinate for the rectanglepublic void inset(java.math.BigDecimal dx, java.math.BigDecimal dy)
dx
- The amount to add(subtract) from the rectangle's left(right)dy
- The amount to add(subtract) from the rectangle's top(bottom)public boolean contains(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The X coordinate of the point being tested for containmenty
- The Y coordinate of the point being tested for containmentpublic boolean contains(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
left
- The left side of the rectangle being tested for containmenttop
- The top of the rectangle being tested for containmentright
- The right side of the rectangle being tested for containmentbottom
- The bottom of the rectangle being tested for containmentpublic boolean contains(RelativeRectAccurate r)
r
- The rectangle being tested for containment.public boolean intersect(RelativeRectAccurate r)
r
- The rectangle being intersected with this rectangle.public boolean intersect(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
left
- The left side of the rectangle being intersected with this
rectangletop
- The top of the rectangle being intersected with this rectangleright
- The right side of the rectangle being intersected with this
rectangle.bottom
- The bottom of the rectangle being intersected with this
rectangle.public boolean setIntersect(RelativeRectAccurate a, RelativeRectAccurate b)
a
- The first rectangle being intersected withb
- The second rectangle being intersected withpublic boolean intersects(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
left
- The left side of the rectangle being tested for intersectiontop
- The top of the rectangle being tested for intersectionright
- The right side of the rectangle being tested for
intersectionbottom
- The bottom of the rectangle being tested for intersectionpublic android.graphics.Rect round(android.graphics.RectF ref)
public android.graphics.Rect round(android.graphics.Rect ref)
public android.graphics.Rect roundOut(android.graphics.RectF ref)
public android.graphics.Rect roundOut(android.graphics.Rect ref)
public MultiRect getMultiRect(android.graphics.Rect ref)
public android.graphics.RectF getRectF(android.graphics.Rect ref)
public android.graphics.RectF getRectF(android.graphics.RectF ref)
public void scale(java.math.BigDecimal scale)
public void scaleInCenter(java.math.BigDecimal scale)
public void union(RelativeRectAccurate r)
r
- The rectangle being unioned with this rectanglepublic void union(java.math.BigDecimal left, java.math.BigDecimal top, java.math.BigDecimal right, java.math.BigDecimal bottom)
left
- The left edge being unioned with this rectangletop
- The top edge being unioned with this rectangleright
- The right edge being unioned with this rectanglebottom
- The bottom edge being unioned with this rectanglepublic void union(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The x coordinate of the point to add to the rectangley
- The y coordinate of the point to add to the rectanglepublic void sort()
@NonNull public static RelativeRectAccurate getRelativeRectCenterInside(float imageWidthValue, float imageHeightValue, float viewWidthValue, float viewHeightValue)
public java.math.BigDecimal convertAspect(java.math.BigDecimal aspect)
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable