Package com.itextpdf.awt.geom
Class FlatteningPathIterator
- java.lang.Object
-
- com.itextpdf.awt.geom.FlatteningPathIterator
-
- All Implemented Interfaces:
PathIterator
public class FlatteningPathIterator extends java.lang.Object implements PathIterator
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]
buf
The points buffer(package private) boolean
bufEmpty
The indicator of empty points bufferprivate static int
BUFFER_CAPACITY
The points buffer capacityprivate static int
BUFFER_LIMIT
The default curve subdivision limitprivate static int
BUFFER_SIZE
The default points buffer size(package private) int
bufIndex
The inner cursor position in points buffer(package private) int
bufLimit
The curve subdivision limit(package private) int
bufSize
The current points buffer size(package private) int
bufSubdiv
The current subdivision count(package private) int
bufType
The type of current segment to be flat(package private) double[]
coords
The tamporary buffer for getting points from PathIterator(package private) double
flatness
The flatness of new path(package private) double
flatness2
The square of flatness(package private) PathIterator
p
The source PathIterator(package private) double
px
The x coordinate of previous path segment(package private) double
py
The y coordinate of previous path segment-
Fields inherited from interface com.itextpdf.awt.geom.PathIterator
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO, WIND_EVEN_ODD, WIND_NON_ZERO
-
-
Constructor Summary
Constructors Constructor Description FlatteningPathIterator(PathIterator path, double flatness)
FlatteningPathIterator(PathIterator path, double flatness, int limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
currentSegment(double[] coords)
int
currentSegment(float[] coords)
(package private) void
evaluate()
Calculates flat path points for current segment of the source shape.double
getFlatness()
int
getRecursionLimit()
int
getWindingRule()
boolean
isDone()
void
next()
-
-
-
Field Detail
-
BUFFER_SIZE
private static final int BUFFER_SIZE
The default points buffer size- See Also:
- Constant Field Values
-
BUFFER_LIMIT
private static final int BUFFER_LIMIT
The default curve subdivision limit- See Also:
- Constant Field Values
-
BUFFER_CAPACITY
private static final int BUFFER_CAPACITY
The points buffer capacity- See Also:
- Constant Field Values
-
bufType
int bufType
The type of current segment to be flat
-
bufLimit
int bufLimit
The curve subdivision limit
-
bufSize
int bufSize
The current points buffer size
-
bufIndex
int bufIndex
The inner cursor position in points buffer
-
bufSubdiv
int bufSubdiv
The current subdivision count
-
buf
double[] buf
The points buffer
-
bufEmpty
boolean bufEmpty
The indicator of empty points buffer
-
p
PathIterator p
The source PathIterator
-
flatness
double flatness
The flatness of new path
-
flatness2
double flatness2
The square of flatness
-
px
double px
The x coordinate of previous path segment
-
py
double py
The y coordinate of previous path segment
-
coords
double[] coords
The tamporary buffer for getting points from PathIterator
-
-
Constructor Detail
-
FlatteningPathIterator
public FlatteningPathIterator(PathIterator path, double flatness)
-
FlatteningPathIterator
public FlatteningPathIterator(PathIterator path, double flatness, int limit)
-
-
Method Detail
-
getFlatness
public double getFlatness()
-
getRecursionLimit
public int getRecursionLimit()
-
getWindingRule
public int getWindingRule()
- Specified by:
getWindingRule
in interfacePathIterator
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacePathIterator
-
evaluate
void evaluate()
Calculates flat path points for current segment of the source shape. Line segment is flat by itself. Flatness of quad and cubic curves evaluated by getFlatnessSq() method. Curves subdivided until current flatness is bigger than user defined and subdivision limit isn't exhausted. Single source segment translated to series of buffer points. The less flatness the bigger serries. Every currentSegment() call extract one point from the buffer. When series completed evaluate() takes next source shape segment.
-
next
public void next()
- Specified by:
next
in interfacePathIterator
-
currentSegment
public int currentSegment(float[] coords)
- Specified by:
currentSegment
in interfacePathIterator
-
currentSegment
public int currentSegment(double[] coords)
- Specified by:
currentSegment
in interfacePathIterator
-
-