Java 类android.graphics.PathDashPathEffect 实例源码

项目:android-study    文件:PathEffectView.java   
@Override protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  //无效果
  mEffects[0] = null;
  //拐角处变得圆滑
  mEffects[1] = new CornerPathEffect(30);
  //线段上就会产生许多杂点
  mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
  //绘制虚线
  mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, 0);
  Path path = new Path();
  path.addRect(0, 0, 8, 8, Path.Direction.CCW);
  //设置点的图形,即方形点的虚线,圆形点的虚线
  mEffects[4] = new PathDashPathEffect(path, 12, 0, PathDashPathEffect.Style.ROTATE);
  //组合PathEffect
  mEffects[5] = new ComposePathEffect(mEffects[3], mEffects[1]);
  for (int i = 0; i < mEffects.length; i++) {
    mPaint.setPathEffect(mEffects[i]);
    canvas.drawPath(mPath, mPaint);
    canvas.translate(0, 200);
  }
}
项目:DirectionFieldAndroid    文件:PhasePlane.java   
public void setPoints(ArrayList<float[]> pointsToPath){
    synchronized (pointsToPath) {
        this.points = pointsToPath;
        float[] startPoint = convertXYToLinePoint(points.get(0));
        path.moveTo(startPoint[0], startPoint[1]);
        for (int i = 0; i<this.points.size(); i++) {
            float[] linePoint = convertXYToLinePoint(points.get(i));
            path.lineTo(linePoint[0],linePoint[1]);
        }
    }
    pathMeasure = new PathMeasure(path, false);
    pathLength = pathMeasure.getLength(); // the interpolated length of the entire path as it would be drawn on the screen in dp
    PathEffect pathEffect = new PathDashPathEffect(makeConvexArrow(15.0f, 15.0f), 5.0f, 0.0f, PathDashPathEffect.Style.ROTATE);
    paintSettings.setPathEffect(pathEffect);
    invalidate();
}
项目:binea_project_for_android    文件:PathEffectView.java   
private void initPaint() {
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(5);
    mPaint.setColor(Color.RED);

    mPath = new Path();

    mPath.moveTo(0, 0);

    for(int i = 0;i<=30;i++){
        mPath.lineTo(i*35, (float)Math.random()*100);
    }

    mEffects = new PathEffect[7];
    mEffects[0] = null;
    mEffects[1] = new CornerPathEffect(10);
    mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
    mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, mPhase);
    Path path = new Path();
    path.addRect(0, 0, 8, 8, Path.Direction.CCW);
    mEffects[4] = new PathDashPathEffect(path, 12, mPhase, PathDashPathEffect.Style.ROTATE);
    mEffects[5] = new ComposePathEffect(mEffects[2], mEffects[4]);
    mEffects[6] = new SumPathEffect(mEffects[4], mEffects[3]);

}
项目:QuizUpWinner    文件:Chart.java   
private void ˊ(Canvas paramCanvas, Paint paramPaint)
{
  int i = this.ˈ.getResources().getColor(2131230762);
  Path localPath1 = new Path();
  localPath1.addCircle(0.0F, 0.0F, 1.0F, Path.Direction.CW);
  paramPaint.setStyle(Paint.Style.STROKE);
  paramPaint.setStrokeWidth(1.0F);
  paramPaint.setPathEffect(new PathDashPathEffect(localPath1, 6.0F, 1.0F, PathDashPathEffect.Style.TRANSLATE));
  for (int j = 0; j < 8; j++)
  {
    float f2 = this.ˎ * j + this.ʻ;
    if (j % 2 == 1)
      paramPaint.setColor(i);
    else
      paramPaint.setColor(-1);
    Path localPath3 = new Path();
    localPath3.moveTo(this.ˏ, f2);
    localPath3.lineTo(this.ʽ, f2);
    paramCanvas.drawPath(localPath3, paramPaint);
  }
  paramPaint.setColor(-1);
  for (int k = 1; k <= 7; k++)
  {
    float f1 = this.ˋ * k + this.ˏ;
    this.ʿ[(k - 1)] = f1;
    Path localPath2 = new Path();
    localPath2.moveTo(f1, this.ʻ);
    localPath2.lineTo(f1, this.ͺ);
    paramCanvas.drawPath(localPath2, paramPaint);
  }
  this.ʿ[(-1 + this.ʿ.length)] = (this. - this.);
}
项目:android-graphics-demo    文件:HollowTextActivity.java   
private PathEffect getTrianglePathEffect(int strokeWidth) {
  return new PathDashPathEffect(
      getTriangle(strokeWidth),
      strokeWidth,
      0.0f,
      PathDashPathEffect.Style.ROTATE);
}
项目:CUT-IN-material    文件:PathEffectsCutin.java   
private static void makeEffects(PathEffect[] e, float phase) {
    e[0] = null;     // no effect
    e[1] = new CornerPathEffect(10);
    e[2] = new DashPathEffect(new float[] {10, 5, 5, 5}, phase);
    e[3] = new PathDashPathEffect(makePathDash(), 12, phase,
                                  PathDashPathEffect.Style.ROTATE);
    e[4] = new ComposePathEffect(e[2], e[1]);
    e[5] = new ComposePathEffect(e[3], e[1]);
}
项目:springy-heads    文件:ChatHeadOverlayView.java   
/**
 * Will be called by animator
 * @param phase
 */
private void setPhase(float phase) {
    pathDashEffect = new PathDashPathEffect(makeDot(OVAL_RADIUS), STAMP_SPACING, phase, PathDashPathEffect.Style.ROTATE);
    invalidate();
}
项目:rastertheque    文件:SafeDashPathEffect.java   
public SafeDashPathEffect(float[] intervals, float phase, float strokeWidth) {
    super(createSafeDashedPath(intervals, phase, strokeWidth, null), floatSum(intervals), phase,
            PathDashPathEffect.Style.MORPH);
}
项目:OpenMapKitAndroid    文件:SafeDashPathEffect.java   
public SafeDashPathEffect(float[] intervals, float phase, float strokeWidth) {
    super(createSafeDashedPath(intervals, phase, strokeWidth, null), floatSum(intervals), phase,
            PathDashPathEffect.Style.MORPH);
}