move load from file wrapper for palette into Palette.cs

This commit is contained in:
Chris Forbes
2011-10-04 22:28:51 +13:00
parent 6de9c0b432
commit fb8fdb5899
2 changed files with 7 additions and 7 deletions

View File

@@ -91,6 +91,12 @@ namespace OpenRA.FileFormats
return pal;
}
public static Palette Load( string filename, bool remap )
{
using(var s = File.OpenRead(filename))
return new Palette(s, remap);
}
}
public interface IPaletteRemap { Color GetRemappedColor(Color original, int index); }

View File

@@ -73,19 +73,13 @@ namespace OpenRA.Utility
}
}
static Palette LoadPalette( string filename )
{
using( var s = File.OpenRead( filename ) )
return new Palette( s, false );
}
public static void ConvertShpToPng(string[] args)
{
var src = args[1];
var dest = Path.ChangeExtension(src, ".png");
var srcImage = ShpReader.Load(src);
var palette = LoadPalette(args[2]);
var palette = Palette.Load(args[2], false);
using (var bitmap = new Bitmap(srcImage.ImageCount * srcImage.Width, srcImage.Height, PixelFormat.Format8bppIndexed))
{