View Javadoc

1   // Copyright 2001-2004 freehep
2   package org.freehep.graphicsio;
3   
4   import java.awt.Shape;
5   import java.awt.geom.AffineTransform;
6   import java.io.IOException;
7   
8   /**
9    * Interface for objects that are capable of constructing paths. Path painting
10   * (stroking or filling) is not included.
11   * 
12   * @author Simon Fischer
13   * @version $Id: PathConstructor.java 8584 2006-08-10 23:06:37Z duns $
14   */
15  public interface PathConstructor {
16  
17      /**
18       * Makes (x,y) the current point.
19       */
20      public void move(double x, double y) throws IOException;
21  
22      /**
23       * Draws a line from the current point to (x,y) and make (x,y) the current
24       * point.
25       */
26      public void line(double x, double y) throws IOException;
27  
28      /**
29       * Draws a quadratic bezier curve from the current point to (x2, y2) using
30       * the control point (x1, y1) and make (x2, y2) the current point.
31       */
32      public void quad(double x1, double y1, double x2, double y2)
33              throws IOException;
34  
35      /**
36       * Draws a cubic bezier curve from the current point to (x3, y3) using the
37       * control points (x1, y1) and (x2, y2) and make (x3, y3) the current point.
38       */
39      public void cubic(double x1, double y1, double x2, double y2, double x3,
40              double y3) throws IOException;
41  
42      /**
43       * Closes the path by drawing a straight line to the last point which was
44       * argument to move.
45       */
46      public void closePath(double x0, double y0) throws IOException;
47  
48      /**
49       * Flushes any cached info to the output file. The path is complete at this
50       * point.
51       */
52      public void flush() throws IOException;
53  
54      /**
55       * Adds the <i>points</i> of the shape using path <i>construction</i>
56       * operators. The path is neither stroked nor filled.
57       * 
58       * @return true if even-odd winding rule should be used, false if non-zero
59       *         winding rule should be used.
60       */
61      public boolean addPath(Shape s) throws IOException;
62  
63      /**
64       * Adds the <i>points</i> of the shape using path <i>construction</i>
65       * operators, using the given transform. The path is neither stroked nor
66       * filled.
67       * 
68       * @return true if even-odd winding rule should be used, false if non-zero
69       *         winding rule should be used.
70       */
71      public boolean addPath(Shape s, AffineTransform transform)
72              throws IOException;
73  }