Debian Codegraph @

freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/CreatePen.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 * CreatePen TAG.
13 *
14 * @author Mark Donszelmann
15 * @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/CreatePen.java c0f15e7696d3 2007/01/22 19:26:48 duns $
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 * displays the tag using the renderer
52 *
53 * @param renderer EMFRenderer storing the drawing session data
54 */
55 public void render(EMFRenderer renderer) {
56 // ExtCreatePen
57 //
58 // The ExtCreatePen function creates a logical cosmetic or
59 // geometric pen that has the specified style, width,
60 // and brush attributes.
61 //
62 // HPEN ExtCreatePen(
63 // DWORD dwPenStyle, // pen style
64 // DWORD dwWidth, // pen width
65 // CONST LOGBRUSH *lplb, // brush attributes
66 // DWORD dwStyleCount, // length of custom style array
67 // CONST DWORD *lpStyle // custom style array
68 //);
69 renderer.storeGDIObject(index, pen);
70 }
71 }