Problem with translucent images

I use some translucent images in my module (because this is how I want to “highlight” counters, instead of adding a color border, also I use a special shading image to show armies with reduced strength (that originally are single-sided counters) with arbitrary alpha values.

Unfortunately that doesn’t work when I zoom out the map.

I think it is because of code like this (maybe there are also other places like this):, line 231 (in trunk repository): // keep opaque destination for orthogonal rotation of an opaque source final BufferedImage trans = createCompatibleImage( tbox.width, tbox.height, src.getTransparency() == BufferedImage.OPAQUE && angle % 90.0 == 0.0 );
When src.getTransparency() is BufferedImage.TRANSLUCENT this produces a false value and the image is created with GraphicsUtilities.createCompatibleImage instead of GraphicsUtilities.createCompatibleTranslucentImage.

The third argument for createCompatibleImage is called transparent. I wonder why src.getTransparency() == BufferedImage.OPAQUE should be transparent while TRANSLUCENT and BITMASK not. I think something is the other way round it should be.

Thus spake “morvael”:

That’s a bug. The test is exactly backwards from what it should be. It’s
fixed now in the trunk and 3.1 branch.


Messages mailing list …

Post generated using Mail2Forum (