Hi there
Some time ago I made a little test. I wanted to develop a simple 2d game, birds eye perspective, easy tiles. But I wanted to have fog so that distant tiles would fade to gray, or black in night. So i had a tile for grass and a tile in gray, and I wanted to first draw the tile and then draw the gray over that one with Alpha / Transparency of 20%, 40%, etc.
It was slow as …
As alternative i tried to precomputed all fog tiles and so I had several versions of each tile, with 20%, 40%, … of fog overlay. These images were allwithout transparency and they were fast.
I researched a little and ended up with all the best I could find, like the createCompatibleImage to get a matching image type, which addes some speed. Bitmask transparency was no problem, its just show pixel or dont show pixel. But all Alpha alternatives I tried were slow.
I tried AlphaComposite, I tried PNG files with Alpha, I tried ARGB BufferedImage. Always slow.
For some reason I want to stick to 2d right now. I am not able to learn 3d stuff in the moment, but I will do so somewhen, there seems to be no other way.
My question is, when I develop a game with Java 2d, is there a way to get fast transparency? Else I will have to use opaque and bitmasked images and precomputed / pregenerated transparencies.
-JAW