1
2 package org.freehep.graphicsio.emf.gdi;
3
4 import java.awt.Point;
5 import java.awt.Rectangle;
6 import java.io.IOException;
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.EMFTag;
12
13
14
15
16
17
18
19 public class PolyDraw extends EMFTag implements EMFConstants {
20
21 private Rectangle bounds;
22
23 private Point[] points;
24
25 private byte[] types;
26
27 public PolyDraw() {
28 super(56, 1);
29 }
30
31 public PolyDraw(Rectangle bounds, Point[] points, byte[] types) {
32 this();
33 this.bounds = bounds;
34 this.points = points;
35 this.types = types;
36 }
37
38 public EMFTag read(int tagID, EMFInputStream emf, int len)
39 throws IOException {
40
41 int n;
42 return new PolyDraw(
43 emf.readRECTL(),
44 emf.readPOINTL(n = emf.readDWORD()),
45 emf.readBYTE(n));
46 }
47
48 public void write(int tagID, EMFOutputStream emf) throws IOException {
49 emf.writeRECTL(bounds);
50 emf.writeDWORD(points.length);
51 emf.writePOINTL(points);
52 emf.writeBYTE(types);
53 }
54
55 public String toString() {
56 return super.toString() +
57 "\n bounds: " + bounds +
58 "\n #points: " + points.length;
59 }
60 }