1 31 package org.pdfbox.pdmodel.graphics; 32 33 import org.pdfbox.cos.COSArray; 34 import org.pdfbox.cos.COSBase; 35 import org.pdfbox.cos.COSInteger; 36 import org.pdfbox.cos.COSNumber; 37 38 import org.pdfbox.pdmodel.common.COSArrayList; 39 import org.pdfbox.pdmodel.common.COSObjectable; 40 41 import java.util.List ; 42 43 50 public class PDLineDashPattern implements COSObjectable 51 { 52 private COSArray lineDashPattern = null; 53 54 57 public PDLineDashPattern() 58 { 59 lineDashPattern = new COSArray(); 60 lineDashPattern.add( new COSArray() ); 61 lineDashPattern.add( new COSInteger( 0 ) ); 62 } 63 64 69 public PDLineDashPattern( COSArray ldp ) 70 { 71 lineDashPattern = ldp; 72 } 73 74 80 public PDLineDashPattern( COSArray ldp, int phase ) 81 { 82 lineDashPattern = new COSArray(); 83 lineDashPattern.add( ldp ); 84 lineDashPattern.add( new COSInteger( phase ) ); 85 } 86 87 90 public COSBase getCOSObject() 91 { 92 return lineDashPattern; 93 } 94 95 101 public int getPhaseStart() 102 { 103 COSNumber phase = (COSNumber)lineDashPattern.get( 1 ); 104 return phase.intValue(); 105 } 106 107 112 public void setPhaseStart( int phase ) 113 { 114 lineDashPattern.set( 1, new COSInteger( phase ) ); 115 } 116 117 123 public List getDashPattern() 124 { 125 COSArray dashPatterns = (COSArray)lineDashPattern.get( 0 ); 126 return COSArrayList.convertIntegerCOSArrayToList( dashPatterns ); 127 } 128 129 134 public COSArray getCOSDashPattern() 135 { 136 return (COSArray)lineDashPattern.get( 0 ); 137 } 138 139 144 public void setDashPattern( List dashPattern ) 145 { 146 lineDashPattern.set( 0, COSArrayList.converterToCOSArray( dashPattern ) ); 147 } 148 } | Popular Tags |