Java Code Examples for android.graphics.Paint#getColorFilter()
The following examples show how to use
android.graphics.Paint#getColorFilter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YcRoundRectDrawable.java From CardViewShadowColor with Apache License 2.0 | 6 votes |
@Override public void draw(Canvas canvas) { final Paint paint = mPaint; final boolean clearColorFilter; if (mTintFilter != null && paint.getColorFilter() == null) { paint.setColorFilter(mTintFilter); clearColorFilter = true; } else { clearColorFilter = false; } canvas.drawRoundRect(mBoundsF, mRadius, mRadius, paint); if (clearColorFilter) { paint.setColorFilter(null); } }
Example 2
Source File: RoundRectDrawable.java From OptionRoundCardview with Apache License 2.0 | 6 votes |
@Override public void draw(Canvas canvas) { final Paint paint = mPaint; final boolean clearColorFilter; if (mTintFilter != null && paint.getColorFilter() == null) { paint.setColorFilter(mTintFilter); clearColorFilter = true; } else { clearColorFilter = false; } canvas.drawRoundRect(mBoundsF, mRadius, mRadius, paint); if (clearColorFilter) { paint.setColorFilter(null); } }
Example 3
Source File: LoadingDrawable.java From Genius-Android with Apache License 2.0 | 6 votes |
@Override public void setColorFilter(ColorFilter cf) { boolean needRefresh = false; final Paint bPaint = mBackgroundPaint; if (bPaint.getColorFilter() != cf) { bPaint.setColorFilter(cf); needRefresh = true; } final Paint fPaint = mForegroundPaint; if (fPaint.getColorFilter() != cf) { fPaint.setColorFilter(cf); needRefresh = true; } if (needRefresh) invalidateSelf(); }
Example 4
Source File: StatePaintDrawable.java From Genius-Android with Apache License 2.0 | 6 votes |
@Override public void draw(Canvas canvas) { final Paint paint = mPaint; final int prevAlpha = paint.getAlpha(); paint.setAlpha(Ui.modulateAlpha(prevAlpha, getAlpha())); // only draw shape if it may affect output if (paint.getAlpha() != 0 || paint.getXfermode() != null /*|| paint.hasShadowLayer()*/) { final boolean clearColorFilter; if (mTintFilter != null && paint.getColorFilter() == null) { paint.setColorFilter(mTintFilter); clearColorFilter = true; } else { clearColorFilter = false; } // call draw draw(canvas, mPaint); if (clearColorFilter) { paint.setColorFilter(null); } } // restore paint.setAlpha(prevAlpha); }
Example 5
Source File: CircleCheckDrawable.java From Genius-Android with Apache License 2.0 | 6 votes |
@Override public void setColorFilter(ColorFilter cf) { final Paint circlePaint = mCirclePaint; final Paint ringPaint = mRingPaint; boolean needRefresh = false; if (circlePaint != null && circlePaint.getColorFilter() != cf) { circlePaint.setColorFilter(cf); needRefresh = true; } if (ringPaint != null && ringPaint.getColorFilter() != cf) { ringPaint.setColorFilter(cf); needRefresh = true; } if (needRefresh) invalidateSelf(); }
Example 6
Source File: TintedBitmapDrawable.java From droidddle with Apache License 2.0 | 5 votes |
@Override public void draw(final Canvas canvas) { final Paint paint = getPaint(); if (paint.getColorFilter() == null) { paint.setColorFilter(new LightingColorFilter(tint, 0)); paint.setAlpha(alpha); } super.draw(canvas); }
Example 7
Source File: TintedBitmapDrawable.java From ChatMessageView with Apache License 2.0 | 5 votes |
@Override public void draw(final Canvas canvas) { final Paint paint = getPaint(); if (paint.getColorFilter() == null) { paint.setColorFilter(new LightingColorFilter(tint, 0)); paint.setAlpha(alpha); } super.draw(canvas); }
Example 8
Source File: StatePaintDrawable.java From Genius-Android with Apache License 2.0 | 5 votes |
@Override public void setColorFilter(ColorFilter cf) { final Paint paint = mPaint; if (paint != null && paint.getColorFilter() != cf) { paint.setColorFilter(cf); invalidateSelf(); } }