当前位置: 首页>>代码示例>>Java>>正文


Java PathMeasure.nextContour方法代码示例

本文整理汇总了Java中android.graphics.PathMeasure.nextContour方法的典型用法代码示例。如果您正苦于以下问题:Java PathMeasure.nextContour方法的具体用法?Java PathMeasure.nextContour怎么用?Java PathMeasure.nextContour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.PathMeasure的用法示例。


在下文中一共展示了PathMeasure.nextContour方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildPathData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void buildPathData() {
    SvgPathParser parser = getPathParser();
    pathData = new PathData();
    try {
        pathData.path = parser.parsePath(svgPath);
    } catch (ParseException e) {
        pathData.path = new Path();
    }

    PathMeasure pm = new PathMeasure(pathData.path, true);
    while (true) {
        pathData.length = Math.max(pathData.length, pm.getLength());
        if (!pm.nextContour()) {
            break;
        }
    }
}
 
开发者ID:TomeOkin,项目名称:LsPush,代码行数:18,代码来源:FillableLoader.java

示例2: buildPathData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void buildPathData() {
  SvgPathParser parser = getPathParser();
  pathData = new PathData();
  try {
    pathData.path = parser.parsePath(svgPath);
  } catch (ParseException e) {
    pathData.path = new Path();
  }

  PathMeasure pm = new PathMeasure(pathData.path, true);
  while (true) {
    pathData.length = Math.max(pathData.length, pm.getLength());
    if (!pm.nextContour()) {
      break;
    }
  }
}
 
开发者ID:JorgeCastilloPrz,项目名称:AndroidFillableLoaders,代码行数:18,代码来源:FillableLoader.java

示例3: rebuildGlyphData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
/**
 * If you set the SVG data paths more than once using {@link #setGlyphStrings(String...)} you should call this method
 * before playing the animation.
 */
