Debian Codegraph @

freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/CreateBrushIndirect.java

raw
1 // Copyright 2001, FreeHEP.
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 * CreateBrushIndirect TAG.
13 *
14 * @author Mark Donszelmann
15 * @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/CreateBrushIndirect.java c0f15e7696d3 2007/01/22 19:26:48 duns $
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 * displays the tag using the renderer
54 *
55 * @param renderer EMFRenderer storing the drawing session data
56 */
57 public void render(EMFRenderer renderer) {
58 // CreateBrushIndirect
59 //
60 // The CreateBrushIndirect function creates a logical brush that has the
61 // specified style, color, and pattern.
62 //
63 // HBRUSH CreateBrushIndirect(
64 // CONST LOGBRUSH *lplb // brush information
65 // );
66 renderer.storeGDIObject(index, brush);
67 }
68 }