android.graphics.RectF#sort ( )源码实例Demo

下面列出了android.graphics.RectF#sort ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: EasyPhotos   文件: MatrixUtils.java
public static RectF trapToRect(float[] array) {
  RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY,
      Float.NEGATIVE_INFINITY);
  for (int i = 1; i < array.length; i += 2) {
    float x = round(array[i - 1] * 10) / 10.f;
    float y = round(array[i] * 10) / 10.f;
    r.left = (x < r.left) ? x : r.left;
    r.top = (y < r.top) ? y : r.top;
    r.right = (x > r.right) ? x : r.right;
    r.bottom = (y > r.bottom) ? y : r.bottom;
  }
  r.sort();
  return r;
}
 
源代码2 项目: EasyPhotos   文件: RectUtils.java
/**
 * Takes an array of 2D coordinates representing corners and returns the
 * smallest rectangle containing those coordinates.
 *
 * @param array array of 2D coordinates
 * @return smallest rectangle containing coordinates
 */
public static RectF trapToRect(float[] array) {
    RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
            Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
    for (int i = 1; i < array.length; i += 2) {
        float x = Math.round(array[i - 1] * 10) / 10.f;
        float y = Math.round(array[i] * 10) / 10.f;
        r.left = (x < r.left) ? x : r.left;
        r.top = (y < r.top) ? y : r.top;
        r.right = (x > r.right) ? x : r.right;
        r.bottom = (y > r.bottom) ? y : r.bottom;
    }
    r.sort();
    return r;
}
 
源代码3 项目: imsdk-android   文件: MatrixUtils.java
public static RectF trapToRect(float[] array) {
  RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY,
      Float.NEGATIVE_INFINITY);
  for (int i = 1; i < array.length; i += 2) {
    float x = round(array[i - 1] * 10) / 10.f;
    float y = round(array[i] * 10) / 10.f;
    r.left = (x < r.left) ? x : r.left;
    r.top = (y < r.top) ? y : r.top;
    r.right = (x > r.right) ? x : r.right;
    r.bottom = (y > r.bottom) ? y : r.bottom;
  }
  r.sort();
  return r;
}
 
源代码4 项目: Matisse-Kotlin   文件: RectUtils.java
/**
 * Takes an array of 2D coordinates representing corners and returns the
 * smallest rectangle containing those coordinates.
 *
 * @param array array of 2D coordinates
 * @return smallest rectangle containing coordinates
 */
public static RectF trapToRect(float[] array) {
    RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
            Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
    for (int i = 1; i < array.length; i += 2) {
        float x = Math.round(array[i - 1] * 10) / 10.f;
        float y = Math.round(array[i] * 10) / 10.f;
        r.left = (x < r.left) ? x : r.left;
        r.top = (y < r.top) ? y : r.top;
        r.right = (x > r.right) ? x : r.right;
        r.bottom = (y > r.bottom) ? y : r.bottom;
    }
    r.sort();
    return r;
}
 
源代码5 项目: PictureSelector   文件: RectUtils.java
/**
 * Takes an array of 2D coordinates representing corners and returns the
 * smallest rectangle containing those coordinates.
 *
 * @param array array of 2D coordinates
 * @return smallest rectangle containing coordinates
 */
public static RectF trapToRect(float[] array) {
    RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
            Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
    for (int i = 1; i < array.length; i += 2) {
        float x = Math.round(array[i - 1] * 10) / 10.f;
        float y = Math.round(array[i] * 10) / 10.f;
        r.left = (x < r.left) ? x : r.left;
        r.top = (y < r.top) ? y : r.top;
        r.right = (x > r.right) ? x : r.right;
        r.bottom = (y > r.bottom) ? y : r.bottom;
    }
    r.sort();
    return r;
}
 
源代码6 项目: imageCrop   文件: CropMath.java
/**
 * Takes an array of 2D coordinates representing corners and returns the
 * smallest rectangle containing those coordinates.
 *
 * @param array array of 2D coordinates
 * @return smallest rectangle containing coordinates
 */
public static RectF trapToRect(float[] array) {
    RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
            Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
    for (int i = 1; i < array.length; i += 2) {
        float x = array[i - 1];
        float y = array[i];
        r.left = (x < r.left) ? x : r.left;
        r.top = (y < r.top) ? y : r.top;
        r.right = (x > r.right) ? x : r.right;
        r.bottom = (y > r.bottom) ? y : r.bottom;
    }
    r.sort();
    return r;
}
 
源代码7 项目: AndroidPdfViewer   文件: DragPinchManager.java
private boolean checkLinkTapped(float x, float y) {
    PdfFile pdfFile = pdfView.pdfFile;
    if (pdfFile == null) {
        return false;
    }
    float mappedX = -pdfView.getCurrentXOffset() + x;
    float mappedY = -pdfView.getCurrentYOffset() + y;
    int page = pdfFile.getPageAtOffset(pdfView.isSwipeVertical() ? mappedY : mappedX, pdfView.getZoom());
    SizeF pageSize = pdfFile.getScaledPageSize(page, pdfView.getZoom());
    int pageX, pageY;
    if (pdfView.isSwipeVertical()) {
        pageX = (int) pdfFile.getSecondaryPageOffset(page, pdfView.getZoom());
        pageY = (int) pdfFile.getPageOffset(page, pdfView.getZoom());
    } else {
        pageY = (int) pdfFile.getSecondaryPageOffset(page, pdfView.getZoom());
        pageX = (int) pdfFile.getPageOffset(page, pdfView.getZoom());
    }
    for (PdfDocument.Link link : pdfFile.getPageLinks(page)) {
        RectF mapped = pdfFile.mapRectToDevice(page, pageX, pageY, (int) pageSize.getWidth(),
                (int) pageSize.getHeight(), link.getBounds());
        mapped.sort();
        if (mapped.contains(mappedX, mappedY)) {
            pdfView.callbacks.callLinkHandler(new LinkTapEvent(x, y, mappedX, mappedY, mapped, link));
            return true;
        }
    }
    return false;
}
 
源代码8 项目: cidrawing   文件: Vector2.java
public RectF getRect() {
    RectF rect = new RectF(point1.x, point1.y, point2.x, point2.y);
    rect.sort();
    return rect;
}