BufferedImage and pixels color flipping



Hi all,

I was just wondering i want to be able to get a color rgb value of a
pixel at x,y then create another Color object (or int) that is the
opposite it, then paint a circle with the opposite color. Here is the
code i have so far

public class MyPanel extends JPanel
{

public void paint(Graphics g)
{
super.paint(g);
int color = mImage.getRGB(curX,curY);
ColorModel cm = mImage.getColorModel();

//get the Individual colors
Integer red = new Integer(cm.getRed(color));
Integer green = new Integer(cm.getGreen(color));
Integer blue = new Integer(cm.getBlue(color));

//see im stuck here how do i get the opposite of the color

//Color c = new
Color((int)red.reverse(color),(int)green.reverse(color) ,
(int)blue.reverse(color));

g.setColor(c);
g.fillOval(poi.getX(), poi.getY(), 5, 5);
}
}
}

Thanks in advance

.