本文整理汇总了Java中com.edmodo.cropper.util.AspectRatioUtil.calculateHeight方法的典型用法代码示例。如果您正苦于以下问题:Java AspectRatioUtil.calculateHeight方法的具体用法?Java AspectRatioUtil.calculateHeight怎么用?Java AspectRatioUtil.calculateHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.edmodo.cropper.util.AspectRatioUtil
的用法示例。
在下文中一共展示了AspectRatioUtil.calculateHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: a
import com.edmodo.cropper.util.AspectRatioUtil; //导入方法依赖的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);
}
}
示例2: initCropWindowWithFixedAspectRatio
import com.edmodo.cropper.util.AspectRatioUtil; //导入方法依赖的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);
}
}