Package com.microblink.photopay.geometry
Class Quadrilateral
java.lang.Object
com.microblink.photopay.geometry.Quadrilateral
- All Implemented Interfaces:
android.os.Parcelable
-
Nested Class Summary
-
Field Summary
FieldsFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionQuadrilateral(float[] points) Constructor from float array.Quadrilateral(int top, int bottom, int left, int right, int hostActivityOrientation) protectedQuadrilateral(android.os.Parcel in) Quadrilateral(Point uleft, Point uright, Point lleft, Point lright) -
Method Summary
Modifier and TypeMethodDescriptionclone()intintgetColor()Returns the point nearest to (0, height) coordinateReturns the point nearest to (width, height) coordinateReturns the Quadrilateral which has same corners as original, but it guarantees that upper left point is the point nearest to (0,0) coordinate.Returns the point nearest to (0, 0) coordinate.Returns the point nearest to (width, 0) coordinatebooleanbooleanisEmpty()Returns true if quadrilateral is empty, i.e.booleanmatchesMargins(int top, int bottom, int left, int right, int hostActivityOrientation) voidmirror(int canvasWidth, int canvasHeight, int hostActivityOrientation) Mirrors the quadrangle so that it can be properly drawn on mirrored camera previewvoidsetColor(int color) voidsetIsDefaultQuad(boolean defaultQuad) voidsetMargins(int top, int bottom, int left, int right, int hostActivityOrientation) voidvoidtoFloatArray(float[] arr) Converts this quadrilateral to array of float points.toString()voidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
CREATOR
-
-
Constructor Details
-
Quadrilateral
public Quadrilateral(int top, int bottom, int left, int right, int hostActivityOrientation) -
Quadrilateral
public Quadrilateral() -
Quadrilateral
-
Quadrilateral
public Quadrilateral(@Size(8L) @NonNull float[] points) Constructor from float array. The points are represented as pairs (x,y) in clockwise order: upper left, upper right, lower right, lower left- Parameters:
points- float pairs representing quadrilateral points
-
Quadrilateral
protected Quadrilateral(@NonNull android.os.Parcel in)
-
-
Method Details
-
setMargins
public void setMargins(int top, int bottom, int left, int right, int hostActivityOrientation) -
matchesMargins
public boolean matchesMargins(int top, int bottom, int left, int right, int hostActivityOrientation) -
isEmpty
public boolean isEmpty()Returns true if quadrilateral is empty, i.e. all 4 points have coordinates (0,0).- Returns:
- true if quadrilateral is empty, i.e. all 4 points have coordinates (0,0).
-
toFloatArray
public void toFloatArray(@NonNull @Size(8L) float[] arr) Converts this quadrilateral to array of float points. The points are represented as pairs (x,y) in clockwise order: upper left, upper right, lower right, lower left -
setPoints
-
toString
-
mirror
public void mirror(int canvasWidth, int canvasHeight, int hostActivityOrientation) Mirrors the quadrangle so that it can be properly drawn on mirrored camera preview- Parameters:
canvasWidth- width of canvascanvasHeight- height of canvas
-
getSortedQuad
Returns the Quadrilateral which has same corners as original, but it guarantees that upper left point is the point nearest to (0,0) coordinate.- Returns:
- sorted Quadrilateral
-
getUpperLeft
Returns the point nearest to (0, 0) coordinate.- Returns:
- the point nearest to (0, 0) coordinate.
-
getUpperRight
Returns the point nearest to (width, 0) coordinate- Returns:
- the point nearest to (width, 0) coordinate
-
getLowerLeft
Returns the point nearest to (0, height) coordinate- Returns:
- the point nearest to (height, 0) coordinate
-
getLowerRight
Returns the point nearest to (width, height) coordinate- Returns:
- the point nearest to (width, height) coordinate
-
getColor
public int getColor() -
setColor
public void setColor(int color) -
isDefaultQuad
public boolean isDefaultQuad() -
setIsDefaultQuad
public void setIsDefaultQuad(boolean defaultQuad) -
clone
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-