本文整理汇总了Java中com.edmodo.cropper.cropwindow.edge.Edge.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Edge.getHeight方法的具体用法?Java Edge.getHeight怎么用?Java Edge.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.edmodo.cropper.cropwindow.edge.Edge
的用法示例。
在下文中一共展示了Edge.getHeight方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: a
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
private void a(Canvas canvas)
{
float f1 = Edge.LEFT.getCoordinate();
float f2 = Edge.TOP.getCoordinate();
float f3 = Edge.RIGHT.getCoordinate();
float f4 = Edge.BOTTOM.getCoordinate();
float f5 = Edge.getWidth() / 3F;
float f6 = f1 + f5;
canvas.drawLine(f6, f2, f6, f4, o);
float f7 = f3 - f5;
canvas.drawLine(f7, f2, f7, f4, o);
float f8 = Edge.getHeight() / 3F;
float f9 = f2 + f8;
canvas.drawLine(f1, f9, f3, f9, o);
float f10 = f4 - f8;
canvas.drawLine(f1, f10, f3, f10, o);
}
示例3: 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;
}
示例4: getActualCropRect
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
public RectF getActualCropRect()
{
Rect rect = ImageViewUtil.getBitmapRectCenterInside(g, e);
float f1 = (float)g.getWidth() / (float)rect.width();
float f2 = (float)g.getHeight() / (float)rect.height();
float f3 = Edge.LEFT.getCoordinate() - (float)rect.left;
float f4 = Edge.TOP.getCoordinate() - (float)rect.top;
float f5 = Edge.getWidth();
float f6 = Edge.getHeight();
float f7 = f3 * f1;
float f8 = f4 * f2;
float f9 = f7 + f1 * f5;
float f10 = f8 + f2 * f6;
return new RectF(Math.max(0.0F, f7), Math.max(0.0F, f8), Math.min(g.getWidth(), f9), Math.min(g.getHeight(), f10));
}
示例5: getCroppedImage
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
public Bitmap getCroppedImage(int i1, int j1)
{
if (g == null)
{
return null;
}
Rect rect = ImageViewUtil.getBitmapRectCenterInside(g, e);
float f1 = (float)g.getWidth() / (float)rect.width();
float f2 = (float)g.getHeight() / (float)rect.height();
float f3 = Edge.LEFT.getCoordinate() - (float)rect.left;
float f4 = Edge.TOP.getCoordinate() - (float)rect.top;
float f5 = Edge.getWidth();
float f6 = Edge.getHeight();
float f7 = f3 * f1;
float f8 = f4 * f2;
float f9 = f5 * f1;
float f10 = f6 * f2;
Debug.i("CropImageView", (new StringBuilder()).append(", actualCropWidth=").append(f9).append(", actualCropHeight=").append(f10).toString());
if (f9 < 100F || f10 < 100F)
{
return g;
}
Matrix matrix = new Matrix();
if ((float)i1 < f9 || (float)j1 < f10)
{
float f11 = (float)i1 / f9;
float f12 = (float)j1 / f10;
Debug.i("CropImageView", (new StringBuilder()).append("scaleWidth = ").append(f11).append(", scaleHeight=").append(f12).toString());
matrix.postScale(f11, f12);
}
return Bitmap.createBitmap(g, (int)f7, (int)f8, (int)f9, (int)f10, matrix, false);
}
示例6: 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;
}
示例7: drawGuidelines
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
private void drawGuidelines(@NonNull Canvas canvas) {
if (!shouldGuidelinesBeShown()) {
return;
}
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);
}
示例8: getActualCropRect
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
/**
* Gets the crop window's position relative to the source Bitmap (not the image
* displayed in the CropImageView).
*
* @return a RectF instance containing cropped area boundaries of the source Bitmap
*/
public RectF getActualCropRect() {
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 displayedCropLeft = Edge.LEFT.getCoordinate() - displayedImageRect.left;
final float displayedCropTop = Edge.TOP.getCoordinate() - displayedImageRect.top;
final float displayedCropWidth = Edge.getWidth();
final float displayedCropHeight = Edge.getHeight();
// Scale the crop window position to the actual size of the Bitmap.
float actualCropLeft = displayedCropLeft * scaleFactorWidth;
float actualCropTop = displayedCropTop * scaleFactorHeight;
float actualCropRight = actualCropLeft + displayedCropWidth * scaleFactorWidth;
float actualCropBottom = actualCropTop + displayedCropHeight * scaleFactorHeight;
// Correct for floating point errors. Crop rect boundaries should not
// exceed the source Bitmap bounds.
actualCropLeft = Math.max(0f, actualCropLeft);
actualCropTop = Math.max(0f, actualCropTop);
actualCropRight = Math.min(mBitmap.getWidth(), actualCropRight);
actualCropBottom = Math.min(mBitmap.getHeight(), actualCropBottom);
final RectF actualCropRect = new RectF(actualCropLeft,
actualCropTop,
actualCropRight,
actualCropBottom);
return actualCropRect;
}
示例9: 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() {
RectF rect = mImageView.getDisplayRect();
Matrix matrix = mImageView.getDisplayMatrix();
float photoViewScale = (float)Math.sqrt(ImageViewUtil.getXScale(matrix)*ImageViewUtil.getXScale(matrix) +
ImageViewUtil.getXSkew(matrix)*ImageViewUtil.getXSkew(matrix));
Matrix orgScaleMatrix = new Matrix(matrix);
orgScaleMatrix.postScale(1 / photoViewScale, 1 / photoViewScale);
// Log.i("Cropper", "width=" + Math.round(rect.width() / photoViewScale) + " height=" + Math.round(rect.height() / photoViewScale)
// + " bitmapWidth=" + mBitmap.getWidth());
Bitmap rotateBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), orgScaleMatrix, true);
// Get crop window position relative to the displayed image.
// Log.i("Cropper", "Edge.LEFT=" + Edge.LEFT.getCoordinate() + " rect.left=" + rect.left
// + "Edge.TOP=" + Edge.TOP.getCoordinate() + " rect.top=" + rect.top);
final float cropWindowX = Edge.LEFT.getCoordinate() -rect.left;
final float cropWindowY = Edge.TOP.getCoordinate() -rect.top;
final float cropWindowWidth = Edge.getWidth();
final float cropWindowHeight = Edge.getHeight();
// Scale the crop window position to the actual size of the Bitmap.
float actualCropX = cropWindowX / photoViewScale;
float actualCropY = cropWindowY / photoViewScale;
float actualCropWidth = cropWindowWidth / photoViewScale;
float actualCropHeight = cropWindowHeight / photoViewScale;
// Crop the subset from the original Bitmap.
// Log.i("Cropper", "actualCropX="+ actualCropX +" actualCropY=" + actualCropY
// + " actualCropWidth=" + actualCropWidth + " actualCropHeight=" + actualCropHeight
// + " photoViewScale=" + photoViewScale + " rotateBitmap.width=" + rotateBitmap.getWidth());
if(actualCropX < 0){
actualCropWidth += actualCropX;
actualCropX = 0;
}
if(actualCropY < 0){
actualCropHeight += actualCropY;
actualCropY = 0;
}
if(actualCropWidth <0 || actualCropHeight<0){
return null;
}
if(actualCropWidth + actualCropX> rotateBitmap.getWidth()){
actualCropWidth = rotateBitmap.getWidth() - actualCropX;
}
if(actualCropHeight + actualCropY> rotateBitmap.getHeight()){
actualCropHeight = rotateBitmap.getHeight() - actualCropY;
}
final Bitmap croppedBitmap = Bitmap.createBitmap(rotateBitmap,
(int) actualCropX,
(int) actualCropY,
(int) actualCropWidth,
(int) actualCropHeight);
return croppedBitmap;
}
示例10: getActualCropRect
import com.edmodo.cropper.cropwindow.edge.Edge; //导入方法依赖的package包/类
/**
* Gets the crop window's position relative to the source Bitmap (not the image
* displayed in the CropImageView).
*
* @return a RectF instance containing cropped area boundaries of the source Bitmap
*/
public RectF getActualCropRect() {
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 displayedCropLeft = Edge.LEFT.getCoordinate() - displayedImageRect.left;
final float displayedCropTop = Edge.TOP.getCoordinate() - displayedImageRect.top;
final float displayedCropWidth = Edge.getWidth();
final float displayedCropHeight = Edge.getHeight();
// Scale the crop window position to the actual size of the Bitmap.
float actualCropLeft = displayedCropLeft * scaleFactorWidth;
float actualCropTop = displayedCropTop * scaleFactorHeight;
float actualCropRight = actualCropLeft + displayedCropWidth * scaleFactorWidth;
float actualCropBottom = actualCropTop + displayedCropHeight * scaleFactorHeight;
// Correct for floating point errors. Crop rect boundaries should not
// exceed the source Bitmap bounds.
actualCropLeft = Math.max(0f, actualCropLeft);
actualCropTop = Math.max(0f, actualCropTop);
actualCropRight = Math.min(mBitmap.getWidth(), actualCropRight);
actualCropBottom = Math.min(mBitmap.getHeight(), actualCropBottom);
final RectF actualCropRect = new RectF(actualCropLeft,
actualCropTop,
actualCropRight,
actualCropBottom);
return actualCropRect;
}