From fb8fdb5899366752d0fe27581b4065224616962d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 4 Oct 2011 22:28:51 +1300 Subject: [PATCH] move load from file wrapper for palette into Palette.cs --- OpenRA.FileFormats/Palette.cs | 6 ++++++ OpenRA.Utility/Command.cs | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenRA.FileFormats/Palette.cs b/OpenRA.FileFormats/Palette.cs index 2205168ea7..bf3bd46cd1 100644 --- a/OpenRA.FileFormats/Palette.cs +++ b/OpenRA.FileFormats/Palette.cs @@ -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); } diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index 11cdc7806f..33562b27e1 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -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)) {