Transparency

Help!

I am currently writing my first game, and it is coming along (kinda) nicely. I have some of the important physics in place, but I haven’t dealt with collisions or nice level creation.

Anyway, it is a gravity game, where you place a ship with a big thruster on the back, and you have to fly around doing things. Things include deathmatch (hopefully), racing and CTF with other human opponents. That is going to come later, I need to get the basics working first. Anyway, my ship is just a filled GeneralPath onto a BufferedImage. The buffered image supports Transparency.BITMASK, but when this is turned on, anti-aliasing won’t work, and the ship just looks like a jagged mess!

Does anyone know how I can get the transparency to work, but still allow me to anti-alias the image?

Thanks in advance,

Stu

It is okay, I have figured it out, I just used the SrcOut AlphaComposite rule and it worked! Anyone know where I can find detailed information about all of the JDK classes involving image operations, ie rasters, transparency, affine transforms, because I don’t really know what I am doing as far as that goes :frowning:

Stu

[quote]Help!

I am currently writing my first game, and it is coming along (kinda) nicely. I have some of the important physics in place, but I haven’t dealt with collisions or nice level creation.

Anyway, it is a gravity game, where you place a ship with a big thruster on the back, and you have to fly around doing things. Things include deathmatch (hopefully), racing and CTF with other human opponents. That is going to come later, I need to get the basics working first. Anyway, my ship is just a filled GeneralPath onto a BufferedImage. The buffered image supports Transparency.BITMASK, but when this is turned on, anti-aliasing won’t work, and the ship just looks like a jagged mess!

Does anyone know how I can get the transparency to work, but still allow me to anti-alias the image?

Thanks in advance,

Stu
[/quote]
new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);

will give you an image that has a full alpha channel, not just a bitmask.