Reputation: 1573
I am making some kind of image filter, and I need to desaturate (remove saturation) for a specific color. For example red. I want my image to replace all red colors with gray.
Change this image
Any idea?
Upvotes: 0
Views: 793
Reputation: 424
It's say there http://developer.android.com/reference/android/graphics/ColorMatrixColorFilter.html that ColorMatrixColorFilter can be used to change saturation of pixel. But you have to play with math and ColorMatrix
Is that what you're researching ?
Edit : There is not such thing in Android standard library. Filter are written in NDK for performance issue, so you'll need to do the same for a custom filter.
Another idea without thinking of performance is : loop through all pixels and desaturate when it's "red"
Upvotes: 0
Reputation: 5016
I think you can use OR login to add a "filter" to your color RGB or ARGB
int filter = 0x00CC0000 | color;
myView.setBackgroundColor(filter);
Upvotes: 0