I'm trying to figure out how to read pixel data from a BufferedImage (sprite sheet for example) and render it on screen. The main issue is how to associate the color data with coordinates so that I can do collision detection and what not. What is the standard method of reading pixel data and displaying it on screen?

EDIT:Let's start with just reading the pixel data from a BufferedImage (for all intents and purposes we will say everything not transparent for now) and then rendering it onto another BufferedImage at a specified x,y coordinate. Can anyone show me how to do that through manipulation of the Raster and/or setRGB() methods?

You don't need to access the pixel data to draw a BufferedImage to the screen. Just pass the BufferedImage to Graphics.drawImage, and it will draw it. If you want to access the pixel data for collision detection, use the BufferedImage.getRGB method

I know about Graphics.drawImage. The issue with that is using rectangles as collision bounds is clunky and unappealing. I want to set the ARGB values for one BufferedImage to the canvas BufferedImage at their respective coordinates on screen.

I think this code demonstrates what you're asking for. I'm not saying this is the best way to do collision detection. I'm just trying to help answer your question.

Explanation: Notice that the red, green, blue values are not used here (just for demonstration). The alphaThreshold is arbitrary [0..255]. If using bitmask transparency, then just set this to zero. If using translucent transparency (for example, if your graphics have anti-aliased edges), setting this higher will avoid collision detection on very transparent parts. The meaning of add to collision matrix is whatever data structure you want to keep for the collision detection. (My original method actually constructs a rectangular bounding box for every non-transparent pixel in the image, but I edited that out for demonstration, and because you're asking about per-pixel transparency detection.)

Yes but the collision has to be done using the image bounds. Circle v. Circle isn't supported in default Java, and would require some heavy math calculations to find intersection points, possibly damaging performance.

Based off of reading your discussion so far, I'm going to ask this question: does Java have a built in convenience method for returning the rectangle formed by two rectangles intersecting? If not, I'm sure we can figure out a way to do so fairly easily...

...I'm going to ask this question: does Java have a built in convenience method for returning the rectangle formed by two rectangles intersecting? If not, I'm sure we can figure out a way to do so fairly easily...

Refer to the Javadocs for java.awt.Rectangle. Have a look at Rectangle.add(..) and Rectangle.intersects(..)

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org