/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. ***********************************************************************/
  18. package org.mt4j.util.xml.svg;
  19. import java.util.ArrayList;
  20. import java.util.HashMap;
  21. import java.util.LinkedList;
  22. import java.util.List;
  23. import java.util.Stack;
  24. import org.apache.batik.parser.ParseException;
  25. import org.apache.batik.parser.PathHandler;
  26. import org.mt4j.util.math.BezierVertex;
  27. import org.mt4j.util.math.ToolsGeometry;
  28. import org.mt4j.util.math.Vertex;
  29. /**
  30. * The Class CustomPathHandler.
  31. */
  32. public class CustomPathHandler implements PathHandler {
  33. /** The verbose. */
  34. private boolean verbose;
  35. /** The cubic bez vert to quadric control point. */
  36. private HashMap<BezierVertex, Vertex> cubicBezVertTOQuadricControlPoint;
  37. /** The reverse move to stack. */
  38. private Stack<Vertex> reverseMoveToStack;
  39. /** The sub paths. */
  40. private ArrayList<Vertex[]> subPaths;
  41. /** The current sub path. */
  42. private ArrayList<Vertex> currentSubPath;
  43. /** The path points. */
  44. private LinkedList<Vertex> pathPoints;
  45. /**
  46. * Instantiates a new custom path handler.
  47. */
  48. public CustomPathHandler(){
  49. pathPoints = new LinkedList<Vertex>();
  50. currentSubPath = new ArrayList<Vertex>();
  51. subPaths = new ArrayList<Vertex[]>();
  52. reverseMoveToStack = new Stack<Vertex>();
  53. verbose = false;
  54. //Because all quadric curves get converted to cubics,
  55. //but the original quadric controlpoint is needed for "T" tag for reflecting
  56. cubicBezVertTOQuadricControlPoint = new HashMap<BezierVertex, Vertex>();
  57. }
  58. /* (non-Javadoc)
  59. * @see org.apache.batik.parser.PathHandler#startPath()
  60. */
  61. public void startPath() throws ParseException {
  62. if (verbose)
  63. System.out.println("Start Path");
  64. }
  65. /* (non-Javadoc)
  66. * @see org.apache.batik.parser.PathHandler#movetoAbs(float, float)
  67. */
  68. public void movetoAbs(float x, float y) throws ParseException {
  69. if (verbose)
  70. System.out.println("movetoAbs: x:" + x + " y:" + y);
  71. //If the last contour wasnt closed with Z,
  72. //we save the last contour here,but without closing it
  73. if (!currentSubPath.isEmpty()){
  74. Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
  75. subPaths.add(currentSplitPathArr);
  76. currentSubPath.clear();
  77. }
  78. Vertex moveTo = new Vertex(x,y,0);
  79. pathPoints.add(moveTo);
  80. currentSubPath.add(moveTo);
  81. reverseMoveToStack.push((Vertex)moveTo.getCopy());
  82. }
  83. /* (non-Javadoc)
  84. * @see org.apache.batik.parser.PathHandler#movetoRel(float, float)
  85. */
  86. public void movetoRel(float x, float y) throws ParseException {
  87. if (verbose)
  88. System.out.println("movetoRel: " + x + "," + y);
  89. //If the last contour wasnt closed with Z,
  90. //we save the last contour here, without closing it
  91. if (!currentSubPath.isEmpty()){
  92. Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
  93. subPaths.add(currentSplitPathArr);
  94. currentSubPath.clear();
  95. }
  96. Vertex moveTo;
  97. if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
  98. moveTo = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
  99. }else{
  100. moveTo = new Vertex(x, y, 0);
  101. }
  102. pathPoints.add(moveTo);
  103. currentSubPath.add(moveTo);
  104. reverseMoveToStack.push((Vertex)moveTo.getCopy());
  105. }
  106. /* (non-Javadoc)
  107. * @see org.apache.batik.parser.PathHandler#arcAbs(float, float, float, boolean, boolean, float, float)
  108. */
  109. public void arcAbs(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
  110. if (verbose)
  111. System.out.println("arcAbs: " + rx + " " + ry + " " + phi + " " + large_arc + " " + sweep + " " + x + " " + y);
  112. Vertex lastPoint = pathPoints.getLast();
  113. List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, x, y, 40);
  114. //Prevent odd picking behavour, in which the normal is
  115. //not correctly computed, because the 2 points are the same
  116. if (!arcVertices.isEmpty()
  117. && lastPoint != null
  118. && arcVertices.get(0).equalsVector(lastPoint)
  119. ){
  120. arcVertices.remove(0);
  121. }
  122. pathPoints.addAll(arcVertices);
  123. currentSubPath.addAll(arcVertices);
  124. }
  125. /* (non-Javadoc)
  126. * @see org.apache.batik.parser.PathHandler#arcRel(float, float, float, boolean, boolean, float, float)
  127. */
  128. public void arcRel(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
  129. if (verbose)
  130. System.out.println("arcRel: " + rx + " " + ry + " " + phi + " " + large_arc + " " + sweep + " " + x + " " + y);
  131. Vertex lastPoint = pathPoints.getLast();
  132. List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, lastPoint.x+x, lastPoint.y+y, 40);
  133. //Prevent odd picking behavour, in which the normal is
  134. //not correctly computed, because the 2 points are the same
  135. if (!arcVertices.isEmpty()
  136. && lastPoint != null
  137. && arcVertices.get(0).equalsVector(lastPoint)
  138. ){
  139. arcVertices.remove(0);
  140. }
  141. pathPoints.addAll(arcVertices);
  142. currentSubPath.addAll(arcVertices);
  143. }
  144. /* (non-Javadoc)
  145. * @see org.apache.batik.parser.PathHandler#linetoAbs(float, float)
  146. */
  147. public void linetoAbs(float x, float y) throws ParseException {
  148. if (verbose)
  149. System.out.println("linetoAbs x:" + x + " y:" + y);
  150. Vertex vert = new Vertex(x,y,0);
  151. pathPoints.add(vert);
  152. currentSubPath.add(vert);
  153. }
  154. /* (non-Javadoc)
  155. * @see org.apache.batik.parser.PathHandler#linetoRel(float, float)
  156. */
  157. public void linetoRel(float x, float y) throws ParseException {
  158. if (verbose)
  159. System.out.println("linetoRel: " + x + "," + y);
  160. Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
  161. pathPoints.add(vert);
  162. currentSubPath.add(vert);
  163. }
  164. /* (non-Javadoc)
  165. * @see org.apache.batik.parser.PathHandler#linetoHorizontalAbs(float)
  166. */
  167. public void linetoHorizontalAbs(float x) throws ParseException {
  168. if (verbose)
  169. System.out.println("linetoHorizontalAbs x:" + x);
  170. Vertex vert = new Vertex(x, pathPoints.getLast().getY(), 0);
  171. pathPoints.add(vert);
  172. currentSubPath.add(vert);
  173. }
  174. /* (non-Javadoc)
  175. * @see org.apache.batik.parser.PathHandler#linetoHorizontalRel(float)
  176. */
  177. public void linetoHorizontalRel(float x) throws ParseException {
  178. if (verbose)
  179. System.out.println("linetoHorizontalRel: " + x);
  180. Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY(), 0);
  181. pathPoints.add(vert);
  182. currentSubPath.add(vert);
  183. }
  184. /* (non-Javadoc)
  185. * @see org.apache.batik.parser.PathHandler#linetoVerticalAbs(float)
  186. */
  187. public void linetoVerticalAbs(float y) throws ParseException {
  188. if (verbose)
  189. System.out.println("linetoVerticalAbs y:" + y);
  190. Vertex vert = new Vertex(pathPoints.getLast().getX(), y, 0);
  191. pathPoints.add(vert);
  192. currentSubPath.add(vert);
  193. }
  194. /* (non-Javadoc)
  195. * @see org.apache.batik.parser.PathHandler#linetoVerticalRel(float)
  196. */
  197. public void linetoVerticalRel(float y) throws ParseException {
  198. if (verbose)
  199. System.out.println("linetoVerticalRel: " + y);
  200. Vertex vert = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY() + y, 0);
  201. pathPoints.add(vert);
  202. currentSubPath.add(vert);
  203. }
  204. /* (non-Javadoc)
  205. * @see org.apache.batik.parser.PathHandler#curvetoQuadraticAbs(float, float, float, float)
  206. */
  207. public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException {
  208. if (verbose)
  209. System.out.println("curvetoQuadraticAbs x1:" + x1 + " y1:" + y1 + " x:" + x+ " y:" + y);
  210. if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
  211. Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
  212. Vertex quadControlPoint = new Vertex(x1,y1,0);
  213. //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
  214. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, quadControlPoint , new Vertex(x, y, 0));
  215. cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
  216. pathPoints.add(b5);
  217. currentSubPath.add(b5);
  218. }else{
  219. System.err.println("last point = null at curvetoQuadraticAbs");
  220. }
  221. }
  222. /* (non-Javadoc)
  223. * @see org.apache.batik.parser.PathHandler#curvetoQuadraticRel(float, float, float, float)
  224. */
  225. public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException {
  226. if (verbose)
  227. System.out.println("curvetoQuadraticRel: " + x1 + "," + y1 + " " + x + "," + y);
  228. if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
  229. Vertex lastPoint = pathPoints.getLast();
  230. Vertex lastEndPoint = new Vertex(lastPoint.getX(), lastPoint.getY(), lastPoint.getZ());
  231. Vertex quadControlPoint = new Vertex(lastPoint.getX() + x1, lastPoint.getY()+ y1, 0);
  232. //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
  233. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
  234. lastEndPoint,
  235. quadControlPoint ,
  236. new Vertex(lastPoint.getX() + x, lastPoint.getY()+ y, 0));
  237. cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
  238. pathPoints.add(b5);
  239. currentSubPath.add(b5);
  240. }else{
  241. System.out.println("last point null at curvetoQuadraticRel");
  242. }
  243. }
  244. /* (non-Javadoc)
  245. * @see org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothAbs(float, float)
  246. */
  247. public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException {
  248. if (verbose)
  249. System.out.println("curvetoQuadraticSmoothAbs " + " x:" + x+ " y:" + y);
  250. Vertex lastPoint = pathPoints.getLast();
  251. if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
  252. Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
  253. //Get control point of last QuadTo
  254. Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
  255. cubicBezVertTOQuadricControlPoint.remove(lastPoint);
  256. //Rotate that controlpoint around the end point of the last QuadTo
  257. lastQuadControlPoint.rotateZ(lastEndPoint, 180);
  258. //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
  259. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, lastQuadControlPoint , new Vertex(x, y, 0));
  260. //Save last quad control point
  261. cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
  262. pathPoints.add(b5);
  263. currentSubPath.add(b5);
  264. }else{
  265. if (verbose)
  266. System.out.println("Couldnt get last controlpoint at: curvetoQuadraticSmoothAbs - using last point as controlpoint");
  267. //If we couldnt retrieve the controlpoint of the current point,
  268. //we use the current point as the new controlpoint
  269. Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  270. Vertex quadControlPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  271. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
  272. lastEndPoint,
  273. quadControlPoint ,
  274. new Vertex(x, y, 0));
  275. cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
  276. pathPoints.add(b5);
  277. currentSubPath.add(b5);
  278. }
  279. }
  280. /* (non-Javadoc)
  281. * @see org.apache.batik.parser.PathHandler#curvetoQuadraticSmoothRel(float, float)
  282. */
  283. public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException {
  284. if (verbose)
  285. System.out.println("curvetoQuadraticSmoothRel: " + x + "," + y);
  286. Vertex lastPoint = pathPoints.getLast();
  287. if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
  288. Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
  289. //Get control point of last QuadTo
  290. Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
  291. cubicBezVertTOQuadricControlPoint.remove(lastPoint);
  292. //Rotate that controlpoint around the end point of the last QuadTo
  293. lastQuadControlPoint.rotateZ(lastEndPoint, 180);
  294. //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
  295. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
  296. lastEndPoint,
  297. lastQuadControlPoint ,
  298. new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0));
  299. //Save last quad control point
  300. cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
  301. pathPoints.add(b5);
  302. currentSubPath.add(b5);
  303. }else{
  304. if (verbose)
  305. System.out.println("couldnt get last control point at curvetoQuadraticSmoothRel - using last point as the control point");
  306. Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  307. Vertex quadControlPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  308. BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
  309. lastEndPoint,
  310. quadControlPoint ,
  311. new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0));
  312. cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
  313. pathPoints.add(b5);
  314. currentSubPath.add(b5);
  315. }
  316. }
  317. /* (non-Javadoc)
  318. * @see org.apache.batik.parser.PathHandler#curvetoCubicAbs(float, float, float, float, float, float)
  319. */
  320. public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
  321. if (verbose)
  322. System.out.println("curvetoCubicAbs x1:" + x1 + " y1:" + y1 + " x2:" + x2 + " y2:" + y2 + " x:" + x+ " y:" + y);
  323. BezierVertex b = new BezierVertex(x1,y1,0, x2,y2,0, x,y,0);
  324. pathPoints.add(b);
  325. currentSubPath.add(b);
  326. }
  327. /* (non-Javadoc)
  328. * @see org.apache.batik.parser.PathHandler#curvetoCubicRel(float, float, float, float, float, float)
  329. */
  330. public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
  331. if (verbose)
  332. System.out.println("curvetoCubicSmoothRel: " + x1 + "," + y1 + " " + x2 + "," + y2 + " " + x + "," + y);
  333. Vertex lastPoint = pathPoints.getLast();
  334. BezierVertex b = new BezierVertex(
  335. lastPoint.getX()+ x1, lastPoint.getY() + y1,0,
  336. lastPoint.getX()+ x2, lastPoint.getY() + y2,0,
  337. lastPoint.getX()+ x, lastPoint.getY() + y,0);
  338. pathPoints.add(b);
  339. currentSubPath.add(b);
  340. }
  341. /* (non-Javadoc)
  342. * @see org.apache.batik.parser.PathHandler#curvetoCubicSmoothAbs(float, float, float, float)
  343. */
  344. public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException {
  345. if (verbose)
  346. System.out.println("curvetoCubicSmoothAbs x2:" + x2 + " y2:" + y2 + " x:" + x+ " y:" + y);
  347. Vertex lastPoint = pathPoints.getLast();
  348. if (lastPoint instanceof BezierVertex){
  349. BezierVertex lastBez = (BezierVertex)lastPoint;
  350. Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
  351. //reflect the last controlpoint at the current point
  352. lastConPointCopy.rotateZ(lastPoint, 180);
  353. BezierVertex b = new BezierVertex(lastConPointCopy.getX(),lastConPointCopy.getY(),0, x2,y2,0, x,y,0);
  354. pathPoints.add(b);
  355. currentSubPath.add(b);
  356. }else{
  357. if (verbose)
  358. System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothAbs - using last point as first controlpoint");
  359. Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  360. BezierVertex b = new BezierVertex(
  361. lastEndPoint.getX(),lastEndPoint.getY(),0,
  362. x2,y2,0,
  363. x,y,0);
  364. pathPoints.add(b);
  365. currentSubPath.add(b);
  366. }
  367. }
  368. /* (non-Javadoc)
  369. * @see org.apache.batik.parser.PathHandler#curvetoCubicSmoothRel(float, float, float, float)
  370. */
  371. public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException {
  372. if (verbose)
  373. System.out.println("curvetoCubicSmoothRel: " + x2 + "," + y2 + " " + x + "," + y);
  374. Vertex lastPoint = pathPoints.getLast();
  375. if (lastPoint instanceof BezierVertex){
  376. BezierVertex lastBez = (BezierVertex)lastPoint;
  377. Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
  378. //reflect the last controlpoint at the current point
  379. lastConPointCopy.rotateZ(lastPoint, 180);
  380. BezierVertex b = new BezierVertex(
  381. lastConPointCopy.getX() , lastConPointCopy.getY(), 0,
  382. lastPoint.getX() + x2, lastPoint.getY() + y2, 0,
  383. lastPoint.getX() + x, lastPoint.getY() + y, 0);
  384. pathPoints.add(b);
  385. currentSubPath.add(b);
  386. }else{
  387. if (verbose)
  388. System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothRel - using last point as first controlpoint");
  389. Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
  390. BezierVertex b = new BezierVertex(
  391. lastEndPoint.getX(),lastEndPoint.getY(),0,
  392. lastEndPoint.getX()+ x2, lastEndPoint.getY()+ y2, 0,
  393. lastEndPoint.getX()+ x, lastEndPoint.getY()+ y, 0);
  394. pathPoints.add(b);
  395. currentSubPath.add(b);
  396. }
  397. }
  398. /**
  399. * if "Z" is encountered.
  400. *
  401. * @throws ParseException the parse exception
  402. */
  403. public void closePath() throws ParseException {
  404. if (verbose)
  405. System.out.println("close Path");
  406. //Close the current contour with the previous MoveTo Vertex
  407. Vertex lastPointCopy = (Vertex)currentSubPath.get(0).getCopy();
  408. currentSubPath.add(lastPointCopy);
  409. pathPoints.add(lastPointCopy);
  410. //Save the current contour and clear the current for the next contour
  411. Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
  412. subPaths.add(currentSplitPathArr);
  413. currentSubPath.clear();
  414. }
  415. /* (non-Javadoc)
  416. * @see org.apache.batik.parser.PathHandler#endPath()
  417. */
  418. public void endPath() throws ParseException {
  419. if (verbose)
  420. System.out.println("End Path");
  421. //IF no Z command occured, were normally the last contour gets added,
  422. //we have save the current contour here, but we dont close it
  423. if (!currentSubPath.isEmpty()){
  424. //Convert partial path list to array
  425. Vertex[] currentSplitPathArr = currentSubPath.toArray(new Vertex[currentSubPath.size()]);
  426. //Add partial path array to list of all partial paths of this glyph
  427. subPaths.add(currentSplitPathArr);
  428. currentSubPath.clear();
  429. }
  430. }
  431. /**
  432. * Gets the path points.
  433. *
  434. * @return the path points
  435. */
  436. public LinkedList<Vertex> getPathPoints() {
  437. return pathPoints;
  438. }
  439. /**
  440. * Gets the path points array.
  441. *
  442. * @return the path points array
  443. */
  444. public Vertex[] getPathPointsArray() {
  445. return pathPoints.toArray(new Vertex[pathPoints.size()]);
  446. }
  447. /**
  448. * @deprecated Only used when the intention is to draw the shapes using the stencil buffer..
  449. *
  450. * @return the reverse move to vertices
  451. */
  452. public Vertex[] getReverseMoveToVertices() {
  453. return reverseMoveToStack.toArray(new Vertex[reverseMoveToStack.size()]);
  454. }
  455. /**
  456. * @deprecated Only used when the intention is to draw the shapes using the stencil buffer..
  457. * @return the reverse move to stack
  458. */
  459. public Stack<Vertex> getReverseMoveToStack() {
  460. return reverseMoveToStack;
  461. }
  462. /**
  463. * Returns all the encountered "sub-paths" of the parsed path-element.
  464. *
  465. * @return the contours
  466. */
  467. public ArrayList<Vertex[]> getContours() {
  468. return subPaths;
  469. }
  470. /**
  471. * Sets the verbose.
  472. *
  473. * @param verbose the new verbose
  474. */
  475. public void setVerbose(boolean verbose) {
  476. this.verbose = verbose;
  477. }
  478. }