I was having a problem creating an image from a 2D color array. After some troubleshooting I think I narrowed it down to a bug. If I do the following:
SFML.Graphics.Color[,] imageColor = new SFML.Graphics.Color[256, 256];
for (int j = 0; j < imageColor.GetLength(0); j++)
{
for (int i = 0; i < imageColor.GetLength(1); i++)
{
imageColor[j, i] = new SFML.Graphics.Color((byte)i, (byte)j, 0);
}
}
SFML.Graphics.Image image= new SFML.Graphics.Image(imageColor);
Texture texture = new Texture(image);
Sprite sprite = new Sprite(texture);
app.Draw(sprite);
app.Display();
I get a nice square image with the red color increasing in the X direction and the green color increasing in Y. But if I change the array dimension so that it is not square the image is no longer drawn correctly.
It seems like the image constructor is mixing up the dimensions, when the array is not square it sets X size equal to dimension(0) and Y size equal to dimension(1). This should be the opposite correct? The data seems to be copied correctly, but because the width and height are wrong the image is not drawn right.
The code above was from the 2.0 RC but 1.6 seems to have the same behavior. Am I doing something wrong here or is this really a bug?