Code example for PorterDuffColorFilter

0
        final Bitmap dest = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Config.ARGB_8888);
        Canvas c = new Canvas(dest);
        final Paint paint = new Paint();
 
        // Overlay the selected color and set the imageview 
        paint.setColorFilter(new PorterDuffColorFilter(overlayColor, PorterDuff.Mode.SRC_ATOP));
        c.drawBitmap(src, 0, 0, paint);
        return dest;
    } 
 
    /** 
     *  Decide whether to show the small Weather panel 
     */ 
    public static boolean showSmallWidget(Context context, int id, boolean digitalClock) {
        Bundle options = AppWidgetManager.getInstance(context).getAppWidgetOptions(id);
        if (options == null) {
            // no data to make the calculation, show the list anyway 
            return false; 
        } 
        Resources resources = context.getResources();
        int minHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);