From b1fca54e7e22d9fd99bf82e40475dea5df058c7e Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 7 Feb 2010 16:24:06 +1300 Subject: [PATCH] removed defunct PaletteUsage/PaletteMatch --- OpenRa.sln | 12 ----- PaletteMatch/PaletteMatch.csproj | 65 ---------------------- PaletteMatch/Program.cs | 71 ------------------------- PaletteMatch/Properties/AssemblyInfo.cs | 36 ------------- PaletteUsage/PaletteUsage.csproj | 53 ------------------ PaletteUsage/Program.cs | 49 ----------------- PaletteUsage/Properties/AssemblyInfo.cs | 33 ------------ 7 files changed, 319 deletions(-) delete mode 100644 PaletteMatch/PaletteMatch.csproj delete mode 100644 PaletteMatch/Program.cs delete mode 100644 PaletteMatch/Properties/AssemblyInfo.cs delete mode 100644 PaletteUsage/PaletteUsage.csproj delete mode 100644 PaletteUsage/Program.cs delete mode 100644 PaletteUsage/Properties/AssemblyInfo.cs diff --git a/OpenRa.sln b/OpenRa.sln index cbdee7c2e3..eab68ff896 100644 --- a/OpenRa.sln +++ b/OpenRa.sln @@ -5,10 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.FileFormats", "OpenR EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Game", "OpenRa.Game\OpenRa.Game.csproj", "{0DFB103F-2962-400F-8C6D-E2C28CCBA633}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteUsage", "PaletteUsage\PaletteUsage.csproj", "{54577061-E2D2-4336-90A2-A9A7106A30CD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteMatch", "PaletteMatch\PaletteMatch.csproj", "{31411761-224C-4C54-A5FE-280890A70259}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SequenceEditor", "SequenceEditor\SequenceEditor.csproj", "{230F65CE-A6DE-4235-8B38-13A3D606C7F7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Server", "OpenRA.Server\OpenRA.Server.csproj", "{76F621A1-3D8E-4A99-9F7E-B071EB657817}" @@ -33,14 +29,6 @@ Global {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.Build.0 = Debug|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.Build.0 = Release|Any CPU - {54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Any CPU.Build.0 = Release|Any CPU - {31411761-224C-4C54-A5FE-280890A70259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {31411761-224C-4C54-A5FE-280890A70259}.Debug|Any CPU.Build.0 = Debug|Any CPU - {31411761-224C-4C54-A5FE-280890A70259}.Release|Any CPU.ActiveCfg = Release|Any CPU - {31411761-224C-4C54-A5FE-280890A70259}.Release|Any CPU.Build.0 = Release|Any CPU {230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/PaletteMatch/PaletteMatch.csproj b/PaletteMatch/PaletteMatch.csproj deleted file mode 100644 index 1069f840a5..0000000000 --- a/PaletteMatch/PaletteMatch.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {31411761-224C-4C54-A5FE-280890A70259} - Exe - Properties - PaletteMatch - PaletteMatch - v3.5 - 512 - - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - prompt - - - bin\Release\ - TRACE - true - pdbonly - AnyCPU - prompt - - - - - 3.5 - - - - 3.5 - - - 3.5 - - - - - - - - - - - {BDAEAB25-991E-46A7-AF1E-4F0E03358DAA} - OpenRa.FileFormats - - - - - \ No newline at end of file diff --git a/PaletteMatch/Program.cs b/PaletteMatch/Program.cs deleted file mode 100644 index ab6ba92dee..0000000000 --- a/PaletteMatch/Program.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using OpenRa.FileFormats; -using System.Drawing; - -namespace PaletteMatch -{ - /* a simple little hack to work out a sane matching between TD and RA palettes (or, indeed, from RA -> RA) */ - /* usage: PaletteMatch srcpal destpal */ - - static class Program - { - static void Main(string[] args) - { - var tdPalette = WithStream(args[0], s => new Palette(s)); - var raPalette = WithStream(args[1], s => new Palette(s)); - - var ms = tdPalette.Entries().Select( - (a, i) => new - { - Src = i, - Dest = raPalette.Entries().Select( - (b, j) => new { Color = b, Index = j }) - .OrderBy(x => x.Color, new ColorDistanceComparer(a)).First().Index - }); - - foreach( var m in ms ) - Console.WriteLine("{0:x2} -> {1:x2}", m.Src, m.Dest); - } - - static IEnumerable Entries(this Palette p) - { - for (var i = 0; i < 256; i++) - yield return p.GetColor(i); - } - - static T WithStream(string filename, Func f) - { - using (var s = File.OpenRead(filename)) - return f(s); - } - } - - class ColorDistanceComparer : IComparer - { - readonly Color r; - - public ColorDistanceComparer(Color r) - { - this.r = r; - } - - float Distance(Color a) - { - var b = a.GetBrightness() - r.GetBrightness(); - var h = a.GetHue() - r.GetHue(); - var s = a.GetSaturation() - r.GetSaturation(); - - return b * b + h * h + s * s; - } - - public int Compare(Color x, Color y) - { - return Math.Sign(Distance(x) - Distance(y)); - } - } - -} diff --git a/PaletteMatch/Properties/AssemblyInfo.cs b/PaletteMatch/Properties/AssemblyInfo.cs deleted file mode 100644 index 2f6ead4761..0000000000 --- a/PaletteMatch/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PaletteMatch")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PaletteMatch")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("eb944988-f387-46a5-bb5b-392d482df964")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PaletteUsage/PaletteUsage.csproj b/PaletteUsage/PaletteUsage.csproj deleted file mode 100644 index 05766f435b..0000000000 --- a/PaletteUsage/PaletteUsage.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {54577061-E2D2-4336-90A2-A9A7106A30CD} - Exe - Properties - PaletteUsage - PaletteUsage - - - 2.0 - - - - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - prompt - - - bin\Release\ - TRACE - true - pdbonly - AnyCPU - prompt - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PaletteUsage/Program.cs b/PaletteUsage/Program.cs deleted file mode 100644 index ccc00752ea..0000000000 --- a/PaletteUsage/Program.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; - -namespace PaletteUsage -{ - class Program - { - static void Main(string[] args) - { - OpenFileDialog ofd = new OpenFileDialog(); - ofd.RestoreDirectory = true; - ofd.Filter = "PNG Image Cache (*.png)|*.png"; - - if (DialogResult.OK != ofd.ShowDialog()) - return; - - Bitmap bitmap = new Bitmap(ofd.FileName); - int[] f = new int[256]; - - foreach (byte b in ImageBytes(bitmap)) - ++f[b]; - - Console.WriteLine("Unused palette entries:"); - - for (int i = 0; i < 256; i++) - if (f[i] == 0) - Console.WriteLine("0x{0:x}\t\t{0}", i); - } - - static IEnumerable ImageBytes(Bitmap bitmap) - { - int width = bitmap.Width; - int height = bitmap.Height; - - for( int i = 0; i < width; i++ ) - for (int j = 0; j < height; j++) - { - Color c = bitmap.GetPixel(i, j); - yield return (byte)c.R; - yield return (byte)c.G; - yield return (byte)c.B; - yield return (byte)c.A; - } - } - } -} diff --git a/PaletteUsage/Properties/AssemblyInfo.cs b/PaletteUsage/Properties/AssemblyInfo.cs deleted file mode 100644 index 5099516f48..0000000000 --- a/PaletteUsage/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PaletteUsage")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PaletteUsage")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("93fb03d7-e484-45a8-bfe0-c0560814553a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")]