public class RelativeRectFast
extends java.lang.Object
implements android.os.Parcelable
Modifier and Type | Field and Description |
---|---|
protected double |
bottom |
static android.os.Parcelable.Creator<RelativeRectFast> |
CREATOR |
protected double |
left |
protected double |
rangeOffsetX |
protected double |
rangeOffsetY |
protected double |
rangeScaleX |
protected double |
rangeScaleY |
protected double |
right |
protected double |
sourceAspect |
protected double |
top |
Modifier | Constructor and Description |
---|---|
|
RelativeRectFast()
Create a new empty BigRect.
|
|
RelativeRectFast(double left,
double top,
double right,
double bottom,
double sourceAspect)
Create a new rectangle with the specified coordinates.
|
protected |
RelativeRectFast(android.os.Parcel in) |
|
RelativeRectFast(android.graphics.RectF ref,
float left,
float top,
float right,
float bottom) |
|
RelativeRectFast(android.graphics.Rect ref,
float left,
float top,
float right,
float bottom) |
|
RelativeRectFast(android.graphics.RectF ref,
android.graphics.Rect r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectFast(android.graphics.RectF ref,
android.graphics.RectF r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectFast(android.graphics.Rect ref,
android.graphics.Rect r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectFast(android.graphics.Rect ref,
android.graphics.RectF r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectFast(RelativeRectAccurate r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
|
RelativeRectFast(RelativeRectFast r)
Create a new rectangle, initialized with the values in the specified
rectangle (which is left unmodified).
|
Modifier and Type | Method and Description |
---|---|
double |
bottom() |
double |
centerX() |
double |
centerY() |
boolean |
contains(double x,
double y)
Returns true if (x,y) is inside the rectangle.
|
boolean |
contains(double left,
double top,
double right,
double 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(RelativeRectFast r)
Returns true iff the specified rectangle r is inside or equal to this
rectangle.
|
double |
convertAspect(double aspect) |
int |
describeContents() |
boolean |
equals(java.lang.Object object) |
void |
flipHorizontal() |
void |
flipVertical() |
MultiRect |
getMultiRect(MultiRect multiRect,
android.graphics.Rect ref) |
MultiRect |
getMultiRect(android.graphics.Rect ref) |
android.graphics.RectF |
getRectF(android.graphics.Rect ref) |
android.graphics.RectF |
getRectF(android.graphics.RectF ref) |
static RelativeRectFast |
getRelativeRectCenterInside(float imageWidthValue,
float imageHeightValue,
float viewWidthValue,
float viewHeightValue) |
double |
getSourceAspect() |
int |
hashCode() |
double |
height() |
void |
inset(double dx,
double dy)
Inset the rectangle by (dx,dy).
|
boolean |
intersect(double left,
double top,
double right,
double 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(RelativeRectFast 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(double left,
double top,
double right,
double bottom)
Returns true if this rectangle intersects the specified rectangle.
|
static boolean |
intersects(RelativeRectFast a,
RelativeRectFast b)
Returns true iff the two specified rectangles intersect.
|
boolean |
isEmpty()
Returns true if the rectangle is empty (left >= right or top >= bottom)
|
double |
left() |
void |
limitTo(double left,
double top,
double right,
double bottom) |
void |
limitTo(double left,
double top,
double right,
double bottom,
boolean saveSize) |
void |
offset(double dx,
double dy)
Offset the rectangle by adding dx to its left and right coordinates, and
adding dy to its top and bottom coordinates.
|
void |
offsetTo(double newLeft,
double 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.
|
double |
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(double scale) |
void |
scaleInCenter(double scale) |
void |
set(double left,
double top,
double right,
double 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.Rect 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(android.graphics.Rect ref,
android.graphics.Rect src)
Copy the coordinates from src into this rectangle.
|
void |
set(android.graphics.Rect ref,
android.graphics.RectF src)
Copy the coordinates from src into this rectangle.
|
void |
set(RelativeRectFast src)
Copy the coordinates from src into this rectangle.
|
void |
setEmpty()
Set the rectangle to (0,0,0,0)
|
boolean |
setIntersect(RelativeRectFast a,
RelativeRectFast 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(double sourceAspect) |
boolean |
similar(java.lang.Object object) |
boolean |
similarValues(double thatLeft,
double thatTop,
double thatRight,
double thatBottom) |
void |
sort()
Swap top/bottom or left/right if there are flipped (i.e. left > right
and/or top > bottom).
|
double |
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() |
RelativeRectFast |
translateCoordinateSystem(RelativeRectFast newCoordinateSystem) |
void |
union(double x,
double y)
Update this Rect to enclose itself and the [x,y] coordinate.
|
void |
union(double left,
double top,
double right,
double bottom)
Update this Rect to enclose itself and the specified rectangle.
|
void |
union(RelativeRectFast r)
Update this Rect to enclose itself and the specified rectangle.
|
double |
width() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
@NonNull protected double bottom
public static final android.os.Parcelable.Creator<RelativeRectFast> CREATOR
@NonNull protected double left
protected double rangeOffsetX
protected double rangeOffsetY
protected double rangeScaleX
protected double rangeScaleY
@NonNull protected double right
protected double sourceAspect
@NonNull protected double top
public RelativeRectFast()
public RelativeRectFast(@NonNull double left, @NonNull double top, @NonNull double right, @NonNull double bottom, @NonNull double 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 rectangleprotected RelativeRectFast(android.os.Parcel in)
public RelativeRectFast(@NonNull android.graphics.RectF ref, float left, float top, float right, float bottom)
public RelativeRectFast(@NonNull android.graphics.Rect ref, float left, float top, float right, float bottom)
public RelativeRectFast(android.graphics.RectF ref, android.graphics.Rect r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectFast(android.graphics.RectF ref, android.graphics.RectF r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectFast(android.graphics.Rect ref, android.graphics.Rect r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectFast(android.graphics.Rect ref, android.graphics.RectF r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectFast(RelativeRectAccurate r)
r
- The rectangle whose coordinates are copied into the new
rectangle.public RelativeRectFast(RelativeRectFast r)
r
- The rectangle whose coordinates are copied into the new
rectangle.@NonNull public double bottom()
public final double centerX()
public final double centerY()
public boolean contains(double x, double y)
x
- The X coordinate of the point being tested for containmenty
- The Y coordinate of the point being tested for containmentpublic boolean contains(double left, double top, double right, double 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(RelativeRectFast r)
r
- The rectangle being tested for containment.public double convertAspect(double aspect)
public int describeContents()
describeContents
in interface android.os.Parcelable
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public void flipHorizontal()
public void flipVertical()
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)
@NonNull public static RelativeRectFast getRelativeRectCenterInside(float imageWidthValue, float imageHeightValue, float viewWidthValue, float viewHeightValue)
public double getSourceAspect()
public int hashCode()
hashCode
in class java.lang.Object
public final double height()
public void inset(double dx, double 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 intersect(double left, double top, double right, double 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 intersect(RelativeRectFast r)
r
- The rectangle being intersected with this rectangle.public boolean intersects(double left, double top, double right, double 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 static boolean intersects(RelativeRectFast a, RelativeRectFast b)
a
- The first rectangle being tested for intersectionb
- The second rectangle being tested for intersectionpublic final boolean isEmpty()
@NonNull public double left()
public void limitTo(double left, double top, double right, double bottom)
public void limitTo(double left, double top, double right, double bottom, boolean saveSize)
public void offset(double dx, double 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(double newLeft, double newTop)
newLeft
- The new "left" coordinate for the rectanglenewTop
- The new "top" coordinate for the rectanglepublic void printShortString(java.io.PrintWriter pw)
@NonNull public double right()
public android.graphics.Rect round(android.graphics.Rect ref)
public android.graphics.Rect round(android.graphics.RectF ref)
public android.graphics.Rect roundOut(android.graphics.Rect ref)
public android.graphics.Rect roundOut(android.graphics.RectF ref)
public void scale(double scale)
public void scaleInCenter(double scale)
public void set(double left, double top, double right, double 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(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(android.graphics.Rect 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(android.graphics.RectF ref, android.graphics.Rect 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.Rect ref, android.graphics.Rect src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void set(android.graphics.Rect ref, android.graphics.RectF src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void set(RelativeRectFast src)
src
- The rectangle whose coordinates are copied into this
rectangle.public void setEmpty()
public boolean setIntersect(RelativeRectFast a, RelativeRectFast b)
a
- The first rectangle being intersected withb
- The second rectangle being intersected withprotected void setRef(android.graphics.Rect ref)
protected void setRef(android.graphics.RectF ref)
public void setSourceAspect(double sourceAspect)
public boolean similar(java.lang.Object object)
public boolean similarValues(double thatLeft, double thatTop, double thatRight, double thatBottom)
public void sort()
@NonNull public double top()
public java.lang.String toShortString()
public java.lang.String toShortString(java.lang.StringBuilder sb)
public java.lang.String toString()
toString
in class java.lang.Object
public RelativeRectFast translateCoordinateSystem(RelativeRectFast newCoordinateSystem)
public void union(double x, double 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 union(double left, double top, double right, double 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(RelativeRectFast r)
r
- The rectangle being unioned with this rectanglepublic final double width()
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable