Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.LightingColorFilter; import android.graphics.Paint; public class Main { /** * ATTENTION: DON'T USE THIS METHOD BECAUSE IT HAS BAD PERFORMANCES. * * @param source The original Bitmap. * @param color Color to overlay. * @return the result image. */ @Deprecated private static Bitmap overlayColor(Bitmap source, int color) { Bitmap newBitmap = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight()); Bitmap mutableBitmap = newBitmap.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(mutableBitmap); Paint paint = new Paint(); paint.setAntiAlias(true); ColorFilter filter = new LightingColorFilter(color, 1); paint.setColorFilter(filter); canvas.drawBitmap(mutableBitmap, 0, 0, paint); return mutableBitmap; } }