B
Barry Parker
Within a java applet, so basically on a graphics object, I have various
different shapes. The shapes are a different colour to the background. The
number and location of the shapes will be unknown till compile time.
What I basically think I need to do is, given the cursor position, determine
if the pixel it currently resides on is blue or white. I have tried all
sorts of things but I'm getting nowhere. Simple commands such as getColor()
aren't having any of it.
Its been necessary to make a copy of the graphics object to use within my
MouseListener as it doesn't appear to allow me to pass the graphics object
from the paint method to the listener (this could be a problem: for a
Graphics object called g from within my paint method, I have copied it to
another Graphics object, h, by using h=g.create() From here, what I
have done is created a 'Clip Area' of 1 pixel by 1 pixel at the current
point which returns a rectangle. Is there any way of getting the colour of a
rectangle?
If anyone has any suggestions, it would be much appreciated as I'm pulling
my hair out over something simple.
Cheers, Baz
different shapes. The shapes are a different colour to the background. The
number and location of the shapes will be unknown till compile time.
What I basically think I need to do is, given the cursor position, determine
if the pixel it currently resides on is blue or white. I have tried all
sorts of things but I'm getting nowhere. Simple commands such as getColor()
aren't having any of it.
Its been necessary to make a copy of the graphics object to use within my
MouseListener as it doesn't appear to allow me to pass the graphics object
from the paint method to the listener (this could be a problem: for a
Graphics object called g from within my paint method, I have copied it to
another Graphics object, h, by using h=g.create() From here, what I
have done is created a 'Clip Area' of 1 pixel by 1 pixel at the current
point which returns a rectangle. Is there any way of getting the colour of a
rectangle?
If anyone has any suggestions, it would be much appreciated as I'm pulling
my hair out over something simple.
Cheers, Baz