I am developing an android application for hair style salon.I am having two images. One is hairstyle (hair) and another is hair color pattern. I am able to change the color of hair style based on specific rgb value.
My code is as below:
int color = Color.rgb(182,132, 84); // getting rgb value
Paint paint = new Paint();
paint.setColorFilter(new LightingColorFilter(color, 1));
transform.reset();
transform.postTranslate(-width / 2.0f, -height / 2.0f);
transform.postRotate(getDegreesFromRadians(angle));
transform.postScale(scale, scale);
transform.postTranslate(position.getX(), position.getY());
canvas.drawBitmap(bitmap, transform, paint);
But what the solution i am searching that suppose i have color pattern image then its not possible to get rgb value from gradient image.
Like:


I want to apply the above pattern on hair image. If anyone have idea please reply.
Just for fun, and curiosity, I tried to make my own implementation of your idea.
After preparing the two following xxhdpi images (480 dpi, so to make them scale well - then I put them in the
/res/drawable-xxhdpifolder)Of course, I had to carefully size the images to fit and overlap perfectly.
I made this layout, in which the hair image overlaps the head:
Here's the code I used:
And some of the results I got:
Even if this composition seems like an Andy Wharol's picture, it isn't. It's mine. :)
It seems like the result you are looking for.
[EDIT]
I didn't try this new idea, but (with some extra work) you can even change other colors: