/**
* 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.
*/
protected internal virtual IList<Rectangle> GetCoveredAreas(ImageRenderInfo renderInfo) {
Rectangle imageRect = CalcImageRect(renderInfo);
IList<Rectangle> coveredAreas = new List<Rectangle>();
if (imageRect == null) {
return null;
}
foreach (Rectangle rectangle in 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;
}