1
2 package org.freehep.graphicsio.emf.gdi;
3
4 import java.io.IOException;
5
6 import org.freehep.graphicsio.emf.EMFInputStream;
7 import org.freehep.graphicsio.emf.EMFOutputStream;
8 import org.freehep.graphicsio.emf.EMFTag;
9 import org.freehep.graphicsio.emf.EMFRenderer;
10
11
12
13
14
15
16
17 public class ExtCreatePen extends EMFTag {
18
19 private int index;
20
21 private ExtLogPen pen;
22
23 public ExtCreatePen() {
24 super(95, 1);
25 }
26
27 public ExtCreatePen(int index, ExtLogPen pen) {
28 this();
29 this.index = index;
30 this.pen = pen;
31 }
32
33 public EMFTag read(int tagID, EMFInputStream emf, int len)
34 throws IOException {
35
36 int index = emf.readDWORD();
37
38
39
40
41 return new ExtCreatePen(index, new ExtLogPen(emf));
42 }
43
44 public void write(int tagID, EMFOutputStream emf) throws IOException {
45 emf.writeDWORD(index);
46 emf.writeDWORD(0);
47 emf.writeDWORD(0);
48 emf.writeDWORD(0);
49 emf.writeDWORD(0);
50 pen.write(emf);
51 }
52
53 public String toString() {
54 return super.toString() +
55 "\n index: 0x" + Integer.toHexString(index) +
56 "\n" + pen.toString();
57 }
58
59
60
61
62
63
64 public void render(EMFRenderer renderer) {
65 renderer.storeGDIObject(index, pen);
66 }
67 }