Retrieving Pixel Data from an image

Is there away of retrieving pixel data from an image without having to store in it array using pixelgrabber?i need to constantly check the color of a certain pixel on an image (which is constantly being updated) and using pixelgrabber slows the whole provess down.
[278 byte] By [ptom98a] at [2007-9-28 7:05:43]
# 1
If it's updated constantly, can I assume that it is a BufferedImage? If it is, a quick peek at the JavaDocs produces the getRGB(int x, int y) method.See http://java.sun.com/j2se/1.4/docs/api/java/awt/image/BufferedImage.html
jbanesa at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 2
no its just a normal image file, is there a way of converting it?
ptom98a at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 3
Depends. What's updating the image?
jbanesa at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 4

well i seem to have used the grabpixel to grab the pixels that i wanna check, but to say that there is some slow down would be an understatement, the game barely crawls!!

there must be a quicker way (bearing in mind im only using the pixel grabber to only grab pixels) of doing this, because the slow down is terrible!! - oh and it has to work with the microsoft virtual machine, not suns official virtual machine

ptom98a at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 5
ah, now thats a BIG problem, the M$ VM is <Java1.2,so you won't have any useful classes (such as BufferedImage)How are you using PixelGrabber?>
Abusea at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 6

heres the code that uses pixelgrabber, as you can see its only checking 3 pixels, but the slow down is so high, its unplayable

int return_value=0;

PixelGrabber pg=new PixelGrabber(offscreen,ball_X+15,ball_Y+33,3,1,pixels,0,3);

try{

pg.grabPixels();

}catch(InterruptedException e){}

test=createImage(new MemoryImageSource(3,1,pixels,0,3));

/*CHECK TO SEE IF BALL IS STALL ON THE PLAY AREA

*0=dead

*1=safe

*2=slow down

*3=speed up

*4=jump

*5=reverse

*6=finsih */

switch(pixels[0]){

//safe

case 0xff808080: return_value=1; break;

case 0xffc0c0c0: return_value=1; break;

//slow down

case 0xff800080: return 2;

case 0xffff00ff: return 2;

//speed up

case 0xff800000: return 3;

case 0xffff0000: return 3;

//jump

case 0xff000080: return 4;

case 0xff0000ff: return 4;

//reverse

case 0xff808000: return 5;

case 0xffffff00: return 5;

//finish

case 0xff008000: return 6;

case 0xff00ff00: return 6;

}

switch(pixels[2]){

//safe

case 0xff808080: return 1;

case 0xffc0c0c0: return 1;

//slow down

case 0xff800080: return 2;

case 0xffff00ff: return 2;

//speed up

case 0xff800000: return 3;

case 0xffff0000: return 3;

//jump

case 0xff000080: return 4;

case 0xff0000ff: return 4;

//reverse

case 0xff808000: return 5;

case 0xffffff00: return 5;

//finish

case 0xff008000: return 6;

case 0xff00ff00: return 6;

}

return return_value;

yeah, so its a bit of a ****** cos its JUST SO GOD **** SLOW!! (sorry i know i keep repeating myself, but its really fu***** me off!)

ptom98a at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 7
Hey i wouldn't use pixel data to for collision detection.Mabye instead try using a [][] of MapCells.public int ballOverType(){MapCell cell = cells[ball.x/cellSize][ball.y/cellSize];return cell.getType();}Harley.
harleyranaa at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...
# 8
> test=createImage(new MemoryImageSource(3,1,pixels,0,3));Is that for debugging purposes?
Kayamana at 2007-7-9 18:16:15 > top of Java-index,Other Topics,Java Game Development...