Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Path


    int count = 0;
   
    ArrayList pts = new ArrayList();
    boolean moved = false;
    boolean reasonToBePath = false;
    Path path = null;
   
    while (tokens.hasMoreTokens()) {
      try {
        String nextToken = tokens.nextToken();
        if (nextToken.equals("L")) {
          float x = Float.parseFloat(tokens.nextToken());
          float y = Float.parseFloat(tokens.nextToken());
          path.lineTo(x,y);
          continue;
        }
        if (nextToken.equals("z")) {
          path.close();
          continue;
        }
        if (nextToken.equals("M")) {
          if (!moved) {
            moved = true;
            float x = Float.parseFloat(tokens.nextToken());
            float y = Float.parseFloat(tokens.nextToken());
            path = new Path(x,y);
            continue;
          }
 
          reasonToBePath = true;
          float x = Float.parseFloat(tokens.nextToken());
          float y = Float.parseFloat(tokens.nextToken());
          path.startHole(x,y);
         
          continue;
        }
        if (nextToken.equals("C")) {
          reasonToBePath = true;
          float cx1 = Float.parseFloat(tokens.nextToken());
          float cy1 = Float.parseFloat(tokens.nextToken());
          float cx2 = Float.parseFloat(tokens.nextToken());
          float cy2 = Float.parseFloat(tokens.nextToken());
          float x = Float.parseFloat(tokens.nextToken());
          float y = Float.parseFloat(tokens.nextToken());
          path.curveTo(x,y,cx1,cy1,cx2,cy2);
          continue;
        }
      } catch (NumberFormatException e) {
        throw new ParsingException(element.getAttribute("id"), "Invalid token in points list", e);
      }
View Full Code Here


    if (element.getNodeName().equals("path")) {
      points = element.getAttribute("d");
    }
   
    StringTokenizer tokens = new StringTokenizer(points, ", ");
    Path path = processPoly(element, tokens);
    NonGeometricData data = Util.getNonGeometricData(element);
    if (path != null) {
      Shape shape = path.transform(transform);
     
      diagram.addFigure(new Figure(Figure.PATH, shape, data, transform));
    }
  }
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Path

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.