Search in sources :

Example 41 with DashPathEffect

use of android.graphics.DashPathEffect in project XobotOS by xamarin.

the class GradientDrawable method initializeWithState.

private void initializeWithState(GradientState state) {
    if (state.mHasSolidColor) {
        mFillPaint.setColor(state.mSolidColor);
    }
    mPadding = state.mPadding;
    if (state.mStrokeWidth >= 0) {
        mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mStrokePaint.setStyle(Paint.Style.STROKE);
        mStrokePaint.setStrokeWidth(state.mStrokeWidth);
        mStrokePaint.setColor(state.mStrokeColor);
        if (state.mStrokeDashWidth != 0.0f) {
            DashPathEffect e = new DashPathEffect(new float[] { state.mStrokeDashWidth, state.mStrokeDashGap }, 0);
            mStrokePaint.setPathEffect(e);
        }
    }
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 42 with DashPathEffect

use of android.graphics.DashPathEffect in project UltimateAndroid by cymcsg.

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 43 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by DirtyUnicorns.

the class GradientDrawable method updateLocalState.

private void updateLocalState(Resources res) {
    final GradientState state = mGradientState;
    if (state.mSolidColors != null) {
        final int[] currentState = getState();
        final int stateColor = state.mSolidColors.getColorForState(currentState, 0);
        mFillPaint.setColor(stateColor);
    } else if (state.mGradientColors == null) {
        // If we don't have a solid color and we don't have a gradient,
        // the app is stroking the shape, set the color to the default
        // value of state.mSolidColor
        mFillPaint.setColor(0);
    } else {
        // Otherwise, make sure the fill alpha is maxed out.
        mFillPaint.setColor(Color.BLACK);
    }
    mPadding = state.mPadding;
    if (state.mStrokeWidth >= 0) {
        mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mStrokePaint.setStyle(Paint.Style.STROKE);
        mStrokePaint.setStrokeWidth(state.mStrokeWidth);
        if (state.mStrokeColors != null) {
            final int[] currentState = getState();
            final int strokeStateColor = state.mStrokeColors.getColorForState(currentState, 0);
            mStrokePaint.setColor(strokeStateColor);
        }
        if (state.mStrokeDashWidth != 0.0f) {
            final DashPathEffect e = new DashPathEffect(new float[] { state.mStrokeDashWidth, state.mStrokeDashGap }, 0);
            mStrokePaint.setPathEffect(e);
        }
    }
    mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
    mGradientIsDirty = true;
    state.computeOpacity();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 44 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by ResurrectionRemix.

the class GradientDrawable method updateLocalState.

private void updateLocalState(Resources res) {
    final GradientState state = mGradientState;
    if (state.mSolidColors != null) {
        final int[] currentState = getState();
        final int stateColor = state.mSolidColors.getColorForState(currentState, 0);
        mFillPaint.setColor(stateColor);
    } else if (state.mGradientColors == null) {
        // If we don't have a solid color and we don't have a gradient,
        // the app is stroking the shape, set the color to the default
        // value of state.mSolidColor
        mFillPaint.setColor(0);
    } else {
        // Otherwise, make sure the fill alpha is maxed out.
        mFillPaint.setColor(Color.BLACK);
    }
    mPadding = state.mPadding;
    if (state.mStrokeWidth >= 0) {
        mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mStrokePaint.setStyle(Paint.Style.STROKE);
        mStrokePaint.setStrokeWidth(state.mStrokeWidth);
        if (state.mStrokeColors != null) {
            final int[] currentState = getState();
            final int strokeStateColor = state.mStrokeColors.getColorForState(currentState, 0);
            mStrokePaint.setColor(strokeStateColor);
        }
        if (state.mStrokeDashWidth != 0.0f) {
            final DashPathEffect e = new DashPathEffect(new float[] { state.mStrokeDashWidth, state.mStrokeDashGap }, 0);
            mStrokePaint.setPathEffect(e);
        }
    }
    mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
    mGradientIsDirty = true;
    state.computeOpacity();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 45 with DashPathEffect

use of android.graphics.DashPathEffect in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChartNetworkSeriesView method setChartColor.

public void setChartColor(int stroke, int fill, int fillSecondary) {
    mPaintStroke = new Paint();
    mPaintStroke.setStrokeWidth(4.0f * getResources().getDisplayMetrics().density);
    mPaintStroke.setColor(stroke);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setAntiAlias(true);
    mPaintFill = new Paint();
    mPaintFill.setColor(fill);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setAntiAlias(true);
    mPaintFillSecondary = new Paint();
    mPaintFillSecondary.setColor(fillSecondary);
    mPaintFillSecondary.setStyle(Style.FILL);
    mPaintFillSecondary.setAntiAlias(true);
    mPaintEstimate = new Paint();
    mPaintEstimate.setStrokeWidth(3.0f);
    mPaintEstimate.setColor(fillSecondary);
    mPaintEstimate.setStyle(Style.STROKE);
    mPaintEstimate.setAntiAlias(true);
    mPaintEstimate.setPathEffect(new DashPathEffect(new float[] { 10, 10 }, 1));
}
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