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);
}
}
}
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);
}
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();
}
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();
}
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));
}
Aggregations