Merge commit 'alzeih/master'

This commit is contained in:
Chris Forbes
2010-01-04 00:45:28 +13:00
3 changed files with 30 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Drawing;
namespace OpenRa.Game.Graphics
{
@@ -111,5 +112,19 @@ namespace OpenRa.Game.Graphics
bitmap.UnlockBits(bits);
}
}
public static Color Lerp(float t, Color a, Color b)
{
return Color.FromArgb(
LerpChannel(t, a.A, b.A),
LerpChannel(t, a.R, b.R),
LerpChannel(t, a.G, b.G),
LerpChannel(t, a.B, b.B));
}
public static int LerpChannel(float t, int a, int b)
{
return (int)((1 - t) * a + t * b);
}
}
}