I’ve got here 2 gifs, identical in every way, except the bitmask color is at index 0 in image B, and index 12 in image A.
Image B loads fine, Image A appears to load fine.
However, when I apply a rotation tranform to it during drawing, I get an ugly opaque band across the top few rows of the image ???
The color of the band is dependant on the color at palette entry 0 :S
And yes, I am absolutely positive it is not my code
here are the 2 images
Image a =
Image b =
and the results of rotating the 2 images (using the same code) :-
import java.awt.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import javax.swing.*;
public class GifTest extends JFrame
{
BufferedImage a,b;
public GifTest()
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
try
{
a = ImageIO.read(getClass().getResource("broken.gif"));
b = ImageIO.read(getClass().getResource("fixed.gif"));
}
catch(Exception e){}
}
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D)g;
AffineTransform af = AffineTransform.getRotateInstance(Math.PI/4, 50,50);
g2d.setTransform(af);
g2d.drawImage(a,50,50,null);
AffineTransform af2 = AffineTransform.getRotateInstance(Math.PI/4, 150,50);
g2d.setTransform(af2);
g2d.drawImage(b,150,50,null);
}
public static void main(String [] args)
{
GifTest gf = new GifTest();
gf.setBounds(50,50,300,300);
gf.show();
}
}