| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CROP_HORIZONTAL_LENGTH
Minimum distance in pixels that one edge can get to its opposing edge.
|
static int |
MIN_CROP_VERTICAL_LENGTH
Minimum distance in pixels that one edge can get to its opposing edge.
|
| Modifier and Type | Method and Description |
|---|---|
void |
adjustCoordinate(float aspectRatio)
Adjusts this Edge position such that the resulting window will have the
given aspect ratio.
|
void |
adjustCoordinate(float x,
float y,
android.graphics.Rect imageRect,
float imageSnapRadius,
float aspectRatio)
Sets the Edge to the given x-y coordinate but also adjusting for snapping
to the image bounds and parent view border constraints.
|
float |
getCoordinate()
Gets the coordinate of the Edge
|
static float |
getHeight()
Gets the current height of the crop window.
|
static float |
getWidth()
Gets the current width of the crop window.
|
boolean |
isNewRectangleOutOfBounds(Edge edge,
android.graphics.Rect imageRect,
float aspectRatio)
Returns whether or not you can re-scale the image based on whether any edge would be out of bounds.
|
boolean |
isOutsideFrame(android.graphics.Rect rect)
Determines if this Edge is outside the image frame of the given bounding
rectangle.
|
boolean |
isOutsideMargin(android.graphics.Rect rect,
float margin)
Determines if this Edge is outside the inner margins of the given bounding
rectangle.
|
void |
offset(float distance)
Add the given number of pixels to the current coordinate position of this
Edge.
|
void |
setCoordinate(float coordinate)
Sets the coordinate of the Edge.
|
float |
snapOffset(android.graphics.Rect imageRect)
Returns the potential snap offset of snaptoRect, without changing the coordinate.
|
float |
snapToRect(android.graphics.Rect imageRect)
Snap this Edge to the given image boundaries.
|
void |
snapToView(android.view.View view)
Snap this Edge to the given View boundaries.
|
static Edge |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Edge[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Edge LEFT
public static final Edge TOP
public static final Edge RIGHT
public static final Edge BOTTOM
public static final int MIN_CROP_VERTICAL_LENGTH
public static final int MIN_CROP_HORIZONTAL_LENGTH
public static Edge[] values()
for (Edge c : Edge.values()) System.out.println(c);
public static Edge valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic void setCoordinate(float coordinate)
coordinate - the position of the edgepublic void offset(float distance)
distance - the number of pixels to addpublic float getCoordinate()
public void adjustCoordinate(float x,
float y,
android.graphics.Rect imageRect,
float imageSnapRadius,
float aspectRatio)
x - the x-coordinatey - the y-coordinateimageRect - the bounding rectangle of the imageimageSnapRadius - the radius (in pixels) at which the edge should
snap to the imagepublic void adjustCoordinate(float aspectRatio)
aspectRatio - the aspect ratio to achievepublic boolean isNewRectangleOutOfBounds(Edge edge, android.graphics.Rect imageRect, float aspectRatio)
edge - the Edge that is about to be expandedimageRect - the rectangle of the pictureaspectRatio - the desired aspectRatio of the picture.public float snapToRect(android.graphics.Rect imageRect)
imageRect - the bounding rectangle of the image to snap topublic float snapOffset(android.graphics.Rect imageRect)
imageRect - the bounding rectangle of the image to snap topublic void snapToView(android.view.View view)
view - the View to snap topublic static float getWidth()
public static float getHeight()
public boolean isOutsideMargin(android.graphics.Rect rect,
float margin)
public boolean isOutsideFrame(android.graphics.Rect rect)