Code example for PaintFlagsDrawFilter

0
    private static final Rect sOldBounds = new Rect();
    private static final Canvas sCanvas = new Canvas();
 
    static { 
        sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
                Paint.FILTER_BITMAP_FLAG));
    } 
    static int sColors[] = { 0xffff0000, 0xff00ff00, 0xff0000ff };
    static int sColorIndex = 0;
 
    /** 
     * Returns a bitmap suitable for the all apps view. Used to convert pre-ICS 
     * icon bitmaps that are stored in the database (which were 74x74 pixels at hdpi size) 
     * to the proper size (48dp) 
     */ 
    static Bitmap createIconBitmap(Bitmap icon, Context context) {
        int textureWidth = sIconTextureWidth;
        int textureHeight = sIconTextureHeight;
        int sourceWidth = icon.getWidth();
        int sourceHeight = icon.getHeight();
        if (sourceWidth > textureWidth && sourceHeight > textureHeight) {