public abstract class BasePaintDrawable
extends android.graphics.drawable.Drawable
| Modifier and Type | Field and Description |
|---|---|
protected int |
mAlpha |
protected android.graphics.ColorFilter |
mColorFilter |
protected android.graphics.PorterDuffColorFilter |
mTintFilter |
protected android.content.res.ColorStateList |
mTintList |
protected android.graphics.PorterDuff.Mode |
mTintMode |
| Constructor and Description |
|---|
BasePaintDrawable() |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(android.graphics.Canvas canvas) |
int |
getAlpha() |
android.graphics.ColorFilter |
getColorFilter() |
protected android.graphics.ColorFilter |
getColorFilterForDrawing() |
android.graphics.drawable.Drawable.ConstantState |
getConstantState() |
int |
getOpacity() |
boolean |
isStateful() |
protected void |
onDraw(android.graphics.Canvas canvas,
int width,
int height) |
protected abstract void |
onDraw(android.graphics.Canvas canvas,
int width,
int height,
android.graphics.Paint paint) |
protected abstract void |
onPreparePaint(android.graphics.Paint paint) |
protected boolean |
onStateChange(int[] state) |
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter colorFilter) |
void |
setTint(int tintColor)
Specifies tint color for this drawable.
|
void |
setTintList(android.content.res.ColorStateList tint)
Specifies tint color for this drawable as a color state list.
|
void |
setTintMode(android.graphics.PorterDuff.Mode tintMode)
Specifies a tint blending mode for this drawable.
|
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getCurrent, getDirtyBounds, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setVisible, unscheduleSelfprotected int mAlpha
protected android.graphics.ColorFilter mColorFilter
protected android.content.res.ColorStateList mTintList
protected android.graphics.PorterDuff.Mode mTintMode
protected android.graphics.PorterDuffColorFilter mTintFilter
protected final void onDraw(android.graphics.Canvas canvas,
int width,
int height)
protected abstract void onPreparePaint(android.graphics.Paint paint)
protected abstract void onDraw(android.graphics.Canvas canvas,
int width,
int height,
android.graphics.Paint paint)
public int getAlpha()
getAlpha in class android.graphics.drawable.Drawablepublic void setAlpha(int alpha)
setAlpha in class android.graphics.drawable.Drawablepublic android.graphics.ColorFilter getColorFilter()
getColorFilter in class android.graphics.drawable.Drawablepublic void setColorFilter(@Nullable
android.graphics.ColorFilter colorFilter)
setColorFilter in class android.graphics.drawable.Drawablepublic void setTint(int tintColor)
A Drawable's drawing content will be blended together with its tint
before it is drawn to the screen. This functions similarly to
Drawable.setColorFilter(int, PorterDuff.Mode).
To clear the tint, pass null to
TintableDrawable.setTintList(ColorStateList).
Note: Setting a color filter via
Drawable.setColorFilter(ColorFilter) or
Drawable.setColorFilter(int, PorterDuff.Mode) overrides tint.
setTint in interface TintableDrawablesetTint in class android.graphics.drawable.DrawabletintColor - Color to use for tinting this drawableTintableDrawable.setTintList(ColorStateList),
TintableDrawable.setTintMode(PorterDuff.Mode)public void setTintList(@Nullable
android.content.res.ColorStateList tint)
A Drawable's drawing content will be blended together with its tint
before it is drawn to the screen. This functions similarly to
Drawable.setColorFilter(int, PorterDuff.Mode).
Note: Setting a color filter via
Drawable.setColorFilter(ColorFilter) or
Drawable.setColorFilter(int, PorterDuff.Mode) overrides tint.
setTintList in interface TintableDrawablesetTintList in class android.graphics.drawable.Drawabletint - Color state list to use for tinting this drawable, or
null to clear the tintTintableDrawable.setTint(int),
TintableDrawable.setTintMode(PorterDuff.Mode)public void setTintMode(@NonNull
android.graphics.PorterDuff.Mode tintMode)
Defines how this drawable's tint color should be blended into the drawable
before it is drawn to screen. Default tint mode is PorterDuff.Mode#SRC_IN.
Note: Setting a color filter via
Drawable.setColorFilter(ColorFilter) or
Drawable.setColorFilter(int, PorterDuff.Mode) overrides tint.
setTintMode in interface TintableDrawablesetTintMode in class android.graphics.drawable.DrawabletintMode - A Porter-Duff blending modeTintableDrawable.setTint(int),
TintableDrawable.setTintList(ColorStateList)public boolean isStateful()
isStateful in class android.graphics.drawable.Drawableprotected boolean onStateChange(int[] state)
onStateChange in class android.graphics.drawable.Drawablepublic int getOpacity()
getOpacity in class android.graphics.drawable.Drawablepublic void draw(android.graphics.Canvas canvas)
draw in class android.graphics.drawable.Drawableprotected android.graphics.ColorFilter getColorFilterForDrawing()
public android.graphics.drawable.Drawable.ConstantState getConstantState()
getConstantState in class android.graphics.drawable.Drawable