This class represents the line dash pattern for a graphics state. See PDF
Reference 1.5 section 4.3.2
Method from org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern Detail: |
public Object clone() {
PDLineDashPattern pattern = null;
try
{
pattern = (PDLineDashPattern)super.clone();
pattern.setDashPattern(getDashPattern());
pattern.setPhaseStart(getPhaseStart());
}
catch(CloneNotSupportedException exception)
{
exception.printStackTrace();
}
return pattern;
}
|
public COSArray getCOSDashPattern() {
return (COSArray)lineDashPattern.get( 0 );
}
Get the line dash pattern as a COS object. |
public COSBase getCOSObject() {
return lineDashPattern;
}
|
public List getDashPattern() {
COSArray dashPatterns = (COSArray)lineDashPattern.get( 0 );
return COSArrayList.convertIntegerCOSArrayToList( dashPatterns );
}
This will return a list of java.lang.Integer objects that represent the line
dash pattern appearance. |
public int getPhaseStart() {
COSNumber phase = (COSNumber)lineDashPattern.get( 1 );
return phase.intValue();
}
This will get the line dash pattern phase. The dash phase specifies the
distance into the dash pattern at which to start the dash. |
public boolean isDashPatternEmpty() {
float[] dashPattern = getCOSDashPattern().toFloatArray();
boolean dashPatternEmpty = true;
if (dashPattern != null)
{
int arraySize = dashPattern.length;
for(int i=0;i< arraySize;i++)
{
if (dashPattern[i] > 0)
{
dashPatternEmpty = false;
break;
}
}
}
return dashPatternEmpty;
}
Checks if the dashPattern is empty or all values equals 0. |
public void setDashPattern(List dashPattern) {
lineDashPattern.set( 0, COSArrayList.converterToCOSArray( dashPattern ) );
}
This will replace the existing line dash pattern. |
public void setPhaseStart(int phase) {
lineDashPattern.set( 1, phase );
}
This will set the line dash pattern phase. |