Package com.itextpdf.pdfcleanup
Class LineDashPattern
java.lang.Object
com.itextpdf.pdfcleanup.LineDashPattern
Represents the line dash pattern. The line dash pattern shall control the pattern of dashes and gaps used to stroke paths. It shall be specified by a dash array and a dash phase.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Class representing a single element of a dash array -
Constructor Summary
ConstructorDescriptionLineDashPattern
(com.itextpdf.kernel.pdf.PdfArray dashArray, float dashPhase) Creates newLineDashPattern
object. -
Method Summary
Modifier and TypeMethodDescriptionstatic com.itextpdf.kernel.geom.Path
applyDashPattern
(com.itextpdf.kernel.geom.Path path, LineDashPattern lineDashPattern) Apply a LineDashPattern along a Pathcom.itextpdf.kernel.pdf.PdfArray
Getter for the dash array.float
Getter for the dash phase.boolean
isSolid()
Checks whether the dashed pattern is solid or not.void
setDashArray
(com.itextpdf.kernel.pdf.PdfArray dashArray) Setter for the dash array.void
setDashPhase
(float dashPhase) Setter for the dash phase.
-
Constructor Details
-
LineDashPattern
public LineDashPattern(com.itextpdf.kernel.pdf.PdfArray dashArray, float dashPhase) Creates newLineDashPattern
object.- Parameters:
-
dashArray
- The dash array. SeegetDashArray()
-
dashPhase
- The dash phase. SeegetDashPhase()
-
-
Method Details
-
getDashArray
public com.itextpdf.kernel.pdf.PdfArray getDashArray()Getter for the dash array.The dash array’s elements is number that specify the lengths of alternating dashes and gaps; the numbers are nonnegative. The elements are expressed in user space units.
- Returns:
- The dash array.
-
setDashArray
public void setDashArray(com.itextpdf.kernel.pdf.PdfArray dashArray) Setter for the dash array. SeegetDashArray()
- Parameters:
-
dashArray
- New dash array.
-
getDashPhase
public float getDashPhase()Getter for the dash phase.The dash phase shall specify the distance into the dash pattern at which to start the dash. The elements are expressed in user space units.
- Returns:
- The dash phase.
-
setDashPhase
public void setDashPhase(float dashPhase) Setter for the dash phase. SeegetDashArray()
- Parameters:
-
dashPhase
- New dash phase.
-
isSolid
public boolean isSolid()Checks whether the dashed pattern is solid or not. It's solid when the size of a dash array is even and sum of all the units off in the array is 0. For example: [3 0 4 0 5 0 6 0] (sum is 0), [3 0 4 0 5 1] (sum is 1).- Returns:
- is the dashed pattern solid or not
-
applyDashPattern
public static com.itextpdf.kernel.geom.Path applyDashPattern(com.itextpdf.kernel.geom.Path path, LineDashPattern lineDashPattern) Apply a LineDashPattern along a Path- Parameters:
-
path
- input path -
lineDashPattern
- input LineDashPattern - Returns:
- a dashed Path
-