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 CreatePen extends EMFTag {
18
19 private int index;
20
21 private LogPen pen;
22
23 public CreatePen() {
24 super(38, 1);
25 }
26
27 public CreatePen(int index, LogPen 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 return new CreatePen(emf.readDWORD(), new LogPen(emf));
37 }
38
39 public void write(int tagID, EMFOutputStream emf) throws IOException {
40 emf.writeDWORD(index);
41 pen.write(emf);
42 }
43
44 public String toString() {
45 return super.toString() +
46 "\n index: 0x" + Integer.toHexString(index) +
47 "\n" + pen.toString();
48 }
49
50
51
52
53
54
55 public void render(EMFRenderer renderer) {
56
57
58
59
60
61
62
63
64
65
66
67
68
69 renderer.storeGDIObject(index, pen);
70 }
71 }