Debian Codegraph @

freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/SetArcDirection.java

raw
1 // Copyright 2002, FreeHEP.
2 package org.freehep.graphicsio.emf.gdi;
3
4 import java.io.IOException;
5
6 import org.freehep.graphicsio.emf.EMFConstants;
7 import org.freehep.graphicsio.emf.EMFInputStream;
8 import org.freehep.graphicsio.emf.EMFOutputStream;
9 import org.freehep.graphicsio.emf.EMFTag;
10 import org.freehep.graphicsio.emf.EMFRenderer;
11
12 /**
13 * SetArcDirection TAG.
14 *
15 * @author Mark Donszelmann
16 * @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/SetArcDirection.java cb17a8f71934 2007/01/23 15:44:34 duns $
17 */
18 public class SetArcDirection extends EMFTag implements EMFConstants {
19
20 private int direction;
21
22 public SetArcDirection() {
23 super(57, 1);
24 }
25
26 public SetArcDirection(int direction) {
27 this();
28 this.direction = direction;
29 }
30
31 public EMFTag read(int tagID, EMFInputStream emf, int len)
32 throws IOException {
33
34 return new SetArcDirection(emf.readDWORD());
35 }
36
37 public void write(int tagID, EMFOutputStream emf) throws IOException {
38 emf.writeDWORD(direction);
39 }
40
41 public String toString() {
42 return super.toString() + "\n direction: " + direction;
43 }
44
45 /**
46 * displays the tag using the renderer
47 *
48 * @param renderer EMFRenderer storing the drawing session data
49 */
50 public void render(EMFRenderer renderer) {
51 // The SetArcDirection sets the drawing direction to
52 // be used for arc and rectangle functions.
53 renderer.setArcDirection(direction);
54 }
55 }