remapping!

git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1108 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
chrisf
2007-07-06 01:20:10 +00:00
parent c77b8378f5
commit 782cea668b
14 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
namespace OpenRa.FileFormats
{
public class PaletteRemap
{
List<Color> remapColors = new List<Color>();
public PaletteRemap(Stream s)
{
using (BinaryReader reader = new BinaryReader(s))
{
for (int i = 0; i < 16; i++)
{
byte r = reader.ReadByte();
byte g = reader.ReadByte();
byte b = reader.ReadByte();
remapColors.Add(Color.FromArgb(r, g, b));
}
}
}
public Color GetRemappedColor(Color original, int index)
{
if (index < 80 || index >= 96)
return original;
return remapColors[index - 80];
}
}
}