Search in sources :

Example 11 with DashPathEffect

use of android.graphics.DashPathEffect in project platform_frameworks_base by android.

the class GradientDrawable method setStrokeInternal.

private void setStrokeInternal(int width, int color, float dashWidth, float dashGap) {
    if (mStrokePaint == null) {
        mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mStrokePaint.setStyle(Paint.Style.STROKE);
    }
    mStrokePaint.setStrokeWidth(width);
    mStrokePaint.setColor(color);
    DashPathEffect e = null;
    if (dashWidth > 0) {
        e = new DashPathEffect(new float[] { dashWidth, dashGap }, 0);
    }
    mStrokePaint.setPathEffect(e);
    invalidateSelf();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 12 with DashPathEffect

use of android.graphics.DashPathEffect in project StepView by baoyachi.

the class VerticalStepViewIndicator method init.

/**
     * init
     */
private void init() {
    mPath = new Path();
    mEffects = new DashPathEffect(new float[] { 8, 8, 8, 8 }, 1);
    //初始化
    mCircleCenterPointPositionList = new ArrayList<>();
    mUnCompletedPaint = new Paint();
    mCompletedPaint = new Paint();
    mUnCompletedPaint.setAntiAlias(true);
    mUnCompletedPaint.setColor(mUnCompletedLineColor);
    mUnCompletedPaint.setStyle(Paint.Style.STROKE);
    mUnCompletedPaint.setStrokeWidth(2);
    mCompletedPaint.setAntiAlias(true);
    mCompletedPaint.setColor(mCompletedLineColor);
    mCompletedPaint.setStyle(Paint.Style.STROKE);
    mCompletedPaint.setStrokeWidth(2);
    mUnCompletedPaint.setPathEffect(mEffects);
    mCompletedPaint.setStyle(Paint.Style.FILL);
    //已经完成线的宽高 set mCompletedLineHeight
    mCompletedLineHeight = 0.05f * defaultStepIndicatorNum;
    //圆的半径  set mCircleRadius
    mCircleRadius = 0.28f * defaultStepIndicatorNum;
    //线与线之间的间距    set mLinePadding
    mLinePadding = 0.85f * defaultStepIndicatorNum;
    //已经完成的icon
    mCompleteIcon = ContextCompat.getDrawable(getContext(), R.drawable.complted);
    //正在进行的icon
    mAttentionIcon = ContextCompat.getDrawable(getContext(), R.drawable.attention);
    //未完成的icon
    mDefaultIcon = ContextCompat.getDrawable(getContext(), R.drawable.default_icon);
    //default draw
    mIsReverseDraw = true;
}
Also used : Path(android.graphics.Path) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 13 with DashPathEffect

use of android.graphics.DashPathEffect in project discrollview by flavienlaurent.

the class DiscrollvablePathLayout method onDraw.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    makeAndMeasurePath();
    if (!isInEditMode()) {
        // Apply the dash effect
        float length = mPathMeasure.getLength();
        PathEffect effect = new DashPathEffect(new float[] { length, length }, length * (1 - mRatio));
        mPaint.setPathEffect(effect);
    }
    canvas.drawPath(mPath, mPaint);
}
Also used : DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect)

Example 14 with DashPathEffect

use of android.graphics.DashPathEffect in project ListenerMusicPlayer by hefuyicoder.

the class LyricView method drawIndicator.

/**
     * 绘制指示器
     * @param canvas
     * */
private void drawIndicator(Canvas canvas) {
    mIndicatorPaint.setColor(mIndicatorColor);
    mIndicatorPaint.setAlpha(128);
    mIndicatorPaint.setStyle(Paint.Style.FILL);
    canvas.drawText(measureCurrentTime(), getMeasuredWidth() - mTimerBound.width(), (getMeasuredHeight() + mTimerBound.height() - 6) * 0.5f, mIndicatorPaint);
    Path path = new Path();
    mIndicatorPaint.setStrokeWidth(2.0f);
    mIndicatorPaint.setStyle(Paint.Style.STROKE);
    mIndicatorPaint.setPathEffect(new DashPathEffect(new float[] { 20, 10 }, 0));
    path.moveTo(mPlayable ? mBtnBound.right + 24 : 24, getMeasuredHeight() * 0.5f);
    path.lineTo(getMeasuredWidth() - mTimerBound.width() - mTimerBound.width() - 36, getMeasuredHeight() * 0.5f);
    canvas.drawPath(path, mIndicatorPaint);
}
Also used : Path(android.graphics.Path) DashPathEffect(android.graphics.DashPathEffect)

Example 15 with DashPathEffect

use of android.graphics.DashPathEffect in project RecyclerView-FlexibleDivider by yqritc.

the class ComplexAdapter method dividerPaint.

@Override
public Paint dividerPaint(int position, RecyclerView parent) {
    Paint paint = new Paint();
    switch(position % 10) {
        case 0:
            paint.setColor(Color.RED);
            paint.setStrokeWidth(30);
            break;
        case 1:
            paint.setColor(Color.MAGENTA);
            paint.setStrokeWidth(10);
            break;
        default:
            if (position % 2 == 0) {
                paint.setColor(Color.BLUE);
                paint.setAntiAlias(true);
                paint.setPathEffect(new DashPathEffect(new float[] { 25.0f, 25.0f }, 0));
            } else {
                paint.setColor(Color.GREEN);
            }
            paint.setStrokeWidth(2 + position);
            break;
    }
    return paint;
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Aggregations

DashPathEffect (android.graphics.DashPathEffect)45 Paint (android.graphics.Paint)34 Path (android.graphics.Path)7 PathEffect (android.graphics.PathEffect)7 Animation (com.db.chart.animation.Animation)4 LineSet (com.db.chart.model.LineSet)3 Cap (android.graphics.Paint.Cap)2 Join (android.graphics.Paint.Join)2 Style (android.graphics.Paint.Style)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 View (android.view.View)2 BarSet (com.db.chart.model.BarSet)2 Point (com.db.chart.model.Point)2 ArrayList (java.util.ArrayList)2 BasicStroke (org.achartengine.renderer.BasicStroke)2 SuppressLint (android.annotation.SuppressLint)1 TypedArray (android.content.res.TypedArray)1 LinearGradient (android.graphics.LinearGradient)1 Rect (android.graphics.Rect)1 Shader (android.graphics.Shader)1