@Test public void createBoundingRectanglesFromQuadPointsTest02() { float[] points = {0, 0, 2, 1, 1, 2, -2, 1, 0, -1, 2, 0, 1, 1, -2, 0, 1}; PdfArray quadpoints = new PdfArray(points); boolean exception = false; try { Rectangle.createBoundingRectanglesFromQuadPoint(quadpoints); } catch (PdfException e) { exception = true; } Assert.assertTrue(exception); }
public static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints) throws PdfException { List<Rectangle> boundingRectangles = new ArrayList<>(); if (quadPoints.size() % 8 != 0) { throw new PdfException(PdfException.QuadPointArrayLengthIsNotAMultipleOfEight); } for (int i = 0; i < quadPoints.size(); i += 8) { float[] quadPointEntry = Arrays.copyOfRange(quadPoints.toFloatArray(),i,i+8); PdfArray quadPointEntryFA = new PdfArray(quadPointEntry); boundingRectangles.add(createBoundingRectangleFromQuadPoint(quadPointEntryFA)); } return boundingRectangles; }
Rectangle implements Cloneable, Serializable { public static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints) throws PdfException { List<Rectangle> boundingRectangles = new ArrayList<>(); if (quadPoints.size() % 8 != 0) { throw new PdfException(PdfException.QuadPointArrayLengthIsNotAMultipleOfEight); } for (int i = 0; i < quadPoints.size(); i += 8) { float[] quadPointEntry = Arrays.copyOfRange(quadPoints.toFloatArray(),i,i+8); PdfArray quadPointEntryFA = new PdfArray(quadPointEntry); boundingRectangles.add(createBoundingRectangleFromQuadPoint(quadPointEntryFA)); } return boundingRectangles; } }
Rectangle implements Cloneable, Serializable { public static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints) throws PdfException { List<Rectangle> boundingRectangles = new ArrayList<>(); if (quadPoints.size() % 8 != 0) { throw new PdfException(PdfException.QuadPointArrayLengthIsNotAMultipleOfEight); } for (int i = 0; i < quadPoints.size(); i += 8) { float[] quadPointEntry = Arrays.copyOfRange(quadPoints.toFloatArray(),i,i+8); PdfArray quadPointEntryFA = new PdfArray(quadPointEntry); boundingRectangles.add(createBoundingRectangleFromQuadPoint(quadPointEntryFA)); } return boundingRectangles; } Rectangle(float x, float y, float width, float height);  Rectangle(float width, float height);  Rectangle(Rectangle rect); }
Rectangle implements Cloneable, Serializable { public static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints) throws PdfException { List<Rectangle> boundingRectangles = new ArrayList<>(); if (quadPoints.size() % 8 != 0) { throw new PdfException(PdfException.QuadPointArrayLengthIsNotAMultipleOfEight); } for (int i = 0; i < quadPoints.size(); i += 8) { float[] quadPointEntry = Arrays.copyOfRange(quadPoints.toFloatArray(),i,i+8); PdfArray quadPointEntryFA = new PdfArray(quadPointEntry); boundingRectangles.add(createBoundingRectangleFromQuadPoint(quadPointEntryFA)); } return boundingRectangles; } Rectangle(float x, float y, float width, float height);  Rectangle(float width, float height);  Rectangle(Rectangle rect); static Rectangle getCommonRectangle(Rectangle... rectangles); static Rectangle getRectangleOnRotatedPage(Rectangle rect, PdfPage page); static Rectangle calculateBBox(List<Point> points); Point[] toPointsArray(); Rectangle getIntersection(Rectangle rect); boolean contains(Rectangle rect); boolean overlaps(final Rectangle rect); boolean overlaps(final Rectangle rect, final float epsilon); Rectangle setBbox(float llx, float lly, float urx, float ury); float getX(); Rectangle setX(float x); float getY(); Rectangle setY(float y); float getWidth(); Rectangle setWidth(float width); float getHeight(); Rectangle setHeight(float height); Rectangle increaseHeight(float extra); Rectangle decreaseHeight(float extra); Rectangle increaseWidth(float extra); Rectangle decreaseWidth(float extra); float getLeft(); float getRight(); float getTop(); float getBottom(); Rectangle moveDown(float move); Rectangle moveUp(float move); Rectangle moveRight(float move); Rectangle moveLeft(float move); Rectangle applyMargins(float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse); boolean intersectsLine(float x1, float y1, float x2, float y2); @Override String toString(); @Override Rectangle clone(); boolean equalsWithEpsilon(Rectangle that); boolean equalsWithEpsilon(Rectangle that, float eps); static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints); static Rectangle createBoundingRectangleFromQuadPoint(PdfArray quadPoints); }
Rectangle implements Cloneable, Serializable { public static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints) throws PdfException { List<Rectangle> boundingRectangles = new ArrayList<>(); if (quadPoints.size() % 8 != 0) { throw new PdfException(PdfException.QuadPointArrayLengthIsNotAMultipleOfEight); } for (int i = 0; i < quadPoints.size(); i += 8) { float[] quadPointEntry = Arrays.copyOfRange(quadPoints.toFloatArray(),i,i+8); PdfArray quadPointEntryFA = new PdfArray(quadPointEntry); boundingRectangles.add(createBoundingRectangleFromQuadPoint(quadPointEntryFA)); } return boundingRectangles; } Rectangle(float x, float y, float width, float height);  Rectangle(float width, float height);  Rectangle(Rectangle rect); static Rectangle getCommonRectangle(Rectangle... rectangles); static Rectangle getRectangleOnRotatedPage(Rectangle rect, PdfPage page); static Rectangle calculateBBox(List<Point> points); Point[] toPointsArray(); Rectangle getIntersection(Rectangle rect); boolean contains(Rectangle rect); boolean overlaps(final Rectangle rect); boolean overlaps(final Rectangle rect, final float epsilon); Rectangle setBbox(float llx, float lly, float urx, float ury); float getX(); Rectangle setX(float x); float getY(); Rectangle setY(float y); float getWidth(); Rectangle setWidth(float width); float getHeight(); Rectangle setHeight(float height); Rectangle increaseHeight(float extra); Rectangle decreaseHeight(float extra); Rectangle increaseWidth(float extra); Rectangle decreaseWidth(float extra); float getLeft(); float getRight(); float getTop(); float getBottom(); Rectangle moveDown(float move); Rectangle moveUp(float move); Rectangle moveRight(float move); Rectangle moveLeft(float move); Rectangle applyMargins(float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse); boolean intersectsLine(float x1, float y1, float x2, float y2); @Override String toString(); @Override Rectangle clone(); boolean equalsWithEpsilon(Rectangle that); boolean equalsWithEpsilon(Rectangle that, float eps); static List<Rectangle> createBoundingRectanglesFromQuadPoint(PdfArray quadPoints); static Rectangle createBoundingRectangleFromQuadPoint(PdfArray quadPoints);  }