Changing a color on a bitmap with Color matrix

OK, I know how to change red, blue, and green to other colors using a ColorMatrix, but how do go about using it to change black to white for example?

Let’s say I have a bitmap with a bunch of black dots on a mostly white background that also has some other colors on it. I do not want to touch the other colors, but I need to convert the black pixels to white but I cannot see how that can be done with the ColorMatrix.

Can it, and if so how? If not, how can you do this efficiently? I know that you can do a setPixel on a Bitmap, but it is horribly slow.

Thanks!

I’ve never heard of a ColorMatrix or Bitmap class in Java2D…

Black will always rotate to black.