Package com.itextpdf.text.pdf.pdfcleanup
Class PdfCleanUpRegionFilter
java.lang.Object
com.itextpdf.text.pdf.parser.RenderFilter
com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRegionFilter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addContour
(Path path, List<Point.LongPoint> contour, Boolean close) addPath
(ClipperOffset offset, Path path, Clipper.JoinType joinType, Clipper.EndType endType) Adds all subpaths of the path to theClipperOffset
object with one note: it doesn't add degenerate subpaths.private static void
private static void
addRect
(Clipper clipper, Point2D[] rectVertices, Clipper.PolyType polyType) boolean
allowImage
(ImageRenderInfo renderInfo) boolean
allowText
(TextRenderInfo renderInfo) Checks if the text is inside render filter region.private static float
private static Path
applyDashPattern
(Path path, LineDashPattern lineDashPattern) private static BezierCurve[]
approximateCircle
(Point2D center, double radius) private Rectangle
calcImageRect
(ImageRenderInfo renderInfo) private static Point2D
componentwiseDiff
(Point2D minuend, Point2D subtrahend) private static Subpath
constructSquare
(Point2D squareCenter, double widthHalf, double rotationAngle) convertToCircles
(List<Subpath> degenerateSubpaths, double radius) Converts specified degenerate subpaths to circles.convertToFloatPoints
(List<Point.LongPoint> points) private static Path
convertToIntPoints
(List<Point2D> points) private static Path
convertToPath
(PolyTree result) convertToSquares
(List<Subpath> degenerateSubpaths, double squareWidth, Path sourcePath) Converts specified degenerate subpaths to squares.protected Path
filterFillPath
(Path path, Matrix ctm, int fillingRule) Note: this method will close all unclosed subpaths of the passed path.protected Path
filterStrokePath
(Path sourcePath, Matrix ctm, float lineWidth, int lineCapStyle, int lineJoinStyle, float miterLimit, LineDashPattern lineDashPattern) getCoveredAreas
(ImageRenderInfo renderInfo) Calculates intersection of the image and the render filter region in the coordinate system relative to the image.private static Clipper.EndType
getEndType
(int lineCapStyle) private static Clipper.JoinType
getJoinType
(int lineJoinStyle) private static Point2D
getNextPoint
(Point2D segStart, Point2D segEnd, float dist) getPathApproximation
(Path path) private Rectangle
getRectangle
(Point2D p1, Point2D p2, Point2D p3, Point2D p4) Constructs Rectangle object on the given pointsprivate static Point2D[]
getRotatedSquareVertices
(Point2D[] orthogonalSquareVertices, double angle, Point2D squareCenter) private static Point2D
getUnitVector
(Point2D vector) private static double
getVectorEuclideanNorm
(Point2D vector) private Point2D[]
getVertices
(Rectangle rect) private boolean
private Rectangle
intersection
(Rectangle rect1, Rectangle rect2) private static boolean
liesOnSegment
(Point2D segStart, Point2D segEnd, Point2D point) private Rectangle
transformIntersection
(Matrix imageCTM, Rectangle rect) Transforms the given Rectangle into the image coordinate system which is [0,1]x[0,1] by defaultprivate Point2D[]
transformPoints
(Matrix transormationMatrix, boolean inverse, Point2D... points)
-
Field Details
-
rectangles
-
circleApproximationConst
private static final double circleApproximationConst- See Also:
-
-
Constructor Details
-
PdfCleanUpRegionFilter
-
-
Method Details
-
allowText
Checks if the text is inside render filter region.- Overrides:
allowText
in classRenderFilter
- Parameters:
renderInfo
-- Returns:
- true if the text render operation should be performed
-
allowImage
- Overrides:
allowImage
in classRenderFilter
- Parameters:
renderInfo
-- Returns:
- true if the image render operation should be performed
-
getCoveredAreas
Calculates intersection of the image and the render filter region in the coordinate system relative to the image. -
filterStrokePath
protected Path filterStrokePath(Path sourcePath, Matrix ctm, float lineWidth, int lineCapStyle, int lineJoinStyle, float miterLimit, LineDashPattern lineDashPattern) -
filterFillPath
Note: this method will close all unclosed subpaths of the passed path.- Parameters:
fillingRule
- If the subpath is contour, pass any value.
-
getJoinType
-
getEndType
-
convertToCircles
Converts specified degenerate subpaths to circles. Note: actually the resultant subpaths are not real circles but approximated.- Parameters:
radius
- Radius of each constructed circle.- Returns:
List
consisting of circles constructed on given degenerated subpaths.
-
convertToSquares
private static List<Subpath> convertToSquares(List<Subpath> degenerateSubpaths, double squareWidth, Path sourcePath) Converts specified degenerate subpaths to squares. Note: the list of degenerate subpaths should contain at least 2 elements. Otherwise we can't determine the direction which the rotation of each square depends on.- Parameters:
squareWidth
- Width of each constructed square.sourcePath
- The path which dash pattern applied to. Needed to calc rotation angle of each square.- Returns:
List
consisting of squares constructed on given degenerated subpaths.
-
getPathApproximation
-
constructSquare
-
getRotatedSquareVertices
-
addPath
private static List<Subpath> addPath(ClipperOffset offset, Path path, Clipper.JoinType joinType, Clipper.EndType endType) Adds all subpaths of the path to theClipperOffset
object with one note: it doesn't add degenerate subpaths.- Returns:
List
consisting of all degenerate subpaths of the path.
-
approximateCircle
-
addPath
-
addRect
-
convertToIntPoints
-
convertToFloatPoints
-
convertToPath
-
addContour
-
getVertices
-
intersect
-
calcImageRect
- Returns:
- Image boundary rectangle in device space.
-
intersection
- Returns:
- null if the intersection is empty,
Rectangle
representing intersection otherwise
-
transformIntersection
Transforms the given Rectangle into the image coordinate system which is [0,1]x[0,1] by default -
getRectangle
Constructs Rectangle object on the given points -
applyDashPattern
-
getNextPoint
-
componentwiseDiff
-
getUnitVector
-
getVectorEuclideanNorm
-
applyDash
-
liesOnSegment
-
transformPoints
-