Code example for PaintFlagsDrawFilter

0
 
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0.2f);
 
        mCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
                Paint.FILTER_BITMAP_FLAG));
    } 
 
    public Drawable createIconDrawable(Drawable src) {
        Bitmap scaled = createIconBitmap(src);
 
        StateListDrawable result = new StateListDrawable();
 
        result.addState(new int[] { android.R.attr.state_focused },
                new BitmapDrawable(createSelectedBitmap(scaled, false)));
        result.addState(new int[] { android.R.attr.state_pressed },
                new BitmapDrawable(createSelectedBitmap(scaled, true)));
        result.addState(new int[0], new BitmapDrawable(scaled));
 
        result.setBounds(0, 0, mIconTextureWidth, mIconTextureHeight);
Stop searching for code, let great code find you!  Add Codota to your java IDE