1
2 package org.freehep.graphicsio.emf.gdi;
3
4 import java.awt.Color;
5 import java.io.IOException;
6 import java.util.logging.Logger;
7
8 import org.freehep.graphicsio.emf.EMFConstants;
9 import org.freehep.graphicsio.emf.EMFInputStream;
10 import org.freehep.graphicsio.emf.EMFOutputStream;
11 import org.freehep.graphicsio.emf.EMFRenderer;
12
13
14
15
16
17
18
19
20 public class LogBrush32 implements EMFConstants, GDIObject {
21
22 private int style;
23
24 private Color color;
25
26 private int hatch;
27
28 public LogBrush32(int style, Color color, int hatch) {
29 this.style = style;
30 this.color = color;
31 this.hatch = hatch;
32 }
33
34 public LogBrush32(EMFInputStream emf) throws IOException {
35 style = emf.readUINT();
36 color = emf.readCOLORREF();
37 hatch = emf.readULONG();
38 }
39
40 public void write(EMFOutputStream emf) throws IOException {
41 emf.writeUINT(style);
42 emf.writeCOLORREF(color);
43 emf.writeULONG(hatch);
44 }
45
46 public String toString() {
47 return " LogBrush32\n" + " style: " + style +
48 "\n color: " + color +
49 "\n hatch: " + hatch;
50 }
51
52
53
54
55
56
57 public void render(EMFRenderer renderer) {
58 if (style == EMFConstants.BS_SOLID) {
59 renderer.setBrushPaint(color);
60 } else if (style == EMFConstants.BS_NULL) {
61
62
63
64 renderer.setBrushPaint(new Color(0, 0, 0, 0));
65
66
67
68
69 } else {
70 Logger logger = Logger.getLogger("org.freehep.graphicsio.emf");
71 logger.warning("LogBrush32 style not supported: " + toString());
72 renderer.setBrushPaint(color);
73 }
74 }
75 }