Class PdfCleanUpRegionFilter

    • Field Detail

      • rectangles

        private java.util.List<Rectangle> rectangles
      • circleApproximationConst

        private static final double circleApproximationConst
        See Also:
        Constant Field Values
    • Constructor Detail

      • PdfCleanUpRegionFilter

        public PdfCleanUpRegionFilter​(java.util.List<Rectangle> rectangles)
    • Method Detail

      • allowText

        public boolean allowText​(TextRenderInfo renderInfo)
        Checks if the text is inside render filter region.
        Overrides:
        allowText in class RenderFilter
        Returns:
        true if the text render operation should be performed
      • getCoveredAreas

        protected java.util.List<Rectangle> getCoveredAreas​(ImageRenderInfo renderInfo)
        Calculates intersection of the image and the render filter region in the coordinate system relative to the image.
        Returns:
        null if the image is not allowed, List of Rectangle objects otherwise.
      • filterStrokePath

        protected Path filterStrokePath​(Path sourcePath,
                                        Matrix ctm,
                                        float lineWidth,
                                        int lineCapStyle,
                                        int lineJoinStyle,
                                        float miterLimit,
                                        LineDashPattern lineDashPattern)
      • filterFillPath

        protected Path filterFillPath​(Path path,
                                      Matrix ctm,
                                      int fillingRule)
        Note: this method will close all unclosed subpaths of the passed path.
        Parameters:
        fillingRule - If the subpath is contour, pass any value.
      • getJoinType

        private static Clipper.JoinType getJoinType​(int lineJoinStyle)
      • getEndType

        private static Clipper.EndType getEndType​(int lineCapStyle)
      • convertToCircles

        private static java.util.List<Subpath> convertToCircles​(java.util.List<Subpath> degenerateSubpaths,
                                                                double radius)
        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 java.util.List<Subpath> convertToSquares​(java.util.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

        private static java.util.List<Point2D> getPathApproximation​(Path path)
      • constructSquare

        private static Subpath constructSquare​(Point2D squareCenter,
                                               double widthHalf,
                                               double rotationAngle)
      • getRotatedSquareVertices

        private static Point2D[] getRotatedSquareVertices​(Point2D[] orthogonalSquareVertices,
                                                          double angle,
                                                          Point2D squareCenter)
      • approximateCircle

        private static BezierCurve[] approximateCircle​(Point2D center,
                                                       double radius)
      • addPath

        private static void addPath​(Clipper clipper,
                                    Path path)
      • convertToIntPoints

        private static Path convertToIntPoints​(java.util.List<Point2D> points)
      • convertToFloatPoints

        private static java.util.List<Point2D> convertToFloatPoints​(java.util.List<Point.LongPoint> points)
      • convertToPath

        private static Path convertToPath​(PolyTree result)
      • addContour

        private static void addContour​(Path path,
                                       java.util.List<Point.LongPoint> contour,
                                       java.lang.Boolean close)
      • intersect

        private boolean intersect​(Point2D[] rect1,
                                  Point2D[] rect2)
      • calcImageRect

        private Rectangle calcImageRect​(ImageRenderInfo renderInfo)
        Returns:
        Image boundary rectangle in device space.
      • transformIntersection

        private Rectangle transformIntersection​(Matrix imageCTM,
                                                Rectangle rect)
        Transforms the given Rectangle into the image coordinate system which is [0,1]x[0,1] by default
      • getUnitVector

        private static Point2D getUnitVector​(Point2D vector)
      • getVectorEuclideanNorm

        private static double getVectorEuclideanNorm​(Point2D vector)
      • applyDash

        private static float applyDash​(Path dashedPath,
                                       Point2D segStart,
                                       Point2D segEnd,
                                       Point2D dashTo,
                                       boolean isGap)
      • liesOnSegment

        private static boolean liesOnSegment​(Point2D segStart,
                                             Point2D segEnd,
                                             Point2D point)
      • transformPoints

        private Point2D[] transformPoints​(Matrix transormationMatrix,
                                          boolean inverse,
                                          Point2D... points)