Debian Codegraph @

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

raw
1 // Copyright 2002, FreeHEP.
2 package org.freehep.graphicsio.emf.gdi;
3
4 import java.awt.Rectangle;
5 import java.awt.geom.GeneralPath;
6 import java.io.IOException;
7
8 import org.freehep.graphicsio.emf.EMFInputStream;
9 import org.freehep.graphicsio.emf.EMFOutputStream;
10 import org.freehep.graphicsio.emf.EMFTag;
11 import org.freehep.graphicsio.emf.EMFRenderer;
12
13 /**
14 * StrokePath TAG.
15 *
16 * @author Mark Donszelmann
17 * @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/StrokePath.java c0f15e7696d3 2007/01/22 19:26:48 duns $
18 */
19 public class StrokePath extends EMFTag {
20
21 private Rectangle bounds;
22
23 public StrokePath() {
24 super(64, 1);
25 }
26
27 public StrokePath(Rectangle bounds) {
28 this();
29 this.bounds = bounds;
30 }
31
32 public EMFTag read(int tagID, EMFInputStream emf, int len)
33 throws IOException {
34
35 return new StrokePath(emf.readRECTL());
36 }
37
38 public void write(int tagID, EMFOutputStream emf) throws IOException {
39 emf.writeRECTL(bounds);
40 }
41
42 public String toString() {
43 return super.toString() + "\n bounds: " + bounds;
44 }
45
46 /**
47 * displays the tag using the renderer
48 *
49 * @param renderer EMFRenderer storing the drawing session data
50 */
51 public void render(EMFRenderer renderer) {
52 GeneralPath currentPath = renderer.getPath();
53 // fills the current path
54 if (currentPath != null) {
55 renderer.drawShape(currentPath);
56 renderer.setPath(null);
57 }
58 }
59 }
60