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 CreateBrushIndirect extends EMFTag {
18
19 private int index;
20
21 private LogBrush32 brush;
22
23 public CreateBrushIndirect() {
24 super(39, 1);
25 }
26
27 public CreateBrushIndirect(int index, LogBrush32 brush) {
28 this();
29 this.index = index;
30 this.brush = brush;
31 }
32
33 public EMFTag read(int tagID, EMFInputStream emf, int len)
34 throws IOException {
35
36 return new CreateBrushIndirect(
37 emf.readDWORD(),
38 new LogBrush32(emf));
39 }
40
41 public void write(int tagID, EMFOutputStream emf) throws IOException {
42 emf.writeDWORD(index);
43 brush.write(emf);
44 }
45
46 public String toString() {
47 return super.toString() +
48 "\n index: 0x" + Integer.toHexString(index) +
49 "\n" + brush.toString();
50 }
51
52
53
54
55
56
57 public void render(EMFRenderer renderer) {
58
59
60
61
62
63
64
65
66 renderer.storeGDIObject(index, brush);
67 }
68 }