Java 类android.graphics.SumPathEffect 实例源码

项目: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]);

}