In most graphic programs like Photoshop and Gimp there is a colorize function so you can easily color a gray scale image with a color of your choice. I want to do the same thing with an image in my Android application. I have been looking into the setColorFilter function. This is what I tried.
ImageView border = (ImageView) findViewById(R.id.imageView);
int color = Color.parseColor("#F57F17"); // the color to use
border.setColorFilter(color, PorterDuff.Mode.OVERLAY);
This does exactly what I need. The only problem is that it also colors the transparent areas in the image. I want the transparent areas to stay transparent.
Is there any way to achieve this?
You are looking for SRC_ATOP: