git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1061 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2007-06-23 17:19:09 +00:00
parent 73c4ee6817
commit 1504ad3ca6
15 changed files with 64 additions and 75 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
namespace OpenRa.FileFormats
{
public class Palette
{
List<Color> colors = new List<Color>();
public Color GetColor(int index)
{
return colors[index];
}
public Palette(Stream s)
{
using (BinaryReader reader = new BinaryReader(s))
{
for (int i = 0; i < 256; i++)
{
byte r = (byte)(reader.ReadByte() << 2);
byte g = (byte)(reader.ReadByte() << 2);
byte b = (byte)(reader.ReadByte() << 2);
colors.Add(Color.FromArgb(r, g, b));
}
}
}
}
}