Rewrite color inversal in a reusable way

This commit is contained in:
Oliver Brakmann
2016-08-26 22:06:10 +02:00
parent d0109491a7
commit 8ad18ad161
3 changed files with 20 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Widgets;
using SharpFont;
namespace OpenRA.Graphics
@@ -93,6 +94,11 @@ namespace OpenRA.Graphics
DrawText(text, location, fg);
}
public void DrawTextWithContrast(string text, float2 location, Color fg, Color bgDark, Color bgLight, int offset)
{
DrawTextWithContrast(text, location, fg, WidgetUtils.GetContrastColor(fg, bgDark, bgLight), offset);
}
public int2 Measure(string text)
{
if (string.IsNullOrEmpty(text))