KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > parser > PathHandler


1 /*
2
3    Copyright 2000 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.parser;
19
20 /**
21  * This interface must be implemented and then registred as the
22  * handler of a <code>PathParser</code> instance in order to be
23  * notified of parsing events.
24  *
25  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
26  * @version $Id: PathHandler.java,v 1.4 2005/03/27 08:58:35 cam Exp $
27  */

28 public interface PathHandler {
29     /**
30      * Invoked when the path starts.
31      * @exception ParseException if an error occured while processing the path
32      */

33     void startPath() throws ParseException;
34
35     /**
36      * Invoked when the path ends.
37      * @exception ParseException if an error occured while processing the path
38      */

39     void endPath() throws ParseException;
40
41     /**
42      * Invoked when a relative moveto command has been parsed.
43      * <p>Command : <b>m</b>
44      * @param x the relative x coordinate for the end point
45      * @param y the relative y coordinate for the end point
46      * @exception ParseException if an error occured while processing the path
47      */

48     void movetoRel(float x, float y) throws ParseException;
49
50     /**
51      * Invoked when an absolute moveto command has been parsed.
52      * <p>Command : <b>M</b>
53      * @param x the absolute x coordinate for the end point
54      * @param y the absolute y coordinate for the end point
55      * @exception ParseException if an error occured while processing the path
56      */

57     void movetoAbs(float x, float y) throws ParseException;
58
59     /**
60      * Invoked when a closepath has been parsed.
61      * <p>Command : <b>z</b> | <b>Z</b>
62      * @exception ParseException if an error occured while processing the path
63      */

64     void closePath() throws ParseException;
65
66     /**
67      * Invoked when a relative line command has been parsed.
68      * <p>Command : <b>l</b>
69      * @param x the relative x coordinates for the end point
70      * @param y the relative y coordinates for the end point
71      * @exception ParseException if an error occured while processing the path
72      */

73     void linetoRel(float x, float y) throws ParseException;
74
75     /**
76      * Invoked when an absolute line command has been parsed.
77      * <p>Command : <b>L</b>
78      * @param x the absolute x coordinate for the end point
79      * @param y the absolute y coordinate for the end point
80      * @exception ParseException if an error occured while processing the path
81      */

82     void linetoAbs(float x, float y) throws ParseException;
83
84     /**
85      * Invoked when an horizontal relative line command has been parsed.
86      * <p>Command : <b>h</b>
87      * @param x the relative X coordinate of the end point
88      * @exception ParseException if an error occured while processing the path
89      */

90     void linetoHorizontalRel(float x) throws ParseException;
91
92     /**
93      * Invoked when an horizontal absolute line command has been parsed.
94      * <p>Command : <b>H</b>
95      * @param x the absolute X coordinate of the end point
96      * @exception ParseException if an error occured while processing the path
97      */

98     void linetoHorizontalAbs(float x) throws ParseException;
99
100     /**
101      * Invoked when a vertical relative line command has been parsed.
102      * <p>Command : <b>v</b>
103      * @param y the relative Y coordinate of the end point
104      * @exception ParseException if an error occured while processing the path
105      */

106     void linetoVerticalRel(float y) throws ParseException;
107
108     /**
109      * Invoked when a vertical absolute line command has been parsed.
110      * <p>Command : <b>V</b>
111      * @param y the absolute Y coordinate of the end point
112      * @exception ParseException if an error occured while processing the path
113      */

114     void linetoVerticalAbs(float y) throws ParseException;
115
116     /**
117      * Invoked when a relative cubic bezier curve command has been parsed.
118      * <p>Command : <b>c</b>
119      * @param x1 the relative x coordinate for the first control point
120      * @param y1 the relative y coordinate for the first control point
121      * @param x2 the relative x coordinate for the second control point
122      * @param y2 the relative y coordinate for the second control point
123      * @param x the relative x coordinate for the end point
124      * @param y the relative y coordinate for the end point
125      * @exception ParseException if an error occured while processing the path
126      */

127     void curvetoCubicRel(float x1, float y1,
128              float x2, float y2,
129              float x, float y) throws ParseException;
130
131
132     /**
133      * Invoked when an absolute cubic bezier curve command has been parsed.
134      * <p>Command : <b>C</b>
135      * @param x1 the absolute x coordinate for the first control point
136      * @param y1 the absolute y coordinate for the first control point
137      * @param x2 the absolute x coordinate for the second control point
138      * @param y2 the absolute y coordinate for the second control point
139      * @param x the absolute x coordinate for the end point
140      * @param y the absolute y coordinate for the end point
141      * @exception ParseException if an error occured while processing the path
142      */

143     void curvetoCubicAbs(float x1, float y1,
144              float x2, float y2,
145              float x, float y) throws ParseException;
146
147     /**
148      * Invoked when a relative smooth cubic bezier curve command has
149      * been parsed. The first control point is assumed to be the
150      * reflection of the second control point on the previous command
151      * relative to the current point.
152      * <p>Command : <b>s</b>
153      * @param x2 the relative x coordinate for the second control point
154      * @param y2 the relative y coordinate for the second control point
155      * @param x the relative x coordinate for the end point
156      * @param y the relative y coordinate for the end point
157      * @exception ParseException if an error occured while processing the path
158      */

159     void curvetoCubicSmoothRel(float x2, float y2,
160                    float x, float y) throws ParseException;
161
162     /**
163      * Invoked when an absolute smooth cubic bezier curve command has
164      * been parsed. The first control point is assumed to be the
165      * reflection of the second control point on the previous command
166      * relative to the current point.
167      * <p>Command : <b>S</b>
168      * @param x2 the absolute x coordinate for the second control point
169      * @param y2 the absolute y coordinate for the second control point
170      * @param x the absolute x coordinate for the end point
171      * @param y the absolute y coordinate for the end point
172      * @exception ParseException if an error occured while processing the path
173      */

174     void curvetoCubicSmoothAbs(float x2, float y2,
175                    float x, float y) throws ParseException;
176
177     /**
178      * Invoked when a relative quadratic bezier curve command has been parsed.
179      * <p>Command : <b>q</b>
180      * @param x1 the relative x coordinate for the control point
181      * @param y1 the relative y coordinate for the control point
182      * @param x the relative x coordinate for the end point
183      * @param y the relative x coordinate for the end point
184      * @exception ParseException if an error occured while processing the path
185      */

186     void curvetoQuadraticRel(float x1, float y1,
187                  float x, float y) throws ParseException;
188
189     /**
190      * Invoked when an absolute quadratic bezier curve command has been parsed.
191      * <p>Command : <b>Q</b>
192      * @param x1 the absolute x coordinate for the control point
193      * @param y1 the absolute y coordinate for the control point
194      * @param x the absolute x coordinate for the end point
195      * @param y the absolute x coordinate for the end point
196      * @exception ParseException if an error occured while processing the path
197      */

198     void curvetoQuadraticAbs(float x1, float y1,
199                  float x, float y) throws ParseException;
200
201     /**
202      * Invoked when a relative smooth quadratic bezier curve command
203      * has been parsed. The control point is assumed to be the
204      * reflection of the control point on the previous command
205      * relative to the current point.
206      * <p>Command : <b>t</b>
207      * @param x the relative x coordinate for the end point
208      * @param y the relative y coordinate for the end point
209      * @exception ParseException if an error occured while processing the path
210      */

211     void curvetoQuadraticSmoothRel(float x, float y) throws ParseException;
212
213     /**
214      * Invoked when an absolute smooth quadratic bezier curve command
215      * has been parsed. The control point is assumed to be the
216      * reflection of the control point on the previous command
217      * relative to the current point.
218      * <p>Command : <b>T</b>
219      * @param x the absolute x coordinate for the end point
220      * @param y the absolute y coordinate for the end point
221      * @exception ParseException if an error occured while processing the path
222      */

223     void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException;
224
225     /**
226      * Invoked when a relative elliptical arc command has been parsed.
227      * <p>Command : <b>a</b>
228      * @param rx the X axis radius for the ellipse
229      * @param ry the Y axis radius for the ellipse
230      * @param xAxisRotation the rotation angle in degrees for the ellipse's
231      * X-axis relative to the X-axis
232      * @param largeArcFlag the value of the large-arc-flag
233      * @param sweepFlag the value of the sweep-flag
234      * @param x the relative x coordinate for the end point
235      * @param y the relative y coordinate for the end point
236      * @exception ParseException if an error occured while processing the path
237      */

238     void arcRel(float rx, float ry,
239         float xAxisRotation,
240         boolean largeArcFlag, boolean sweepFlag,
241         float x, float y) throws ParseException;
242
243
244     /**
245      * Invoked when an absolute elliptical arc command has been parsed.
246      * <p>Command : <b>A</b>
247      * @param rx the X axis radius for the ellipse
248      * @param ry the Y axis radius for the ellipse
249      * @param xAxisRotation the rotation angle in degrees for the ellipse's
250      * X-axis relative to the X-axis
251      * @param largeArcFlag the value of the large-arc-flag
252      * @param sweepFlag the value of the sweep-flag
253      * @param x the absolute x coordinate for the end point
254      * @param y the absolute y coordinate for the end point
255      * @exception ParseException if an error occured while processing the path
256      */

257     void arcAbs(float rx, float ry,
258         float xAxisRotation,
259         boolean largeArcFlag, boolean sweepFlag,
260         float x, float y) throws ParseException;
261 }
262
Popular Tags