Code example for PaintFlagsDrawFilter

0
    private static final Rect sOldBounds = new Rect();
    private static Canvas sCanvas = new Canvas();
 
    static { 
        sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
                Paint.FILTER_BITMAP_FLAG));
    } 
 
    /** 
     * Returns a Drawable representing the thumbnail of the specified Drawable. 
     * The size of the thumbnail is defined by the dimension 
     * android.R.dimen.launcher_application_icon_size. 
     * 
     * This method is not thread-safe and should be invoked on the UI thread only. 
     * 
     * @param icon The icon to get a thumbnail of. 
     * @param context The application's context. 
     * 
     * @return A thumbnail for the specified icon or the icon itself if the 
     *         thumbnail could not be created.  
     */