Example usage for com.itextpdf.text Rectangle equals

List of usage examples for com.itextpdf.text Rectangle equals

Introduction

In this page you can find the example usage for com.itextpdf.text Rectangle equals.

Prototype

@Override
    public boolean equals(Object obj) 

Source Link

Usage

From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java

License:Open Source License

/**
 * Calculates intersection of the image and the render filter region in the coordinate system relative to the image.
 *
 * @return <code>null</code> if the image is not allowed, {@link java.util.List} of
 * {@link com.itextpdf.text.Rectangle} objects otherwise.
 *//*  w  ww .j a  va 2 s  .com*/
protected List<Rectangle> getCoveredAreas(ImageRenderInfo renderInfo) {
    Rectangle imageRect = calcImageRect(renderInfo);
    List<Rectangle> coveredAreas = new ArrayList<Rectangle>();

    if (imageRect == null) {
        return null;
    }

    for (Rectangle rectangle : rectangles) {
        Rectangle intersectionRect = intersection(imageRect, rectangle);

        if (intersectionRect != null) {
            // True if the image is completely covered
            if (imageRect.equals(intersectionRect)) {
                return null;
            }

            coveredAreas.add(transformIntersection(renderInfo.getImageCTM(), intersectionRect));
        }
    }

    return coveredAreas;
}