本文整理汇总了Java中com.edmodo.cropper.cropwindow.edge.Edge类的典型用法代码示例。如果您正苦于以下问题:Java Edge类的具体用法?Java Edge怎么用?Java Edge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Edge类属于com.edmodo.cropper.cropwindow.edge包,在下文中一共展示了Edge类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Updates the crop window by directly setting the Edge coordinates.
*
* @param x the new x-coordinate of this handle
* @param y the new y-coordinate of this handle
* @param imageRect the bounding rectangle of the image
* @param parentView the parent View containing the image
* @param snapRadius the maximum distance (in pixels) at which the crop
* window should snap to the image
*/
void updateCropWindow(float x,
float y,
Rect imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges();
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
if (primaryEdge != null)
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
if (secondaryEdge != null)
secondaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:26,代码来源:HandleHelper.java
示例2: updateCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
Rect imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges(x, y, targetAspectRatio);
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
secondaryEdge.adjustCoordinate(targetAspectRatio);
if (secondaryEdge.isOutsideMargin(imageRect, snapRadius)) {
secondaryEdge.snapToRect(imageRect);
primaryEdge.adjustCoordinate(targetAspectRatio);
}
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:20,代码来源:CornerHandleHelper.java
示例3: drawRuleOfThirdsGuidelines
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
private void drawRuleOfThirdsGuidelines(Canvas canvas) {
final float left = Edge.LEFT.getCoordinate();
final float top = Edge.TOP.getCoordinate();
final float right = Edge.RIGHT.getCoordinate();
final float bottom = Edge.BOTTOM.getCoordinate();
// Draw vertical guidelines.
final float oneThirdCropWidth = Edge.getWidth() / 3;
final float x1 = left + oneThirdCropWidth;
canvas.drawLine(x1, top, x1, bottom, mGuidelinePaint);
final float x2 = right - oneThirdCropWidth;
canvas.drawLine(x2, top, x2, bottom, mGuidelinePaint);
// Draw horizontal guidelines.
final float oneThirdCropHeight = Edge.getHeight() / 3;
final float y1 = top + oneThirdCropHeight;
canvas.drawLine(left, y1, right, y1, mGuidelinePaint);
final float y2 = bottom - oneThirdCropHeight;
canvas.drawLine(left, y2, right, y2, mGuidelinePaint);
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:24,代码来源:CropOverlayView.java
示例4: onActionDown
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Handles a {@link android.view.MotionEvent#ACTION_DOWN} event.
*
* @param x the x-coordinate of the down action
* @param y the y-coordinate of the down action
*/
private void onActionDown(float x, float y) {
final float left = Edge.LEFT.getCoordinate();
final float top = Edge.TOP.getCoordinate();
final float right = Edge.RIGHT.getCoordinate();
final float bottom = Edge.BOTTOM.getCoordinate();
mPressedHandle = HandleUtil.getPressedHandle(x, y, left, top, right, bottom, mHandleRadius);
if (mPressedHandle == null)
return;
// Calculate the offset of the touch point from the precise location
// of the handle. Save these values in a member variable since we want
// to maintain this offset as we drag the handle.
mTouchOffset = HandleUtil.getOffset(mPressedHandle, x, y, left, top, right, bottom);
invalidate();
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:26,代码来源:CropOverlayView.java
示例5: updateCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Updates the crop window by directly setting the Edge coordinates.
*
* @param x the new x-coordinate of this handle
* @param y the new y-coordinate of this handle
* @param imageRect the bounding rectangle of the image
* @param parentView the parent View containing the image
* @param snapRadius the maximum distance (in pixels) at which the crop
* window should snap to the image
*/
void updateCropWindow(float x,
float y,
Rect imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges();
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
if (primaryEdge != null)
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
if (secondaryEdge != null)
secondaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
}
开发者ID:wangeason,项目名称:PhotoViewCropper,代码行数:26,代码来源:HandleHelper.java
示例6: onActionDown
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Handles a {@link MotionEvent#ACTION_DOWN} event.
*
* @param x the x-coordinate of the down action
* @param y the y-coordinate of the down action
*/
private void onActionDown(float x, float y) {
final float left = Edge.LEFT.getCoordinate();
final float top = Edge.TOP.getCoordinate();
final float right = Edge.RIGHT.getCoordinate();
final float bottom = Edge.BOTTOM.getCoordinate();
mPressedHandle = HandleUtil.getPressedHandle(x, y, left, top, right, bottom, mHandleRadius);
if (mPressedHandle == null)
return;
// Calculate the offset of the touch point from the precise location
// of the handle. Save these values in a member variable since we want
// to maintain this offset as we drag the handle.
mTouchOffset = HandleUtil.getOffset(mPressedHandle, x, y, left, top, right, bottom);
invalidate();
}
开发者ID:wangeason,项目名称:PhotoViewCropper,代码行数:26,代码来源:CropOverlayView.java
示例7: a
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
void a(float f, float f1, float f2, Rect rect, float f3)
{
a.adjustCoordinate(f, f1, rect, f3, f2);
float f4 = Edge.LEFT.getCoordinate();
float f5 = Edge.TOP.getCoordinate();
float f6 = Edge.RIGHT.getCoordinate();
float f7 = (AspectRatioUtil.calculateWidth(f5, Edge.BOTTOM.getCoordinate(), f2) - (f6 - f4)) / 2.0F;
float f8 = f4 - f7;
float f9 = f7 + f6;
Edge.LEFT.setCoordinate(f8);
Edge.RIGHT.setCoordinate(f9);
if (Edge.LEFT.isOutsideMargin(rect, f3) && !a.isNewRectangleOutOfBounds(Edge.LEFT, rect, f2))
{
float f11 = Edge.LEFT.snapToRect(rect);
Edge.RIGHT.offset(-f11);
a.adjustCoordinate(f2);
}
if (Edge.RIGHT.isOutsideMargin(rect, f3) && !a.isNewRectangleOutOfBounds(Edge.RIGHT, rect, f2))
{
float f10 = Edge.RIGHT.snapToRect(rect);
Edge.LEFT.offset(-f10);
a.adjustCoordinate(f2);
}
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:25,代码来源:d.java
示例8: a
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
void a(float f, float f1, float f2, Rect rect, float f3)
{
a.adjustCoordinate(f, f1, rect, f3, f2);
float f4 = Edge.LEFT.getCoordinate();
float f5 = Edge.TOP.getCoordinate();
float f6 = Edge.RIGHT.getCoordinate();
float f7 = Edge.BOTTOM.getCoordinate();
float f8 = (AspectRatioUtil.calculateHeight(f4, f6, f2) - (f7 - f5)) / 2.0F;
float f9 = f5 - f8;
float f10 = f8 + f7;
Edge.TOP.setCoordinate(f9);
Edge.BOTTOM.setCoordinate(f10);
if (Edge.TOP.isOutsideMargin(rect, f3) && !a.isNewRectangleOutOfBounds(Edge.TOP, rect, f2))
{
float f12 = Edge.TOP.snapToRect(rect);
Edge.BOTTOM.offset(-f12);
a.adjustCoordinate(f2);
}
if (Edge.BOTTOM.isOutsideMargin(rect, f3) && !a.isNewRectangleOutOfBounds(Edge.BOTTOM, rect, f2))
{
float f11 = Edge.BOTTOM.snapToRect(rect);
Edge.TOP.offset(-f11);
a.adjustCoordinate(f2);
}
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:26,代码来源:e.java
示例9: a
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
private void a(float f1, float f2)
{
float f3 = Edge.LEFT.getCoordinate();
float f4 = Edge.TOP.getCoordinate();
float f5 = Edge.RIGHT.getCoordinate();
float f6 = Edge.BOTTOM.getCoordinate();
v = HandleUtil.getPressedHandle(f1, f2, f3, f4, f5, f6, s);
if (v == null)
{
return;
} else
{
u = HandleUtil.getOffset(v, f1, f2, f3, f4, f5, f6);
invalidate();
return;
}
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:18,代码来源:CropOverlayView.java
示例10: updateCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Updates the crop window by directly setting the Edge coordinates.
*
* @param x the new x-coordinate of this handle
* @param y the new y-coordinate of this handle
* @param imageRect the bounding rectangle of the image
* @param snapRadius the maximum distance (in pixels) at which the crop window should snap to
* the image
*/
void updateCropWindow(float x,
float y,
@NonNull RectF imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges();
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
if (primaryEdge != null)
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
if (secondaryEdge != null)
secondaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
}
开发者ID:edmodo,项目名称:cropper,代码行数:25,代码来源:HandleHelper.java
示例11: updateCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges(x, y, targetAspectRatio);
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
secondaryEdge.adjustCoordinate(targetAspectRatio);
if (secondaryEdge.isOutsideMargin(imageRect, snapRadius)) {
secondaryEdge.snapToRect(imageRect);
primaryEdge.adjustCoordinate(targetAspectRatio);
}
}
开发者ID:edmodo,项目名称:cropper,代码行数:20,代码来源:CornerHandleHelper.java
示例12: initCropWindow
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Initialize the crop window by setting the proper {@link Edge} values.
* <p/>
* If fixed aspect ratio is turned off, the initial crop window will be set to the displayed
* image with 10% margin. If fixed aspect ratio is turned on, the initial crop window will
* conform to the aspect ratio with at least one dimension maximized.
*/
private void initCropWindow(@NonNull RectF bitmapRect) {
if (mFixAspectRatio) {
// Initialize the crop window with the proper aspect ratio.
initCropWindowWithFixedAspectRatio(bitmapRect);
} else {
// Initialize crop window to have 10% padding w/ respect to Drawable's bounds.
final float horizontalPadding = 0.1f * bitmapRect.width();
final float verticalPadding = 0.1f * bitmapRect.height();
Edge.LEFT.setCoordinate(bitmapRect.left + horizontalPadding);
Edge.TOP.setCoordinate(bitmapRect.top + verticalPadding);
Edge.RIGHT.setCoordinate(bitmapRect.right - horizontalPadding);
Edge.BOTTOM.setCoordinate(bitmapRect.bottom - verticalPadding);
}
}
开发者ID:edmodo,项目名称:cropper,代码行数:27,代码来源:CropImageView.java
示例13: initCropWindowWithFixedAspectRatio
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
private void initCropWindowWithFixedAspectRatio(@NonNull RectF bitmapRect) {
// If the image aspect ratio is wider than the crop aspect ratio,
// then the image height is the determining initial length. Else, vice-versa.
if (AspectRatioUtil.calculateAspectRatio(bitmapRect) > getTargetAspectRatio()) {
final float cropWidth = AspectRatioUtil.calculateWidth(bitmapRect.height(), getTargetAspectRatio());
Edge.LEFT.setCoordinate(bitmapRect.centerX() - cropWidth / 2f);
Edge.TOP.setCoordinate(bitmapRect.top);
Edge.RIGHT.setCoordinate(bitmapRect.centerX() + cropWidth / 2f);
Edge.BOTTOM.setCoordinate(bitmapRect.bottom);
} else {
final float cropHeight = AspectRatioUtil.calculateHeight(bitmapRect.width(), getTargetAspectRatio());
Edge.LEFT.setCoordinate(bitmapRect.left);
Edge.TOP.setCoordinate(bitmapRect.centerY() - cropHeight / 2f);
Edge.RIGHT.setCoordinate(bitmapRect.right);
Edge.BOTTOM.setCoordinate(bitmapRect.centerY() + cropHeight / 2f);
}
}
开发者ID:edmodo,项目名称:cropper,代码行数:24,代码来源:CropImageView.java
示例14: onActionDown
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Handles a {@link MotionEvent#ACTION_DOWN} event.
*
* @param x the x-coordinate of the down action
* @param y the y-coordinate of the down action
*/
private void onActionDown(float x, float y) {
final float left = Edge.LEFT.getCoordinate();
final float top = Edge.TOP.getCoordinate();
final float right = Edge.RIGHT.getCoordinate();
final float bottom = Edge.BOTTOM.getCoordinate();
mPressedHandle = HandleUtil.getPressedHandle(x, y, left, top, right, bottom, mHandleRadius);
// Calculate the offset of the touch point from the precise location of the handle.
// Save these values in member variable 'mTouchOffset' so that we can maintain this offset as we drag the handle.
if (mPressedHandle != null) {
HandleUtil.getOffset(mPressedHandle, x, y, left, top, right, bottom, mTouchOffset);
invalidate();
}
}
开发者ID:edmodo,项目名称:cropper,代码行数:23,代码来源:CropImageView.java
示例15: getAspectRatio
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Gets the aspect ratio of the resulting crop window if this handle were
* dragged to the given point.
*
* @param x the x-coordinate
* @param y the y-coordinate
* @return the aspect ratio
*/
private float getAspectRatio(float x, float y) {
// Replace the active edge coordinate with the given touch coordinate.
final float left = (mVerticalEdge == Edge.LEFT) ? x : Edge.LEFT.getCoordinate();
final float top = (mHorizontalEdge == Edge.TOP) ? y : Edge.TOP.getCoordinate();
final float right = (mVerticalEdge == Edge.RIGHT) ? x : Edge.RIGHT.getCoordinate();
final float bottom = (mHorizontalEdge == Edge.BOTTOM) ? y : Edge.BOTTOM.getCoordinate();
final float aspectRatio = AspectRatioUtil.calculateAspectRatio(left, top, right, bottom);
return aspectRatio;
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:21,代码来源:HandleHelper.java
示例16: showGuidelines
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Indicates whether the crop window is small enough that the guidelines
* should be shown. Public because this function is also used to determine
* if the center handle should be focused.
*
* @return boolean Whether the guidelines should be shown or not
*/
public static boolean showGuidelines() {
if ((Math.abs(Edge.LEFT.getCoordinate() - Edge.RIGHT.getCoordinate()) < DEFAULT_SHOW_GUIDELINES_LIMIT)
|| (Math.abs(Edge.TOP.getCoordinate() - Edge.BOTTOM.getCoordinate()) < DEFAULT_SHOW_GUIDELINES_LIMIT))
return false;
else
return true;
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:15,代码来源:CropOverlayView.java
示例17: onDraw
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw translucent background for the cropped area.
drawBackground(canvas, mBitmapRect);
if (showGuidelines()) {
// Determines whether guidelines should be drawn or not
if (mGuidelines == GUIDELINES_ON) {
drawRuleOfThirdsGuidelines(canvas);
} else if (mGuidelines == GUIDELINES_ON_TOUCH) {
// Draw only when resizing
if (mPressedHandle != null)
drawRuleOfThirdsGuidelines(canvas);
} else if (mGuidelines == GUIDELINES_OFF) {
// Do nothing
}
}
// Draws the main crop window border.
canvas.drawRect(Edge.LEFT.getCoordinate(),
Edge.TOP.getCoordinate(),
Edge.RIGHT.getCoordinate(),
Edge.BOTTOM.getCoordinate(),
mBorderPaint);
drawCorners(canvas);
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:31,代码来源:CropOverlayView.java
示例18: drawBackground
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
private void drawBackground(Canvas canvas, Rect bitmapRect) {
final float left = Edge.LEFT.getCoordinate();
final float top = Edge.TOP.getCoordinate();
final float right = Edge.RIGHT.getCoordinate();
final float bottom = Edge.BOTTOM.getCoordinate();
/*-
-------------------------------------
| top |
-------------------------------------
| | | |
| | | |
| left | | right |
| | | |
| | | |
-------------------------------------
| bottom |
-------------------------------------
*/
// Draw "top", "bottom", "left", then "right" quadrants.
canvas.drawRect(bitmapRect.left, bitmapRect.top, bitmapRect.right, top, mBackgroundPaint);
canvas.drawRect(bitmapRect.left, bottom, bitmapRect.right, bitmapRect.bottom, mBackgroundPaint);
canvas.drawRect(bitmapRect.left, top, left, bottom, mBackgroundPaint);
canvas.drawRect(right, top, bitmapRect.right, bottom, mBackgroundPaint);
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:28,代码来源:CropOverlayView.java
示例19: getCroppedImage
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Gets the cropped image based on the current crop window.
*
* @return a new Bitmap representing the cropped image
*/
public Bitmap getCroppedImage() {
final Rect displayedImageRect = ImageViewUtil.getBitmapRectCenterInside(mBitmap, mImageView);
// Get the scale factor between the actual Bitmap dimensions and the
// displayed dimensions for width.
final float actualImageWidth = mBitmap.getWidth();
final float displayedImageWidth = displayedImageRect.width();
final float scaleFactorWidth = actualImageWidth / displayedImageWidth;
// Get the scale factor between the actual Bitmap dimensions and the
// displayed dimensions for height.
final float actualImageHeight = mBitmap.getHeight();
final float displayedImageHeight = displayedImageRect.height();
final float scaleFactorHeight = actualImageHeight / displayedImageHeight;
// Get crop window position relative to the displayed image.
final float cropWindowX = Edge.LEFT.getCoordinate() - displayedImageRect.left;
final float cropWindowY = Edge.TOP.getCoordinate() - displayedImageRect.top;
final float cropWindowWidth = Edge.getWidth();
final float cropWindowHeight = Edge.getHeight();
// Scale the crop window position to the actual size of the Bitmap.
final float actualCropX = cropWindowX * scaleFactorWidth;
final float actualCropY = cropWindowY * scaleFactorHeight;
final float actualCropWidth = cropWindowWidth * scaleFactorWidth;
final float actualCropHeight = cropWindowHeight * scaleFactorHeight;
// Crop the subset from the original Bitmap.
final Bitmap croppedBitmap = Bitmap.createBitmap(mBitmap,
(int) actualCropX,
(int) actualCropY,
(int) actualCropWidth,
(int) actualCropHeight);
return croppedBitmap;
}
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:43,代码来源:CropImageView.java
示例20: getAspectRatio
import com.edmodo.cropper.cropwindow.edge.Edge; //导入依赖的package包/类
/**
* Gets the aspect ratio of the resulting crop window if this handle were
* dragged to the given point.
*
* @param x the x-coordinate
* @param y the y-coordinate
* @return the aspect ratio
*/
private float getAspectRatio(float x, float y) {
// Replace the active edge coordinate with the given touch coordinate.
final float left = (mVerticalEdge == Edge.LEFT) ? x : Edge.LEFT.getCoordinate();
final float top = (mHorizontalEdge == Edge.TOP) ? y : Edge.TOP.getCoordinate();
final float right = (mVerticalEdge == Edge.RIGHT) ? x : Edge.RIGHT.getCoordinate();
final float bottom = (mHorizontalEdge == Edge.BOTTOM) ? y : Edge.BOTTOM.getCoordinate();
final float aspectRatio = AspectRatioUtil.calculateAspectRatio(left, top, right, bottom);
return aspectRatio;
}
开发者ID:wangeason,项目名称:PhotoViewCropper,代码行数:21,代码来源:HandleHelper.java
注:本文中的com.edmodo.cropper.cropwindow.edge.Edge类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论