【问题标题】:How can I iterate over android.graphics.Path segments?如何迭代 android.graphics.Path 段?
【发布时间】:2015-06-27 16:44:51
【问题描述】:

我有一个 android Path 对象(从文本创建:paint.getTextPath(someString, 0, someString.length(), 0f, 0f, myPathObject);

如何在 awt 中使用 PathIterator 迭代路径对象段(“移动到”、“行到”、“四到”等)?

【问题讨论】:

    标签: java android path awt curve


    【解决方案1】:

    老问题,但我希望它有答案 看android.graphics.PathMeasure API 1

      float[] tmpPos = new float[2];
      float[] tmpTan = new float[2];
      PathMeasure measure = new PathMeasure();
      measure.setPath(path, true);
      do {
       float dist = measure.getLength();
       for (float p = 0; p < dist; p += 1) {
         measure.getPosTan(p, tmpPos, tmpTan);
         float x = tmpPos[0], y = tmpPos[1];
         float nx = tmpTan[0], ny = tmpTan[1];
         // do your own stuff
        }
     } while (measure.nextContour());
    

    【讨论】:

      猜你喜欢
      • 2014-06-05
      • 1970-01-01
      • 2011-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      相关资源
      最近更新 更多