1 50 51 package com.lowagie.text.pdf; 52 53 import java.io.IOException ; 54 import java.io.OutputStream ; 55 56 62 63 public class PdfDashPattern extends PdfArray { 64 65 67 68 private float dash = -1; 69 70 71 private float gap = -1; 72 73 74 private float phase = -1; 75 76 78 81 82 public PdfDashPattern() { 83 super(); 84 } 85 86 89 90 public PdfDashPattern(float dash) { 91 super(new PdfNumber(dash)); 92 this.dash = dash; 93 } 94 95 98 99 public PdfDashPattern(float dash, float gap) { 100 super(new PdfNumber(dash)); 101 add(new PdfNumber(gap)); 102 this.dash = dash; 103 this.gap = gap; 104 } 105 106 109 110 public PdfDashPattern(float dash, float gap, float phase) { 111 super(new PdfNumber(dash)); 112 add(new PdfNumber(gap)); 113 this.dash = dash; 114 this.gap = gap; 115 this.phase = phase; 116 } 117 118 public void add(float n) { 119 add(new PdfNumber(n)); 120 } 121 122 125 126 public void toPdf(PdfWriter writer, OutputStream os) throws IOException { 127 os.write('['); 128 129 if (dash >= 0) { 130 new PdfNumber(dash).toPdf(writer, os); 131 if (gap >= 0) { 132 os.write(' '); 133 new PdfNumber(gap).toPdf(writer, os); 134 } 135 } 136 os.write(']'); 137 if (phase >=0) { 138 os.write(' '); 139 new PdfNumber(phase).toPdf(writer, os); 140 } 141 } 142 } | Popular Tags |