View Javadoc

1   // Copyright 2002, 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   
10  /**
11   * ScaleViewportExtEx TAG.
12   * 
13   * @author Mark Donszelmann
14   * @version $Id: ScaleViewportExtEx.java 10367 2007-01-22 19:26:48Z duns $
15   */
16  public class ScaleViewportExtEx extends EMFTag {
17  
18      private int xNum, xDenom, yNum, yDenom;
19  
20      public ScaleViewportExtEx() {
21          super(31, 1);
22      }
23  
24      public ScaleViewportExtEx(int xNum, int xDenom, int yNum, int yDenom) {
25          this();
26          this.xNum = xNum;
27          this.xDenom = xDenom;
28          this.yNum = yNum;
29          this.yDenom = yDenom;
30      }
31  
32      public EMFTag read(int tagID, EMFInputStream emf, int len)
33              throws IOException {
34  
35          /* int[] bytes = */ emf.readUnsignedByte(len);
36          return new ScaleViewportExtEx(
37              emf.readLONG(),
38              emf.readLONG(),
39              emf.readLONG(),
40              emf.readLONG());
41      }
42  
43      public void write(int tagID, EMFOutputStream emf) throws IOException {
44          emf.writeLONG(xNum);
45          emf.writeLONG(xDenom);
46          emf.writeLONG(yNum);
47          emf.writeLONG(yDenom);
48      }
49  
50      public String toString() {
51          return super.toString() +
52              "\n  xNum: " + xNum +
53              "\n  xDenom: " + xDenom +
54              "\n  yNum: " + yNum +
55              "\n  yDenom: " + yDenom;
56      }
57  }