palette matching tool
This commit is contained in:
88
OpenRa.sln
88
OpenRa.sln
@@ -9,28 +9,116 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.DataStructures", "Op
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteUsage", "PaletteUsage\PaletteUsage.csproj", "{54577061-E2D2-4336-90A2-A9A7106A30CD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteUsage", "PaletteUsage\PaletteUsage.csproj", "{54577061-E2D2-4336-90A2-A9A7106A30CD}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteMatch", "PaletteMatch\PaletteMatch.csproj", "{31411761-224C-4C54-A5FE-280890A70259}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug (x86)|Any CPU = Debug (x86)|Any CPU
|
||||||
|
Debug (x86)|Mixed Platforms = Debug (x86)|Mixed Platforms
|
||||||
Debug (x86)|Win32 = Debug (x86)|Win32
|
Debug (x86)|Win32 = Debug (x86)|Win32
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release (x86)|Any CPU = Release (x86)|Any CPU
|
||||||
|
Release (x86)|Mixed Platforms = Release (x86)|Mixed Platforms
|
||||||
Release (x86)|Win32 = Release (x86)|Win32
|
Release (x86)|Win32 = Release (x86)|Win32
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|Mixed Platforms = Release|Mixed Platforms
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Win32.Build.0 = Debug|x86
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Win32.ActiveCfg = Release|x86
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Win32.Build.0 = Release|x86
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release (x86)|Win32.Build.0 = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}.Release|Win32.ActiveCfg = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Win32.Build.0 = Debug|x86
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Win32.ActiveCfg = Release|x86
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Win32.Build.0 = Release|x86
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release (x86)|Win32.Build.0 = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Win32.ActiveCfg = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Win32.Build.0 = Debug|x86
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Win32.ActiveCfg = Release|x86
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Win32.Build.0 = Release|x86
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release (x86)|Win32.Build.0 = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Win32.ActiveCfg = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Win32.Build.0 = Debug|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Win32.ActiveCfg = Release|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Win32.Build.0 = Release|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release (x86)|Win32.Build.0 = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Win32.ActiveCfg = Release|x86
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Win32.ActiveCfg = Debug|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}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Win32.ActiveCfg = Release|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
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
66
PaletteMatch/PaletteMatch.csproj
Normal file
66
PaletteMatch/PaletteMatch.csproj
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{31411761-224C-4C54-A5FE-280890A70259}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>PaletteMatch</RootNamespace>
|
||||||
|
<AssemblyName>PaletteMatch</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Xml.Linq">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.DataSetExtensions">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OpenRa.FileFormats\OpenRa.FileFormats.csproj">
|
||||||
|
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
|
||||||
|
<Name>OpenRa.FileFormats</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
71
PaletteMatch/Program.cs
Normal file
71
PaletteMatch/Program.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
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<Color> Entries(this Palette p)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < 256; i++)
|
||||||
|
yield return p.GetColor(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static T WithStream<T>(string filename, Func<Stream, T> f)
|
||||||
|
{
|
||||||
|
using (var s = File.OpenRead(filename))
|
||||||
|
return f(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ColorDistanceComparer : IComparer<Color>
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
PaletteMatch/Properties/AssemblyInfo.cs
Normal file
36
PaletteMatch/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
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")]
|
||||||
BIN
tdbits/a10.shp
Normal file
BIN
tdbits/a10.shp
Normal file
Binary file not shown.
BIN
tdbits/a10icnh.win
Normal file
BIN
tdbits/a10icnh.win
Normal file
Binary file not shown.
BIN
tdbits/winter.pal
Normal file
BIN
tdbits/winter.pal
Normal file
Binary file not shown.
Reference in New Issue
Block a user