Package com.itextpdf.text.pdf.parser
Class LineDashPattern
- java.lang.Object
-
- com.itextpdf.text.pdf.parser.LineDashPattern
-
public class LineDashPattern extends java.lang.Object
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.- Since:
- 5.5.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LineDashPattern.DashArrayElem
-
Field Summary
Fields Modifier and Type Field Description private LineDashPattern.DashArrayElem
currentElem
private int
currentIndex
private PdfArray
dashArray
private float
dashPhase
private int
elemOrdinalNumber
-
Constructor Summary
Constructors Constructor Description LineDashPattern(PdfArray dashArray, float dashPhase)
Creates newLineDashPattern
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfArray
getDashArray()
Getter for the dash array.float
getDashPhase()
Getter for the dash phase.private void
initFirst(float phase)
private boolean
isEven(int num)
boolean
isSolid()
Checks whether the dashed pattern is solid or not.LineDashPattern.DashArrayElem
next()
Calculates and returns the next element which is either gap or dash.void
reset()
Resets the dash array so that thenext()
method will start from the beginning of the dash array.void
setDashArray(PdfArray dashArray)
Setter for the dash array.void
setDashPhase(float dashPhase)
Setter for the dash phase.
-
-
-
Field Detail
-
dashArray
private PdfArray dashArray
-
dashPhase
private float dashPhase
-
currentIndex
private int currentIndex
-
elemOrdinalNumber
private int elemOrdinalNumber
-
currentElem
private LineDashPattern.DashArrayElem currentElem
-
-
Constructor Detail
-
LineDashPattern
public LineDashPattern(PdfArray dashArray, float dashPhase)
Creates newLineDashPattern
object.- Parameters:
dashArray
- The dash array. SeegetDashArray()
dashPhase
- The dash phase. SeegetDashPhase()
-
-
Method Detail
-
getDashArray
public 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(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.
-
next
public LineDashPattern.DashArrayElem next()
Calculates and returns the next element which is either gap or dash.- Returns:
- The next dash array's element.
-
reset
public void reset()
Resets the dash array so that thenext()
method will start from the beginning of the dash array.
-
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).
-
initFirst
private void initFirst(float phase)
-
isEven
private boolean isEven(int num)
-
-