Package org.mt4j.util.xml.svg

Examples of org.mt4j.util.xml.svg.CustomPathHandler


  private CustomPathHandler pathHandler;
  private PApplet app;
 
  public ShapeBuilder(PApplet app){
    this.app = app;
    this.pathHandler = new CustomPathHandler();
   
  }
View Full Code Here


//  public void startPath() throws ParseException {
//    this.pathHandler.startPath();
//  }
 
  public void reset(){
    this.pathHandler = new CustomPathHandler();
  }
View Full Code Here

    scaleFactor = 0.2f;
   
    svgFont = null;
    verbose = false;
   
    pathHandler = new CustomPathHandler();
    pathParser   = new PathParser();
    pathParser.setPathHandler(pathHandler);
   
    XmlHandler.getInstance().saxParse(
        svgFontFileName,
View Full Code Here

       
        if (currentAttributeName.equalsIgnoreCase("d")){
//          ArrayList<SvgFontCharacter> characters = extractPath(currentAttribueValue);
         
          //Parse the Paths's "d" attribute and create a new character
          pathHandler = new CustomPathHandler();
          pathParser.setPathHandler(pathHandler);
          pathParser.parse(currentAttribueValue);
          currentCharacter = this.createCharacter(pathHandler);
         
          //Set unicode/name for missing glyph by hand
View Full Code Here

    //logger.info("Advx " + glyph.getAdvanceWidth());
   
    int offset = 0;
    //float originx = 0F,originy = 0F;

    CustomPathHandler pathHandler = new CustomPathHandler();

    while (offset < count) {
      Point point     = glyph.getPoint(startIndex + offset%count);
      Point point_plus1   = glyph.getPoint(startIndex + (offset+1)%count);
      Point point_plus2   = glyph.getPoint(startIndex + (offset+2)%count);

      float pointx = ((float)point.x);
      float pointy = ((float)point.y);
      float point_plus1x = ((float)point_plus1.x);
      float point_plus1y = ((float)point_plus1.y);
      float point_plus2x = ((float)point_plus2.x);
      float point_plus2y = ((float)point_plus2.y);

      if (offset == 0) {
        pathHandler.movetoAbs(pointx,pointy);
      }

      if (point.onCurve && point_plus1.onCurve) {
        // line command
        pathHandler.linetoAbs(point_plus1x,point_plus1y);
        offset++;
      } else if (point.onCurve && !point_plus1.onCurve && point_plus2.onCurve) {
        // This is a curve with no implied points
        // quadratic bezier command
        pathHandler.curvetoQuadraticAbs(point_plus1x, point_plus1y, point_plus2x, point_plus2y);
        offset+=2;
      } else if (point.onCurve && !point_plus1.onCurve && !point_plus2.onCurve) {
        // This is a curve with one implied point
        pathHandler.curvetoQuadraticAbs(point_plus1x, point_plus1y, midValue(point_plus1x, point_plus2x), midValue(point_plus1y, point_plus2y));
        offset+=2;
      } else if (!point.onCurve && !point_plus1.onCurve) {
        // This is a curve with two implied points
        // quadratic bezier with
        pathHandler.curvetoQuadraticAbs(pointx, pointy, midValue(pointx, point_plus1x), midValue(pointy, point_plus1y));
        offset++;
      } else if (!point.onCurve && point_plus1.onCurve) {
        // This is a curve with no implied points
        pathHandler.curvetoQuadraticAbs(pointx, pointy, point_plus1x, point_plus1y);
        offset++;
      } else {
        logger.info("drawGlyph case not catered for!!");
        break;
      }
    }

    pathHandler.closePath();


    Vertex[] p = pathHandler.getPathPointsArray();

    /*
      //Get Sub-Paths
      ArrayList<Vertex[]> subPaths = pathHandler.getContours();

View Full Code Here

TOP

Related Classes of org.mt4j.util.xml.svg.CustomPathHandler

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.