PathBitmapMesh.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:Mire 作者:
public void matchVertsToPath(Path path, float bottomCoord, float extraOffset) {
    PathMeasure pm = new PathMeasure(path, false);

    for (int i = 0; i < staticVerts.length / 2; i++) {

        float yIndexValue = staticVerts[i * 2 + 1];
        float xIndexValue = staticVerts[i * 2];


        float percentOffsetX = (0.000001f + xIndexValue) / bitmap.getWidth();
        float percentOffsetX2 = (0.000001f + xIndexValue) / (bitmap.getWidth() + extraOffset);
        percentOffsetX2 += pathOffsetPercent;
        pm.getPosTan(pm.getLength() * (1f - percentOffsetX), coords, null);
        pm.getPosTan(pm.getLength() * (1f - percentOffsetX2), coords2, null);

        if (yIndexValue == 0) {
            setXY(drawingVerts, i, coords[0], coords2[1]);
        } else {
            float desiredYCoord = bottomCoord;
            setXY(drawingVerts, i, coords[0], desiredYCoord);

        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号