BufferedImage and pixels color flipping
- From: "placid" <Bulkan@xxxxxxxxx>
- Date: 2 Jan 2006 20:47:55 -0800
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
.
- Follow-Ups:
- Re: BufferedImage and pixels color flipping
- From: hiwa
- Re: BufferedImage and pixels color flipping
- Prev by Date: Toronto Canada - Senior Java Developer/Architect -Full time position
- Next by Date: JTabbedPane ChangeListener
- Previous by thread: Toronto Canada - Senior Java Developer/Architect -Full time position
- Next by thread: Re: BufferedImage and pixels color flipping
- Index(es):
Relevant Pages
|