Debian Codegraph @

freehep-graphicsio-swf/src/main/java/org/freehep/graphicsio/swf/PlaceObject.java

raw symbols SCIP
1 // Copyright 2001, FreeHEP.
2 package org.freehep.graphicsio.swf;
3
4 import java.awt.geom.AffineTransform;
5 import java.io.EOFException;
6 import java.io.IOException;
7
8 /**
9 * PlaceObject TAG.
10 *
11 * @author Mark Donszelmann
12 * @author Charles Loomis
13 * @version $Id: freehep-graphicsio-swf/src/main/java/org/freehep/graphicsio/swf/PlaceObject.java db861da05344 2005/12/05 00:59:43 duns $
14 */
15 public class PlaceObject extends ControlTag {
16
17 private int character;
18
19 private int depth;
20
21 private AffineTransform matrix;
22
23 private ColorXform cxform = null;
24
25 public PlaceObject(int id, int depth, AffineTransform matrix) {
26 this(id, depth, matrix, null);
27 }
28
29 public PlaceObject(int id, int depth, AffineTransform matrix,
30 ColorXform cxform) {
31 this();
32 character = id;
33 this.depth = depth;
34 this.matrix = matrix;
35 this.cxform = cxform;
36 }
37
38 public PlaceObject() {
39 super(4, 1);
40 }
41
42 public SWFTag read(int tagID, SWFInputStream swf, int len)
43 throws IOException {
44
45 PlaceObject tag = new PlaceObject();
46 tag.character = swf.readUnsignedShort();
47 tag.depth = swf.readUnsignedShort();
48 tag.matrix = swf.readMatrix();
49
50 try {
51 tag.cxform = new ColorXform(swf, false);
52 } catch (EOFException e) {
53 }
54
55 return tag;
56 }
57
58 public void write(int tagID, SWFOutputStream swf) throws IOException {
59 swf.writeUnsignedShort(character);
60 swf.writeUnsignedShort(depth);
61 swf.writeMatrix(matrix);
62 if (cxform != null) {
63 cxform.write(swf, false);
64 }
65 }
66
67 public String toString() {
68 return super.toString() + "\n" + " depth: " + depth + "\n"
69 + " character: " + character + "\n" + " matrix: " + matrix
70 + "\n" + " xform: " + cxform;
71 }
72 }