I need to be able to read images with their colour palette information. For example I will be loading in 4-colour bitmaps and gif’s and need to (for example) treat colour 0 in the colour-table as transparent. I could just directly read the bitmaps, but I just wanted to know if the general methods do it, like readImage
System.out.println(ImageIO.read("".getClass().getResourceAsStream(palettizedPngName)).getType());
Will give you your answer; which btw is a yes. (atleast in the Sun impl.)
You can then do all the hacking you want via the images IndexColorModel object.
Ah great!
Hence off the ImageIO reading process you’d be interested in changing the alpha value with different types of images. Notice that RenderedImage only do respect alpha transparency; this includes BufferedImage as well.
BTW it is much easier to make transparent Images with an external Image processing Tool like the GIMP and afterwards you load the picture with BufferedImage classes and ARGB types. That avoids to manipulate pixels-data, a.k.a Rasters. 8)
For what I’m doing you would want to be able to read indexed pixels! I’m basically emulating the Gameboy hardware features to be able to create similar palette effects along with other GBA graphic hardware emulations. You can pretty much copy and paste GBA mode 7 code and make it work with my API with minor adjustments.
Oh, I’m fine with ARGB pixels (when I first started using graphics is was mode 0x13, interrupt 10h I think at address 0xA000) It’s just that I wanted to do some Game Boy Advance related things.