public final class ClipperBridge extends Object
For example:
PolyTree to Path
Point to Point.LongPoint
Point.LongPoint to Point
| Modifier and Type | Field and Description |
|---|---|
static Double |
floatMultiplier
Since the clipper library uses integer coordinates, we should convert
our floating point numbers into fixed point numbers by multiplying by
this coefficient.
|
| Constructor and Description |
|---|
ClipperBridge()
Creates new
ClipperBridge instance with default float multiplier value which is 10^14. |
ClipperBridge(Path... paths)
Creates new
ClipperBridge instance with adjusted float multiplier value. |
ClipperBridge(Point[]... points)
Creates new
ClipperBridge instance with adjusted float multiplier value. |
| Modifier and Type | Method and Description |
|---|---|
List<Subpath> |
addPath(ClipperOffset offset,
Path path,
IClipper.JoinType joinType,
IClipper.EndType endType)
Adds all iText
Subpaths of the iText Path to the ClipperOffset object with one
note: it doesn't add degenerate subpaths. |
void |
addPath(IClipper clipper,
Path path,
IClipper.PolyType polyType)
|
boolean |
addPolygonToClipper(IClipper clipper,
Point[] polyVertices,
IClipper.PolyType polyType)
Adds polygon path based on array of
Point (internally converting
them by convertToLongPoints(java.util.List<com.itextpdf.kernel.geom.Point>)) and adds this path to IClipper instance, treating the path as
a closed polygon. |
boolean |
addPolylineSubjectToClipper(IClipper clipper,
Point[] lineVertices)
Adds polyline path based on array of
Point (internally converting
them by convertToLongPoints(java.util.List<com.itextpdf.kernel.geom.Point>)) and adds this path to IClipper instance, treating the path as
a polyline (an open path in terms of clipper library). |
List<Point> |
convertToFloatPoints(List<Point.LongPoint> points)
Converts list of
Point.LongPoint objects into list of
Point objects. |
List<Point.LongPoint> |
convertToLongPoints(List<Point> points)
Converts list of
Point objects into list of
Point.LongPoint objects. |
Path |
convertToPath(PolyTree result)
|
static IClipper.EndType |
getEndType(int lineCapStyle)
Converts iText line cap style constant into the corresponding constant
of the Clipper library.
|
static IClipper.PolyFillType |
getFillType(int fillingRule)
Converts iText filling rule constant into the corresponding constant
of the Clipper library.
|
double |
getFloatMultiplier()
Gets multiplier coefficient for converting our floating point numbers into fixed point numbers.
|
static IClipper.JoinType |
getJoinType(int lineJoinStyle)
Converts iText line join style constant into the corresponding constant
of the Clipper library.
|
float |
longRectCalculateHeight(LongRect rect)
Calculates the height of the rectangle represented by the
LongRect object. |
float |
longRectCalculateWidth(LongRect rect)
Calculates the width of the rectangle represented by the
LongRect object. |
public static Double floatMultiplier
Note that if this value is specified, it will be used for all ClipperBridge instances and dynamic float multiplier calculation will be disabled.
public ClipperBridge()
ClipperBridge instance with default float multiplier value which is 10^14.
Since the clipper library uses integer coordinates, we should convert our floating point numbers into fixed
point numbers by multiplying by float multiplier coefficient. It is possible to vary it to adjust the preciseness
of the calculations: if static floatMultiplier is specified, it will be used for all ClipperBridge
instances and default value will be ignored.
public ClipperBridge(Path... paths)
ClipperBridge instance with adjusted float multiplier value. This instance will work
correctly with the provided paths only.
Since the clipper library uses integer coordinates, we should convert our floating point numbers into fixed
point numbers by multiplying by float multiplier coefficient. It is calculated automatically, however
it is possible to vary it to adjust the preciseness of the calculations: if static floatMultiplier is
specified, it will be used for all ClipperBridge instances and automatic calculation won't work.
paths - paths to calculate multiplier coefficient to convert floating point numbers into fixed point numberspublic ClipperBridge(Point[]... points)
ClipperBridge instance with adjusted float multiplier value. This instance will work
correctly with the provided point only.
Since the clipper library uses integer coordinates, we should convert our floating point numbers into fixed
point numbers by multiplying by float multiplier coefficient. It is calculated automatically, however
it is possible to vary it to adjust the preciseness of the calculations: if static floatMultiplier is
specified, it will be used for all ClipperBridge instances and automatic calculation won't work.
points - points to calculate multiplier coefficient to convert floating point numbers
into fixed point numberspublic void addPath(IClipper clipper, Path path, IClipper.PolyType polyType)
clipper - The IClipper object.path - The Path object to be added to the IClipper.polyType - See IClipper.PolyType.public List<Subpath> addPath(ClipperOffset offset, Path path, IClipper.JoinType joinType, IClipper.EndType endType)
Subpaths of the iText Path to the ClipperOffset object with one
note: it doesn't add degenerate subpaths.offset - the ClipperOffset object to add all iText Subpaths that are not degenerated.path - Path object, containing the required SubpathsjoinType - IClipper join type. The value could be IClipper.JoinType.BEVEL, IClipper.JoinType.ROUND,
IClipper.JoinType.MITERendType - IClipper end type. The value could be IClipper.EndType.CLOSED_POLYGON,
IClipper.EndType.CLOSED_LINE, IClipper.EndType.OPEN_BUTT, IClipper.EndType.OPEN_SQUARE,
IClipper.EndType.OPEN_ROUNDList consisting of all degenerate iText Subpaths of the path.public List<Point> convertToFloatPoints(List<Point.LongPoint> points)
Point.LongPoint objects into list of
Point objects.points - the list of Point.LongPoint objects to convertPoint objects.public List<Point.LongPoint> convertToLongPoints(List<Point> points)
Point objects into list of
Point.LongPoint objects.points - the list of Point objects to convertPoint.LongPoint objects.public static IClipper.JoinType getJoinType(int lineJoinStyle)
lineJoinStyle - iText line join style constant. See PdfCanvasConstantspublic static IClipper.EndType getEndType(int lineCapStyle)
lineCapStyle - iText line cap style constant. See PdfCanvasConstantspublic static IClipper.PolyFillType getFillType(int fillingRule)
fillingRule - Either PdfCanvasConstants.FillingRule.NONZERO_WINDING or
PdfCanvasConstants.FillingRule.EVEN_ODD.public boolean addPolygonToClipper(IClipper clipper, Point[] polyVertices, IClipper.PolyType polyType)
Point (internally converting
them by convertToLongPoints(java.util.List<com.itextpdf.kernel.geom.Point>)) and adds this path to IClipper instance, treating the path as
a closed polygon.
The return value will be false if the path is invalid for clipping. A path is invalid for clipping when:
clipper - IClipper instance to which the created polygon path will be added.polyVertices - an array of Point which will be internally converted
to clipper path and added to the clipper instance.polyType - either IClipper.PolyType.SUBJECT or IClipper.PolyType.CLIP denoting whether added
path is a subject of clipping or a part of the clipping polygon.public boolean addPolylineSubjectToClipper(IClipper clipper, Point[] lineVertices)
Point (internally converting
them by convertToLongPoints(java.util.List<com.itextpdf.kernel.geom.Point>)) and adds this path to IClipper instance, treating the path as
a polyline (an open path in terms of clipper library). This path is added to the subject of future clipping.
Polylines cannot be part of clipping polygon.
The return value will be false if the path is invalid for clipping. A path is invalid for clipping when:
public float longRectCalculateWidth(LongRect rect)
LongRect object.rect - the LongRect object representing the rectangle.public float longRectCalculateHeight(LongRect rect)
LongRect object.rect - the LongRect object representing the rectangle.public double getFloatMultiplier()
Copyright © 1998–2025 Apryse Group NV. All rights reserved.