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   * ResizePalette TAG.
12   * 
13   * @author Mark Donszelmann
14   * @version $Id: ResizePalette.java 10367 2007-01-22 19:26:48Z duns $
15   */
16  public class ResizePalette extends EMFTag {
17  
18      private int index, entries;
19  
20      public ResizePalette() {
21          super(51, 1);
22      }
23  
24      public ResizePalette(int index, int entries) {
25          this();
26          this.index = index;
27          this.entries = entries;
28      }
29  
30      public EMFTag read(int tagID, EMFInputStream emf, int len)
31              throws IOException {
32  
33          return new ResizePalette(emf.readDWORD(), emf.readDWORD());
34      }
35  
36      public void write(int tagID, EMFOutputStream emf) throws IOException {
37          emf.writeDWORD(index);
38          emf.writeDWORD(entries);
39      }
40  
41      public String toString() {
42          return super.toString() +
43              "\n  index: 0x" + Integer.toHexString(index) +
44              "\n  entries: " + entries;
45      }
46  }