Use premultiplied alpha for all textures and blending.

This commit is contained in:
Paul Chote
2015-05-16 17:49:17 +01:00
parent 78f1e9fb2f
commit 26fd858fc7
16 changed files with 153 additions and 40 deletions

View File

@@ -49,15 +49,9 @@ namespace OpenRA.Graphics
using (var bitmap = (Bitmap)Image.FromStream(stream))
{
Size = bitmap.Size;
data = new byte[4 * Size.Width * Size.Height];
var dataStride = 4 * Size.Width;
data = new byte[dataStride * Size.Height];
var bd = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
for (var y = 0; y < Size.Height; y++)
Marshal.Copy(IntPtr.Add(bd.Scan0, y * bd.Stride), data, y * dataStride, dataStride);
bitmap.UnlockBits(bd);
Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
}
ReleaseBuffer();