PageRenderTime 54ms CodeModel.GetById 22ms app.highlight 27ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/mt4j/util/xml/svg/CustomPathHandler.java

http://mt4j.googlecode.com/
Java | 590 lines | 325 code | 112 blank | 153 comment | 53 complexity | d5108efc7b839612f89ec1fd5d07952d MD5 | raw file
  1/***********************************************************************
  2 * mt4j Copyright (c) 2008 - 2009 C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
  3 *  
  4 *   This program is free software: you can redistribute it and/or modify
  5 *   it under the terms of the GNU General Public License as published by
  6 *   the Free Software Foundation, either version 3 of the License, or
  7 *   (at your option) any later version.
  8 *
  9 *   This program is distributed in the hope that it will be useful,
 10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *   GNU General Public License for more details.
 13 *
 14 *   You should have received a copy of the GNU General Public License
 15 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 16 *
 17 ***********************************************************************/
 18package org.mt4j.util.xml.svg;
 19
 20import java.util.ArrayList;
 21import java.util.HashMap;
 22import java.util.LinkedList;
 23import java.util.List;
 24import java.util.Stack;
 25
 26import org.apache.batik.parser.ParseException;
 27import org.apache.batik.parser.PathHandler;
 28import org.mt4j.util.math.BezierVertex;
 29import org.mt4j.util.math.ToolsGeometry;
 30import org.mt4j.util.math.Vertex;
 31
 32
 33/**
 34 * The Class CustomPathHandler.
 35 */
 36public class CustomPathHandler implements PathHandler {
 37	
 38	/** The verbose. */
 39	private boolean verbose;
 40	
 41	/** The cubic bez vert to quadric control point. */
 42	private HashMap<BezierVertex, Vertex> cubicBezVertTOQuadricControlPoint;
 43	
 44	/** The reverse move to stack. */
 45	private Stack<Vertex> reverseMoveToStack;
 46	
 47	/** The sub paths. */
 48	private ArrayList<Vertex[]> subPaths; 
 49	
 50	/** The current sub path. */
 51	private ArrayList<Vertex> currentSubPath;
 52	
 53	/** The path points. */
 54	private LinkedList<Vertex> pathPoints;
 55	
 56	/**
 57	 * Instantiates a new custom path handler.
 58	 */
 59	public CustomPathHandler(){
 60		pathPoints = new LinkedList<Vertex>();
 61	    currentSubPath = new ArrayList<Vertex>();
 62	     	
 63	    subPaths = new ArrayList<Vertex[]>();
 64	     	
 65	    reverseMoveToStack = new Stack<Vertex>();	
 66	     	
 67	    verbose = false;
 68	    
 69		//Because all quadric curves get converted to cubics,
 70		//but the original quadric controlpoint is needed for "T" tag for reflecting
 71		cubicBezVertTOQuadricControlPoint 	= new HashMap<BezierVertex, Vertex>();
 72	}
 73	
 74	 
 75
 76	/* (non-Javadoc)
 77	 * @see org.apache.batik.parser.PathHandler#startPath()
 78	 */
 79	public void startPath() throws ParseException {
 80		if (verbose)
 81			System.out.println("Start Path");
 82	}
 83
 84	
 85	/* (non-Javadoc)
 86	 * @see org.apache.batik.parser.PathHandler#movetoAbs(float, float)
 87	 */
 88	public void movetoAbs(float x, float y) throws ParseException {
 89		if (verbose)
 90			System.out.println("movetoAbs: x:" + x + " y:" + y);
 91		
 92		//If the last contour wasnt closed with Z, 
 93		//we save the last contour here,but without closing it
 94		if (!currentSubPath.isEmpty()){
 95			Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
 96			subPaths.add(currentSplitPathArr);
 97			currentSubPath.clear();
 98		}
 99
100		Vertex moveTo = new Vertex(x,y,0);
101		pathPoints.add(moveTo);
102		currentSubPath.add(moveTo);
103		reverseMoveToStack.push((Vertex)moveTo.getCopy());
104	}
105	
106	/* (non-Javadoc)
107	 * @see org.apache.batik.parser.PathHandler#movetoRel(float, float)
108	 */
109	public void movetoRel(float x, float y) throws ParseException {
110		if (verbose)
111			System.out.println("movetoRel: " + x + "," + y);
112		
113		//If the last contour wasnt closed with Z, 
114		//we save the last contour here, without closing it
115		if (!currentSubPath.isEmpty()){
116			Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
117			subPaths.add(currentSplitPathArr);
118			currentSubPath.clear();
119		}
120		
121		Vertex moveTo;
122		if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
123			moveTo = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
124		}else{
125			moveTo = new Vertex(x, y, 0);
126		}
127		pathPoints.add(moveTo);
128		currentSubPath.add(moveTo);
129		reverseMoveToStack.push((Vertex)moveTo.getCopy());
130	}
131	
132
133	/* (non-Javadoc)
134	 * @see org.apache.batik.parser.PathHandler#arcAbs(float, float, float, boolean, boolean, float, float)
135	 */
136	public void arcAbs(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
137		if (verbose)
138			System.out.println("arcAbs: " + rx + " " + ry + " " + phi + " " + large_arc + " "  + sweep + " " + x + " " + y);
139		
140		Vertex lastPoint = pathPoints.getLast();
141		List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, x, y, 40);
142		
143		//Prevent odd picking behavour, in which the normal is 
144		//not correctly computed, because the 2 points are the same
145		if (!arcVertices.isEmpty() 
146			&& lastPoint != null 
147			&& arcVertices.get(0).equalsVector(lastPoint)
148		){
149			arcVertices.remove(0);
150		}
151		pathPoints.addAll(arcVertices);
152		currentSubPath.addAll(arcVertices);
153	}
154
155	/* (non-Javadoc)
156	 * @see org.apache.batik.parser.PathHandler#arcRel(float, float, float, boolean, boolean, float, float)
157	 */
158	public void arcRel(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
159		if (verbose)
160			System.out.println("arcRel: " + rx + " " + ry + " " + phi + " " + large_arc + " "  + sweep + " " + x + " " + y);
161		
162		Vertex lastPoint = pathPoints.getLast();
163		List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, lastPoint.x+x, lastPoint.y+y, 40);
164		
165		//Prevent odd picking behavour, in which the normal is 
166		//not correctly computed, because the 2 points are the same
167		if (!arcVertices.isEmpty() 
168				&& lastPoint != null 
169				&& arcVertices.get(0).equalsVector(lastPoint)
170			){
171				arcVertices.remove(0);
172			}
173		pathPoints.addAll(arcVertices);
174		currentSubPath.addAll(arcVertices);
175	}
176
177	
178	/* (non-Javadoc)
179	 * @see org.apache.batik.parser.PathHandler#linetoAbs(float, float)
180	 */
181	public void linetoAbs(float x, float y) throws ParseException {
182		if (verbose)
183			System.out.println("linetoAbs x:" + x + " y:" + y);
184
185		Vertex vert = new Vertex(x,y,0);
186		pathPoints.add(vert);
187		currentSubPath.add(vert);
188	}
189	
190	/* (non-Javadoc)
191	 * @see org.apache.batik.parser.PathHandler#linetoRel(float, float)
192	 */
193	public void linetoRel(float x, float y) throws ParseException {
194		if (verbose)
195			System.out.println("linetoRel: " + x + "," + y);
196		
197		Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
198		pathPoints.add(vert);
199		currentSubPath.add(vert);
200	}
201	
202
203	/* (non-Javadoc)
204	 * @see org.apache.batik.parser.PathHandler#linetoHorizontalAbs(float)
205	 */
206	public void linetoHorizontalAbs(float x) throws ParseException {
207		if (verbose)
208			System.out.println("linetoHorizontalAbs x:" + x);
209
210		Vertex vert = new Vertex(x, pathPoints.getLast().getY(), 0);
211		pathPoints.add(vert);
212		currentSubPath.add(vert);
213	}
214	
215	/* (non-Javadoc)
216	 * @see org.apache.batik.parser.PathHandler#linetoHorizontalRel(float)
217	 */
218	public void linetoHorizontalRel(float x) throws ParseException {
219		if (verbose)
220			System.out.println("linetoHorizontalRel: " + x);
221
222		Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY(), 0);
223		pathPoints.add(vert);
224		currentSubPath.add(vert);
225	}
226
227	
228	/* (non-Javadoc)
229	 * @see org.apache.batik.parser.PathHandler#linetoVerticalAbs(float)
230	 */
231	public void linetoVerticalAbs(float y) throws ParseException {
232		if (verbose)
233			System.out.println("linetoVerticalAbs y:" + y);
234		
235		Vertex vert = new Vertex(pathPoints.getLast().getX(), y, 0);
236		pathPoints.add(vert);
237		currentSubPath.add(vert);
238	}
239
240	/* (non-Javadoc)
241	 * @see org.apache.batik.parser.PathHandler#linetoVerticalRel(float)
242	 */
243	public void linetoVerticalRel(float y) throws ParseException {
244		if (verbose)
245			System.out.println("linetoVerticalRel: " + y);
246		
247		Vertex vert = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY() + y, 0);
248		pathPoints.add(vert);
249		currentSubPath.add(vert);
250	}
251	
252	
253	/* (non-Javadoc)
254	 * @see org.apache.batik.parser.PathHandler#curvetoQuadraticAbs(float, float, float, float)
255	 */
256	public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException {
257		if (verbose)
258			System.out.println("curvetoQuadraticAbs x1:" + x1 + " y1:" + y1 + " x:" + x+ " y:" + y);
259
260		if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
261			Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
262			Vertex quadControlPoint = new Vertex(x1,y1,0);
263			//Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo 
264			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, quadControlPoint , new Vertex(x, y, 0)); 
265
266			cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
267
268			pathPoints.add(b5);
269			currentSubPath.add(b5);
270		}else{
271			System.err.println("last point = null at curvetoQuadraticAbs");
272		}
273	}
274
275	/* (non-Javadoc)
276	 * @see org.apache.batik.parser.PathHandler#curvetoQuadraticRel(float, float, float, float)
277	 */
278	public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException {
279		if (verbose)
280			System.out.println("curvetoQuadraticRel: " + x1 + "," + y1 + "  " + x + "," + y);
281
282		if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
283			Vertex lastPoint = pathPoints.getLast();
284			
285			Vertex lastEndPoint = new Vertex(lastPoint.getX(), lastPoint.getY(), lastPoint.getZ());
286			Vertex quadControlPoint = new Vertex(lastPoint.getX() + x1, lastPoint.getY()+ y1, 0);
287			
288			//Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo 
289			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
290					lastEndPoint,
291					quadControlPoint , 
292					new Vertex(lastPoint.getX() + x, lastPoint.getY()+ y, 0)); 
293
294			cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
295			pathPoints.add(b5);
296			currentSubPath.add(b5);
297		}else{
298			System.out.println("last point null at curvetoQuadraticRel");
299		}
300	}
301
302	/* (non-Javadoc)
303	 * @see org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothAbs(float, float)
304	 */
305	public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException {
306		if (verbose)
307			System.out.println("curvetoQuadraticSmoothAbs " + " x:" + x+ " y:" + y);
308
309		Vertex lastPoint = pathPoints.getLast();
310		if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
311			Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
312
313			//Get control point of last QuadTo
314			Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
315			cubicBezVertTOQuadricControlPoint.remove(lastPoint);
316
317			//Rotate that controlpoint around the end point of the last QuadTo
318			lastQuadControlPoint.rotateZ(lastEndPoint, 180); 
319
320			//Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo 
321			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, lastQuadControlPoint , new Vertex(x, y, 0)); 
322
323			//Save last quad control point
324			cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
325			
326			pathPoints.add(b5);
327			currentSubPath.add(b5);
328		}else{
329			if (verbose)
330				System.out.println("Couldnt get last controlpoint at: curvetoQuadraticSmoothAbs - using last point as controlpoint");
331			
332			//If we couldnt retrieve the controlpoint of the current point, 
333			//we use the current point as the new controlpoint
334			Vertex lastEndPoint 	= new Vertex(lastPoint.getX(),lastPoint.getY(),0);
335			Vertex quadControlPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
336			
337			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
338					lastEndPoint, 
339					quadControlPoint , 
340					new Vertex(x, y, 0)); 
341			
342			cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
343			pathPoints.add(b5);
344			currentSubPath.add(b5);
345		}
346	}
347
348	/* (non-Javadoc)
349	 * @see org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothRel(float, float)
350	 */
351	public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException {
352		if (verbose)
353			System.out.println("curvetoQuadraticSmoothRel: " + x + "," + y);
354		
355		Vertex lastPoint = pathPoints.getLast();
356		if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
357			Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
358
359			//Get control point of last QuadTo
360			Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
361			cubicBezVertTOQuadricControlPoint.remove(lastPoint);
362
363			//Rotate that controlpoint around the end point of the last QuadTo
364			lastQuadControlPoint.rotateZ(lastEndPoint, 180); 
365
366			//Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo 
367			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
368					lastEndPoint, 
369					lastQuadControlPoint , 
370					new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0)); 
371
372			//Save last quad control point
373			cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
374			pathPoints.add(b5);
375			currentSubPath.add(b5);
376		}else{
377			if (verbose)
378				System.out.println("couldnt get last control point at curvetoQuadraticSmoothRel - using last point as the control point");
379			
380			Vertex lastEndPoint 	= new Vertex(lastPoint.getX(),lastPoint.getY(),0);
381			Vertex quadControlPoint =  new Vertex(lastPoint.getX(),lastPoint.getY(),0);
382			
383			BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
384					lastEndPoint, 
385					quadControlPoint , 
386					new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0)); 
387			
388			cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
389			pathPoints.add(b5);
390			currentSubPath.add(b5);
391		}
392		
393	}
394	
395	
396	/* (non-Javadoc)
397	 * @see org.apache.batik.parser.PathHandler#curvetoCubicAbs(float, float, float, float, float, float)
398	 */
399	public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
400		if (verbose)
401			System.out.println("curvetoCubicAbs x1:" + x1 + " y1:" + y1 + " x2:" + x2 + " y2:" + y2 +  " x:" + x+ " y:" + y);
402
403		BezierVertex b = new BezierVertex(x1,y1,0, x2,y2,0, x,y,0);
404		pathPoints.add(b);
405		currentSubPath.add(b);
406	}
407
408	/* (non-Javadoc)
409	 * @see org.apache.batik.parser.PathHandler#curvetoCubicRel(float, float, float, float, float, float)
410	 */
411	public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
412		if (verbose)
413			System.out.println("curvetoCubicSmoothRel: " + x1 + "," + y1 + "  " + x2 + "," + y2 + "  "  + x + "," + y);
414
415		Vertex lastPoint = pathPoints.getLast();
416		BezierVertex b = new BezierVertex(
417				lastPoint.getX()+ x1, lastPoint.getY() + y1,0, 
418				lastPoint.getX()+ x2, lastPoint.getY() + y2,0, 
419				lastPoint.getX()+ x, lastPoint.getY() + y,0);
420		pathPoints.add(b);
421		currentSubPath.add(b);
422	}
423	
424	
425	/* (non-Javadoc)
426	 * @see org.apache.batik.parser.PathHandler#curvetoCubicSmoothAbs(float, float, float, float)
427	 */
428	public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException {
429		if (verbose)
430			System.out.println("curvetoCubicSmoothAbs x2:" + x2 + " y2:" + y2 + " x:" + x+ " y:" + y);
431
432		Vertex lastPoint = pathPoints.getLast();
433		if (lastPoint instanceof BezierVertex){
434			BezierVertex lastBez = (BezierVertex)lastPoint;
435
436			Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
437			//reflect the last controlpoint at the current point
438			lastConPointCopy.rotateZ(lastPoint, 180);
439			BezierVertex b = new BezierVertex(lastConPointCopy.getX(),lastConPointCopy.getY(),0, x2,y2,0, x,y,0);
440
441			pathPoints.add(b);
442			currentSubPath.add(b);
443		}else{
444			if (verbose)
445				System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothAbs - using last point as first controlpoint");
446			
447			Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
448			BezierVertex b = new BezierVertex(
449					lastEndPoint.getX(),lastEndPoint.getY(),0, 
450					x2,y2,0,
451					x,y,0);
452			
453			pathPoints.add(b);
454			currentSubPath.add(b);
455		}
456	}
457
458	/* (non-Javadoc)
459	 * @see org.apache.batik.parser.PathHandler#curvetoCubicSmoothRel(float, float, float, float)
460	 */
461	public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException {
462		if (verbose)
463			System.out.println("curvetoCubicSmoothRel: " + x2 + "," + y2 + "  " + x + "," + y);
464		
465		Vertex lastPoint = pathPoints.getLast();
466		if (lastPoint instanceof BezierVertex){
467			BezierVertex lastBez = (BezierVertex)lastPoint;
468
469			Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
470			//reflect the last controlpoint at the current point
471			lastConPointCopy.rotateZ(lastPoint, 180);
472			
473			BezierVertex b = new BezierVertex(
474					lastConPointCopy.getX()	,	lastConPointCopy.getY(),	0, 
475					lastPoint.getX() + x2,  	lastPoint.getY() + y2,		0, 
476					lastPoint.getX() + x,   	lastPoint.getY() + y,			0);
477
478			pathPoints.add(b);
479			currentSubPath.add(b);
480		}else{
481			if (verbose)
482				System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothRel - using last point as first controlpoint");
483			
484			Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
485			BezierVertex b 		= new BezierVertex(
486					lastEndPoint.getX(),lastEndPoint.getY(),0, 
487					lastEndPoint.getX()+ x2, lastEndPoint.getY()+ y2, 0,
488					lastEndPoint.getX()+ x, lastEndPoint.getY()+ y, 0);
489			
490			pathPoints.add(b);
491			currentSubPath.add(b);
492		}
493	}
494
495	
496	/**
497	 * if "Z" is encountered.
498	 * 
499	 * @throws ParseException the parse exception
500	 */
501	public void closePath() throws ParseException {
502		if (verbose)
503			System.out.println("close Path");
504		
505		//Close the current contour with the previous MoveTo Vertex
506		Vertex lastPointCopy = (Vertex)currentSubPath.get(0).getCopy();
507		currentSubPath.add(lastPointCopy);
508		pathPoints.add(lastPointCopy);
509		
510		//Save the current contour and clear the current for the next contour
511		Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
512		subPaths.add(currentSplitPathArr);
513		currentSubPath.clear();
514	}
515
516	/* (non-Javadoc)
517	 * @see org.apache.batik.parser.PathHandler#endPath()
518	 */
519	public void endPath() throws ParseException {
520		if (verbose)
521			System.out.println("End Path");
522
523		//IF no Z command occured, were normally the last contour gets added, 
524		//we have save the current contour here, but we dont close it
525		if (!currentSubPath.isEmpty()){
526			//Convert partial path list to array
527			Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
528
529			//Add partial path array to list of all partial paths of this glyph
530			subPaths.add(currentSplitPathArr);
531			currentSubPath.clear();
532		}
533	}
534
535
536	/**
537	 * Gets the path points.
538	 * 
539	 * @return the path points
540	 */
541	public LinkedList<Vertex> getPathPoints() {
542		return pathPoints;
543	}
544	
545	/**
546	 * Gets the path points array.
547	 * 
548	 * @return the path points array
549	 */
550	public Vertex[] getPathPointsArray() {
551		return pathPoints.toArray(new Vertex[pathPoints.size()]);
552	}
553
554	/**
555	 * @deprecated Only used when the intention is to draw the shapes using the stencil buffer..
556	 * 
557	 * @return the reverse move to vertices
558	 */
559	public Vertex[] getReverseMoveToVertices() {
560		return reverseMoveToStack.toArray(new Vertex[reverseMoveToStack.size()]);
561	}
562
563	/**
564	 * @deprecated Only used when the intention is to draw the shapes using the stencil buffer..
565	 * @return the reverse move to stack
566	 */
567	public Stack<Vertex> getReverseMoveToStack() {
568		return reverseMoveToStack;
569	}
570
571	/**
572	 * Returns all the encountered "sub-paths" of the parsed path-element.
573	 * 
574	 * @return the contours
575	 */
576	public ArrayList<Vertex[]> getContours() {
577		return subPaths;
578	}
579
580	/**
581	 * Sets the verbose.
582	 * 
583	 * @param verbose the new verbose
584	 */
585	public void setVerbose(boolean verbose) {
586		this.verbose = verbose;
587	}
588	
589
590}