move MakeSystemPalette out of editor.RenderUtils; rename to Palette.AsSystemPalette()

This commit is contained in:
Chris Forbes
2011-05-07 18:18:32 +12:00
parent e839ae33d8
commit a0e015746f
4 changed files with 17 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
#endregion
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace OpenRA.FileFormats
@@ -71,6 +72,17 @@ namespace OpenRA.FileFormats
{
colors = (uint[])p.colors.Clone();
}
public ColorPalette AsSystemPalette()
{
ColorPalette pal;
using (var b = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
pal = b.Palette;
for (var i = 0; i < 256; i++)
pal.Entries[i] = GetColor(i);
return pal;
}
}
public interface IPaletteRemap { Color GetRemappedColor(Color original, int index); }