001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.parser;
020:
021: /**
022: * This interface must be implemented and then registred as the
023: * handler of a <code>PathParser</code> instance in order to be
024: * notified of parsing events.
025: *
026: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
027: * @version $Id: PathHandler.java 475685 2006-11-16 11:16:05Z cam $
028: */
029: public interface PathHandler {
030: /**
031: * Invoked when the path starts.
032: * @exception ParseException if an error occured while processing the path
033: */
034: void startPath() throws ParseException;
035:
036: /**
037: * Invoked when the path ends.
038: * @exception ParseException if an error occured while processing the path
039: */
040: void endPath() throws ParseException;
041:
042: /**
043: * Invoked when a relative moveto command has been parsed.
044: * <p>Command : <b>m</b>
045: * @param x the relative x coordinate for the end point
046: * @param y the relative y coordinate for the end point
047: * @exception ParseException if an error occured while processing the path
048: */
049: void movetoRel(float x, float y) throws ParseException;
050:
051: /**
052: * Invoked when an absolute moveto command has been parsed.
053: * <p>Command : <b>M</b>
054: * @param x the absolute x coordinate for the end point
055: * @param y the absolute y coordinate for the end point
056: * @exception ParseException if an error occured while processing the path
057: */
058: void movetoAbs(float x, float y) throws ParseException;
059:
060: /**
061: * Invoked when a closepath has been parsed.
062: * <p>Command : <b>z</b> | <b>Z</b>
063: * @exception ParseException if an error occured while processing the path
064: */
065: void closePath() throws ParseException;
066:
067: /**
068: * Invoked when a relative line command has been parsed.
069: * <p>Command : <b>l</b>
070: * @param x the relative x coordinates for the end point
071: * @param y the relative y coordinates for the end point
072: * @exception ParseException if an error occured while processing the path
073: */
074: void linetoRel(float x, float y) throws ParseException;
075:
076: /**
077: * Invoked when an absolute line command has been parsed.
078: * <p>Command : <b>L</b>
079: * @param x the absolute x coordinate for the end point
080: * @param y the absolute y coordinate for the end point
081: * @exception ParseException if an error occured while processing the path
082: */
083: void linetoAbs(float x, float y) throws ParseException;
084:
085: /**
086: * Invoked when an horizontal relative line command has been parsed.
087: * <p>Command : <b>h</b>
088: * @param x the relative X coordinate of the end point
089: * @exception ParseException if an error occured while processing the path
090: */
091: void linetoHorizontalRel(float x) throws ParseException;
092:
093: /**
094: * Invoked when an horizontal absolute line command has been parsed.
095: * <p>Command : <b>H</b>
096: * @param x the absolute X coordinate of the end point
097: * @exception ParseException if an error occured while processing the path
098: */
099: void linetoHorizontalAbs(float x) throws ParseException;
100:
101: /**
102: * Invoked when a vertical relative line command has been parsed.
103: * <p>Command : <b>v</b>
104: * @param y the relative Y coordinate of the end point
105: * @exception ParseException if an error occured while processing the path
106: */
107: void linetoVerticalRel(float y) throws ParseException;
108:
109: /**
110: * Invoked when a vertical absolute line command has been parsed.
111: * <p>Command : <b>V</b>
112: * @param y the absolute Y coordinate of the end point
113: * @exception ParseException if an error occured while processing the path
114: */
115: void linetoVerticalAbs(float y) throws ParseException;
116:
117: /**
118: * Invoked when a relative cubic bezier curve command has been parsed.
119: * <p>Command : <b>c</b>
120: * @param x1 the relative x coordinate for the first control point
121: * @param y1 the relative y coordinate for the first control point
122: * @param x2 the relative x coordinate for the second control point
123: * @param y2 the relative y coordinate for the second control point
124: * @param x the relative x coordinate for the end point
125: * @param y the relative y coordinate for the end point
126: * @exception ParseException if an error occured while processing the path
127: */
128: void curvetoCubicRel(float x1, float y1, float x2, float y2,
129: float x, float y) throws ParseException;
130:
131: /**
132: * Invoked when an absolute cubic bezier curve command has been parsed.
133: * <p>Command : <b>C</b>
134: * @param x1 the absolute x coordinate for the first control point
135: * @param y1 the absolute y coordinate for the first control point
136: * @param x2 the absolute x coordinate for the second control point
137: * @param y2 the absolute y coordinate for the second control point
138: * @param x the absolute x coordinate for the end point
139: * @param y the absolute y coordinate for the end point
140: * @exception ParseException if an error occured while processing the path
141: */
142: void curvetoCubicAbs(float x1, float y1, float x2, float y2,
143: float x, float y) throws ParseException;
144:
145: /**
146: * Invoked when a relative smooth cubic bezier curve command has
147: * been parsed. The first control point is assumed to be the
148: * reflection of the second control point on the previous command
149: * relative to the current point.
150: * <p>Command : <b>s</b>
151: * @param x2 the relative x coordinate for the second control point
152: * @param y2 the relative y coordinate for the second control point
153: * @param x the relative x coordinate for the end point
154: * @param y the relative y coordinate for the end point
155: * @exception ParseException if an error occured while processing the path
156: */
157: void curvetoCubicSmoothRel(float x2, float y2, float x, float y)
158: throws ParseException;
159:
160: /**
161: * Invoked when an absolute smooth cubic bezier curve command has
162: * been parsed. The first control point is assumed to be the
163: * reflection of the second control point on the previous command
164: * relative to the current point.
165: * <p>Command : <b>S</b>
166: * @param x2 the absolute x coordinate for the second control point
167: * @param y2 the absolute y coordinate for the second control point
168: * @param x the absolute x coordinate for the end point
169: * @param y the absolute y coordinate for the end point
170: * @exception ParseException if an error occured while processing the path
171: */
172: void curvetoCubicSmoothAbs(float x2, float y2, float x, float y)
173: throws ParseException;
174:
175: /**
176: * Invoked when a relative quadratic bezier curve command has been parsed.
177: * <p>Command : <b>q</b>
178: * @param x1 the relative x coordinate for the control point
179: * @param y1 the relative y coordinate for the control point
180: * @param x the relative x coordinate for the end point
181: * @param y the relative x coordinate for the end point
182: * @exception ParseException if an error occured while processing the path
183: */
184: void curvetoQuadraticRel(float x1, float y1, float x, float y)
185: throws ParseException;
186:
187: /**
188: * Invoked when an absolute quadratic bezier curve command has been parsed.
189: * <p>Command : <b>Q</b>
190: * @param x1 the absolute x coordinate for the control point
191: * @param y1 the absolute y coordinate for the control point
192: * @param x the absolute x coordinate for the end point
193: * @param y the absolute x coordinate for the end point
194: * @exception ParseException if an error occured while processing the path
195: */
196: void curvetoQuadraticAbs(float x1, float y1, float x, float y)
197: throws ParseException;
198:
199: /**
200: * Invoked when a relative smooth quadratic bezier curve command
201: * has been parsed. The control point is assumed to be the
202: * reflection of the control point on the previous command
203: * relative to the current point.
204: * <p>Command : <b>t</b>
205: * @param x the relative x coordinate for the end point
206: * @param y the relative y coordinate for the end point
207: * @exception ParseException if an error occured while processing the path
208: */
209: void curvetoQuadraticSmoothRel(float x, float y)
210: throws ParseException;
211:
212: /**
213: * Invoked when an absolute smooth quadratic bezier curve command
214: * has been parsed. The control point is assumed to be the
215: * reflection of the control point on the previous command
216: * relative to the current point.
217: * <p>Command : <b>T</b>
218: * @param x the absolute x coordinate for the end point
219: * @param y the absolute y coordinate for the end point
220: * @exception ParseException if an error occured while processing the path
221: */
222: void curvetoQuadraticSmoothAbs(float x, float y)
223: 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, float xAxisRotation,
239: boolean largeArcFlag, boolean sweepFlag, float x, float y)
240: throws ParseException;
241:
242: /**
243: * Invoked when an absolute elliptical arc command has been parsed.
244: * <p>Command : <b>A</b>
245: * @param rx the X axis radius for the ellipse
246: * @param ry the Y axis radius for the ellipse
247: * @param xAxisRotation the rotation angle in degrees for the ellipse's
248: * X-axis relative to the X-axis
249: * @param largeArcFlag the value of the large-arc-flag
250: * @param sweepFlag the value of the sweep-flag
251: * @param x the absolute x coordinate for the end point
252: * @param y the absolute y coordinate for the end point
253: * @exception ParseException if an error occured while processing the path
254: */
255: void arcAbs(float rx, float ry, float xAxisRotation,
256: boolean largeArcFlag, boolean sweepFlag, float x, float y)
257: throws ParseException;
258: }
|