Package ae.math

Examples of ae.math.DistanceField


    return fontCharacter;
  }
 
  public static FontCharacter getDistanceFieldChar(FontCharacter fontCharacter, Font font, int newPtSize, float smoothAmount) {
   
    DistanceField distanceField = DistanceField.calculate(
        fontCharacter.getBytes(),
        fontCharacter.getWidth(),
        fontCharacter.getHeight(),
        (int) Math.ceil(smoothAmount*font.getSize2D()*0.336f), // smooth pixels length
        newPtSize / font.getSize2D() // new font size
        );
   
    float resizedPerc = (distanceField.getHeight() - 2 * distanceField.getBorder()) / (float) fontCharacter.getHeight();
   
    return new FontCharacter(
        distanceField.getBytes(),
        distanceField.getWidth(),
        distanceField.getHeight(),
        fontCharacter.getBaseline() * resizedPerc - distanceField.getBorder(),
        fontCharacter.getAdvanceBefore() * resizedPerc + distanceField.getBorder(),
        fontCharacter.getAdvanceAfter() * resizedPerc - distanceField.getBorder()
        );
  }
View Full Code Here

TOP

Related Classes of ae.math.DistanceField

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.