Obtain pixel from Image(Slick2D)

Using image.getColor is afaik performance killer. Is there any other options? Take note that this option should be compatible with rotated images.

Have you tried just doing what you suggested? I can’t see why it should be a bottleneck. It looks like it’s just a few calls to the pixel-array, and that operation is usually extremely fast.

EDIT: My bad.

getColor is indeed a performance killer, as it involves copying data from the GPU to CPU. Once cached, this isn’t so bad, but if you are doing things like rendering to offscreen graphics, the data will be flushed and will need to be re-copied every frame. And it won’t work with rotated images.

What are you trying to achieve? Maybe you need shaders.

I am trying to create a fast pixel-perfect function. The only thing making it ineffective is grabbing the pixels from the Image.
I have made a piss solution, by associating every image with an int[][] array(that represent all the pixels in the image). This array is initiated at loading screen. The results performance wise is fantastic. But it turns my code into a mess, killing the readability. And its not working with rotation.

Using image data for pixel-perfect collision only works when you aren’t changing the image (i.e. scaling or rotating it).

If you are really set on pixel-perfect, some occlusion queries may be a possibility. Instead for your purposes you should be using polygons. Here is a good book on the subject.