FileDocCategorySizeDatePackage
PorterDuffColorFilter.javaAPI DocAndroid 5.1 API3445Thu Mar 12 22:22:30 GMT 2015android.graphics

PorterDuffColorFilter

public class PorterDuffColorFilter extends ColorFilter
A color filter that can be used to tint the source pixels using a single color and a specific {@link PorterDuff Porter-Duff composite mode}.

Fields Summary
private int
mColor
private PorterDuff.Mode
mMode
Constructors Summary
public PorterDuffColorFilter(int color, PorterDuff.Mode mode)
Create a color filter that uses the specified color and Porter-Duff mode.

param
color The ARGB source color used with the specified Porter-Duff mode
param
mode The porter-duff mode that is applied
see
Color
see
#setColor(int)
see
#setMode(android.graphics.PorterDuff.Mode)

        mColor = color;
        mMode = mode;
        update();
    
Methods Summary
public booleanequals(java.lang.Object object)

        if (this == object) {
            return true;
        }
        if (object == null || getClass() != object.getClass()) {
            return false;
        }
        final PorterDuffColorFilter other = (PorterDuffColorFilter) object;
        if (mColor != other.mColor || mMode != other.mMode) {
            return false;
        }
        return true;
    
public intgetColor()
Returns the ARGB color used to tint the source pixels when this filter is applied.

see
Color
see
#setColor(int)
hide

        return mColor;
    
public PorterDuff.ModegetMode()
Returns the Porter-Duff mode used to composite this color filter's color with the source pixel when this filter is applied.

see
PorterDuff
see
#setMode(android.graphics.PorterDuff.Mode)
hide

        return mMode;
    
public inthashCode()

        return 31 *  mMode.hashCode() + mColor;
    
private static native longnative_CreatePorterDuffFilter(int srcColor, int porterDuffMode)

public voidsetColor(int color)
Specifies the color to tint the source pixels with when this color filter is applied.

param
color An ARGB {@link Color color}
see
Color
see
#getColor()
see
#getMode()
hide

        mColor = color;
        update();
    
public voidsetMode(PorterDuff.Mode mode)
Specifies the Porter-Duff mode to use when compositing this color filter's color with the source pixel at draw time.

see
PorterDuff
see
#getMode()
see
#getColor()
hide

        mMode = mode;
        update();
    
private voidupdate()

        destroyFilter(native_instance);
        native_instance = native_CreatePorterDuffFilter(mColor, mMode.nativeInt);