Intersection() public méthode

public Intersection ( RectangleJ r ) : RectangleJ
r RectangleJ
Résultat RectangleJ
        /**
         * Returns the intersection between the crop, trim art or bleed box and the parameter intersectingRectangle.
         * This method returns null when
         * - there is no intersection
         * - any of the above boxes are not defined
         * - the parameter intersectingRectangle is null
         *
         * @param boxName crop, trim, art, bleed
         * @param intersectingRectangle the rectangle that intersects the rectangle associated to the boxName
         * @return the intersection of the two rectangles
         */
        public Rectangle GetBoxSize(String boxName, Rectangle intersectingRectangle) {
            Rectangle pdfRectangle = pdf.GetBoxSize(boxName);

            if ( pdfRectangle == null || intersectingRectangle == null ) { // no intersection
                return null;
            }
            //com.itextpdf.awt.geom.Rectangle
            RectangleJ boxRect = new RectangleJ(pdfRectangle);
            RectangleJ intRect = new RectangleJ(intersectingRectangle);
            RectangleJ outRect = boxRect.Intersection(intRect);

            if (outRect.IsEmpty()) { // no intersection
                return null;
            }

            Rectangle output = new Rectangle(outRect.X, outRect.Y, outRect.X + outRect.Width, outRect.Y + outRect.Height);
            output.Normalize();
            return output;
        }
        /**
         * @return null if the intersection is empty, {@link com.itextpdf.text.Rectangle} representing intersection otherwise
         */
        private Rectangle Intersection(Rectangle rect1, Rectangle rect2) {
            RectangleJ awtRect1 = new RectangleJ(rect1);
            RectangleJ awtRect2 = new RectangleJ(rect2);
            RectangleJ awtIntersection = awtRect1.Intersection(awtRect2);

            return awtIntersection.IsEmpty() ? null : new Rectangle(awtIntersection);
        }