@SuppressWarnings("SuspiciousNameCombination")
public void rebuildGlyphData() {

    float X = mWidth / mViewport.x;
    float Y = mHeight / mViewport.y;

    Matrix scaleMatrix = new Matrix();
    RectF outerRect = new RectF(X, X, Y, Y);
    scaleMatrix.setScale(X, Y, outerRect.centerX(), outerRect.centerY());

    mGlyphData = new GlyphData[mGlyphStrings.length];
    for (int i = 0; i < mGlyphStrings.length; i++) {
        mGlyphData[i] = new GlyphData();
        try {
            mGlyphData[i].path = WoWoPathParser.createPathFromPathData(mGlyphStrings[i]);
            mGlyphData[i].path.transform(scaleMatrix);
        } catch (Exception e) {
            mGlyphData[i].path = new Path();
            Log.e(TAG, "Couldn't parse path", e);
        }
        PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
        while (true) {
            mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
            if (!pm.nextContour()) {
                break;
            }
        }
        mGlyphData[i].paint = new Paint();
        mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
        mGlyphData[i].paint.setAntiAlias(true);
        mGlyphData[i].paint.setColor(Color.WHITE);
        mGlyphData[i].paint.setStrokeWidth(
                TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:WoWoSvgView.java

示例4: rebuildGlyphData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void rebuildGlyphData() {
    SvgPathParser parser = new SvgPathParser() {
        @Override
        protected float transformX(float x) {
            return x * mWidth / VIEWPORT.x;
        }

        @Override
        protected float transformY(float y) {
            return y * mHeight / VIEWPORT.y;
        }
    };

    mGlyphData = new GlyphData[SVGPathData.GLYPHS.length];
    for (int i = 0; i < SVGPathData.GLYPHS.length; i++) {
        mGlyphData[i] = new GlyphData();
        try {
            mGlyphData[i].path = parser.parsePath(SVGPathData.GLYPHS[i]);
        } catch (ParseException e) {
            mGlyphData[i].path = new Path();
        }
        PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
        while (true) {
            mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
            if (!pm.nextContour()) {
                break;
            }
        }
        mGlyphData[i].paint = new Paint();
        mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
        mGlyphData[i].paint.setAntiAlias(true);
        mGlyphData[i].paint.setColor(Color.WHITE);
        mGlyphData[i].paint.setStrokeWidth(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    }
}
 
开发者ID:abhinavp13,项目名称:LoginArt,代码行数:36,代码来源:AnimatedLogoView.java

示例5: rebuildGlyphData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
/**
 * If you set the SVG data paths more than once using {@link #setGlyphStrings(String...)} you should call this method
 * before playing the animation.
 */
@SuppressWarnings("SuspiciousNameCombination")
public void rebuildGlyphData() {

  float X = mWidth / mViewport.x;
  float Y = mHeight / mViewport.y;

  Matrix scaleMatrix = new Matrix();
  RectF outerRect = new RectF(X, X, Y, Y);
  scaleMatrix.setScale(X, Y, outerRect.centerX(), outerRect.centerY());

  mGlyphData = new GlyphData[mGlyphStrings.length];
  for (int i = 0; i < mGlyphStrings.length; i++) {
    mGlyphData[i] = new GlyphData();
    try {
      mGlyphData[i].path = PathParser.createPathFromPathData(mGlyphStrings[i]);
      mGlyphData[i].path.transform(scaleMatrix);
    } catch (Exception e) {
      mGlyphData[i].path = new Path();
      Log.e(TAG, "Couldn't parse path", e);
    }
    PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
    while (true) {
      mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
      if (!pm.nextContour()) {
        break;
      }
    }
    mGlyphData[i].paint = new Paint();
    mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
    mGlyphData[i].paint.setAntiAlias(true);
    mGlyphData[i].paint.setColor(Color.WHITE);
    mGlyphData[i].paint.setStrokeWidth(
        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
  }
}
 
开发者ID:jaredrummler,项目名称:AnimatedSvgView,代码行数:40,代码来源:AnimatedSvgView.java

示例6: rebuildGlyphData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void rebuildGlyphData() {
    SvgPathParser parser = new SvgPathParser() {
        @Override
        protected float transformX(float x) {
            return x * mWidth / VIEWPORT.x;
        }

        @Override
        protected float transformY(float y) {
            return y * mHeight / VIEWPORT.y;
        }
    };

    mGlyphData = new GlyphData[LogoPaths.GLYPHS.length];
    for (int i = 0; i < LogoPaths.GLYPHS.length; i++) {
        mGlyphData[i] = new GlyphData();
        try {
            mGlyphData[i].path = parser.parsePath(LogoPaths.GLYPHS[i]);
        } catch (ParseException e) {
            mGlyphData[i].path = new Path();
            Log.e(TAG, "Couldn't parse path", e);
        }
        PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
        while (true) {
            mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
            if (!pm.nextContour()) {
                break;
            }
        }
        mGlyphData[i].paint = new Paint();
        mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
        mGlyphData[i].paint.setAntiAlias(true);
        mGlyphData[i].paint.setColor(Color.WHITE);
        mGlyphData[i].paint.setStrokeWidth(
                TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
                        getResources().getDisplayMetrics()));
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:39,代码来源:AnimatedMuzeiLogoView.java

示例7: rebuildGlyphData

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void rebuildGlyphData() {
    SvgPathParser parser = new SvgPathParser() {
        @Override
        protected float transformX(float x) {
            return x * mWidth / VIEWPORT.width();
        }

        @Override
        protected float transformY(float y) {
            return y * mHeight / VIEWPORT.height();
        }
    };

    mGlyphData = new GlyphData();
    try {
        mGlyphData.path = parser.parsePath(LogoPaths.GLYPHS[0]);
    } catch (ParseException e) {
        mGlyphData.path = new Path();
        Log.e(TAG, "Couldn't parse path", e);
    }
    PathMeasure pm = new PathMeasure(mGlyphData.path, true);
    while (true) {
        mGlyphData.length = Math.max(mGlyphData.length, pm.getLength());
        if (!pm.nextContour()) {
            break;
        }
    }
    mGlyphData.paint = new Paint();
    mGlyphData.paint.setStyle(Paint.Style.STROKE);
    mGlyphData.paint.setAntiAlias(true);
    mGlyphData.paint.setColor(Color.WHITE);
    mGlyphData.paint.setStrokeWidth(
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
                    getResources().getDisplayMetrics()));
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:36,代码来源:AnimatedMuzeiLoadingSpinnerView.java

示例8: testNextContour

import android.graphics.PathMeasure; //导入方法依赖的package包/类
private void testNextContour(Canvas canvas) {

        Path path = new Path();

        path.addRect(-100, -100, 100, 100, Path.Direction.CW);  // 添加小矩形
        path.addRect(-200, -200, 200, 200, Path.Direction.CW);  // 添加大矩形

        canvas.drawPath(path, mDeafultPaint);                    // 绘制 Path

        PathMeasure measure = new PathMeasure(path, false);     // 将Path与PathMeasure关联

        float len1 = measure.getLength();                       // 获得第一条路径的长度

        measure.nextContour();                                  // 跳转到下一条路径

        float len2 = measure.getLength();                       // 获得第二条路径的长度

        Log.i("LEN", "len1=" + len1);                              // 输出两条路径的长度
        Log.i("LEN", "len2=" + len2);
    }
 
开发者ID:luhaoaimama1,项目名称:zone-sdk,代码行数:21,代码来源:PathMeasureView.java


注:本文中的android.graphics.PathMeasure.nextContour方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。