Adih
asked on
code for displaying an image and identifying clicks on it
hi.
i need - URGENTLY - a specific code for displaying an image and mapping a click on it.
i need to diaplay teh image on screen, identify the clicks of the user upon it, and map the location of the click (pixel?coordinates?ideas?) .
the more specific the code the better.
thanks for your help, Adih
i need - URGENTLY - a specific code for displaying an image and mapping a click on it.
i need to diaplay teh image on screen, identify the clicks of the user upon it, and map the location of the click (pixel?coordinates?ideas?)
the more specific the code the better.
thanks for your help, Adih
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
eattrig:
i used the code given and accessed the gif and retreived the coordinates required, now-
I NEED TO GET THE VALUE OF A PIXEL FROM ANOTHER GIF AT THOSE COORDINATES.
please issue a code to do that and the A grade of 300 pts is yours.
i used the code given and accessed the gif and retreived the coordinates required, now-
I NEED TO GET THE VALUE OF A PIXEL FROM ANOTHER GIF AT THOSE COORDINATES.
please issue a code to do that and the A grade of 300 pts is yours.
what type of information do you need to get from the other bitmap?
ASKER
each pixel at the gif is colored in a specific value.
i need to extract that value.
if a user clicked on the map at (12,34) i need to retreive the color of the pixel at those coordinates at the other gif.
adih
i need to extract that value.
if a user clicked on the map at (12,34) i need to retreive the color of the pixel at those coordinates at the other gif.
adih
You need to use the PixelGrabber class to extract the pixel values. Let me know if you need some help with it.
ASKER
i never used that class and this is VERY urgent, so i would appreciate some specific code on extracting the pixel value at a apecific (x,y) coordinates.
the question is not so hard, but since it is URGENT i gave it 300 pts!
please be quick with the answer, and u shall be rewarded.
adi.
the question is not so hard, but since it is URGENT i gave it 300 pts!
please be quick with the answer, and u shall be rewarded.
adi.
adi,
I'm just about to knock off for the day but here goes:
i is the image
w is the image width
x,y is the location of the pixel of interest
int pixels[] = new int[1];
PixelGrabber pg = new PixelGrabber(i, x, y, 1, 1, pixels, 0, w);
pg.grabPixels();
if ((pg.getStatus() & ImageObserver.ABORT) == 0)
{
// The value of the pixel should now be in pixels[0]
}
You can use this to grab any rectangular region out of the image, placing the pixel data into the pixels array.
Sorry I can't hang around to help you further but you should be right. Check the javadoc for PixelGrabber if you're confused about anything. ANd I think it's also covered in Sun's Java tutorial.
I'll check how you went in the morning.
I'm just about to knock off for the day but here goes:
i is the image
w is the image width
x,y is the location of the pixel of interest
int pixels[] = new int[1];
PixelGrabber pg = new PixelGrabber(i, x, y, 1, 1, pixels, 0, w);
pg.grabPixels();
if ((pg.getStatus() & ImageObserver.ABORT) == 0)
{
// The value of the pixel should now be in pixels[0]
}
You can use this to grab any rectangular region out of the image, placing the pixel data into the pixels array.
Sorry I can't hang around to help you further but you should be right. Check the javadoc for PixelGrabber if you're confused about anything. ANd I think it's also covered in Sun's Java tutorial.
I'll check how you went in the morning.
I have reduce to points to 150 to enable a split.
teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchan ge.com
teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchan
ASKER
thanks guys.
with ur answers combined i managed to solve the prob.
150 pts for eattrig - grade A
150 pts for objects will be awarded in a new 150 pts question:
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=java&qid=20132788
thank u, Adih
with ur answers combined i managed to solve the prob.
150 pts for eattrig - grade A
150 pts for objects will be awarded in a new 150 pts question:
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=java&qid=20132788
thank u, Adih
ASKER
maybe i didnt explain myself.
i need to MAP the clicks.
i need to turn to the same spot on another bitmap to retreive information.
the coordinate system can work if i knew how to access the bitmap using it.
Adih