View Javadoc

1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf;
3   
4   import java.io.IOException;
5   
6   /**
7    * DefineButtonCxform TAG.
8    * 
9    * @author Mark Donszelmann
10   * @author Charles Loomis
11   * @version $Id: DefineButtonCxform.java 8584 2006-08-10 23:06:37Z duns $
12   */
13  public class DefineButtonCxform extends DefinitionTag {
14  
15      private int character;
16  
17      private ColorXform cxform;
18  
19      public DefineButtonCxform(int id, ColorXform cxform) {
20          this();
21          character = id;
22          this.cxform = cxform;
23      }
24  
25      public DefineButtonCxform() {
26          super(23, 2);
27      }
28  
29      public SWFTag read(int tagID, SWFInputStream swf, int len)
30              throws IOException {
31  
32          DefineButtonCxform tag = new DefineButtonCxform();
33          tag.character = swf.readUnsignedShort();
34          swf.getDictionary().put(tag.character, tag);
35          tag.cxform = new ColorXform(swf, false);
36          return tag;
37      }
38  
39      public void write(int tagID, SWFOutputStream swf) throws IOException {
40  
41          swf.writeUnsignedShort(character);
42          cxform.write(swf, false);
43      }
44  
45      public String toString() {
46          return super.toString() + "\n" + "  character: " + character + "\n"
47                  + "  cxform:    " + cxform + "\n";
48      }
49  }