09-06-2012 12:46 PM
I have a set of icons which are all white with a transparent background. I need to allow the user to change the color of these within the app. Does anyone know of a way to do this?
Solved! Go to Solution.
09-06-2012 02:57 PM
I have never actually done this, but I believe if you have the Bitmap, then you can do this by using get and set ARGB.
In essence, you convert the Bitmap to a int array using getARGB(). The int array values contain the pixel color value in the form 0xaarrggbb, where a is the alpha value, rr is the red, bb is the blue and gg is the green. Because your pixels are all white, all the int values that are white will be 0xaaFFFFFF. So you will extract the int values, replace the FFFFFF (leaving the aa) with the color you want, leave any pixels that are not FFFFFF as they are and then put the int values back using setARGB().
Give this a try and let us know how you get on.