Add support for 32 bit BGRA sprites.

This commit is contained in:
Paul Chote
2020-01-17 15:28:06 +00:00
committed by abcdefg30
parent cdbee49280
commit 1111ce4754
16 changed files with 122 additions and 29 deletions

View File

@@ -79,7 +79,17 @@ namespace OpenRA.Graphics
public Png AsPng()
{
return new Png(GetData(), Size.Width, Size.Height);
var data = GetData();
// Convert BGRA to RGBA
for (var i = 0; i < Size.Width * Size.Height; i++)
{
var temp = data[i * 4];
data[i * 4] = data[i * 4 + 2];
data[i * 4 + 2] = temp;
}
return new Png(data, Size.Width, Size.Height);
}
public Png AsPng(TextureChannel channel, IPalette pal)