remapping!
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1108 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BitmapBuilder.cs" />
|
<Compile Include="BitmapBuilder.cs" />
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
<Compile Include="PackageEntry.cs" />
|
<Compile Include="PackageEntry.cs" />
|
||||||
<Compile Include="Package.cs" />
|
<Compile Include="Package.cs" />
|
||||||
<Compile Include="Palette.cs" />
|
<Compile Include="Palette.cs" />
|
||||||
|
<Compile Include="PaletteRemap.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ShpReader.cs" />
|
<Compile Include="ShpReader.cs" />
|
||||||
<Compile Include="Terrain.cs" />
|
<Compile Include="Terrain.cs" />
|
||||||
|
|||||||
@@ -32,5 +32,11 @@ namespace OpenRa.FileFormats
|
|||||||
colors[3] = Color.FromArgb(178, 0, 0, 0);
|
colors[3] = Color.FromArgb(178, 0, 0, 0);
|
||||||
colors[4] = Color.FromArgb(140, 0, 0, 0);
|
colors[4] = Color.FromArgb(140, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Palette(Palette p, PaletteRemap r)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
colors.Add(r.GetRemappedColor(p.GetColor(i), i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
OpenRa.FileFormats/PaletteRemap.cs
Normal file
36
OpenRa.FileFormats/PaletteRemap.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace OpenRa.FileFormats
|
||||||
|
{
|
||||||
|
public class PaletteRemap
|
||||||
|
{
|
||||||
|
List<Color> remapColors = new List<Color>();
|
||||||
|
|
||||||
|
public PaletteRemap(Stream s)
|
||||||
|
{
|
||||||
|
using (BinaryReader reader = new BinaryReader(s))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
byte r = reader.ReadByte();
|
||||||
|
byte g = reader.ReadByte();
|
||||||
|
byte b = reader.ReadByte();
|
||||||
|
|
||||||
|
remapColors.Add(Color.FromArgb(r, g, b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color GetRemappedColor(Color original, int index)
|
||||||
|
{
|
||||||
|
if (index < 80 || index >= 96)
|
||||||
|
return original;
|
||||||
|
|
||||||
|
return remapColors[index - 80];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,9 @@ namespace ShpViewer
|
|||||||
|
|
||||||
Palette pal = new Palette( File.OpenRead( "../../../temperat.pal" ) );
|
Palette pal = new Palette( File.OpenRead( "../../../temperat.pal" ) );
|
||||||
|
|
||||||
|
PaletteRemap remap = new PaletteRemap(File.OpenRead("../../../blue.rem"));
|
||||||
|
pal = new Palette(pal, remap);
|
||||||
|
|
||||||
foreach( ImageHeader h in shpReader )
|
foreach( ImageHeader h in shpReader )
|
||||||
bitmaps.Add( BitmapBuilder.FromBytes( h.Image, shpReader.Width, shpReader.Height, pal ) );
|
bitmaps.Add( BitmapBuilder.FromBytes( h.Image, shpReader.Width, shpReader.Height, pal ) );
|
||||||
}
|
}
|
||||||
|
|||||||
1
blue.rem
Normal file
1
blue.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>궾ޡ<EFBFBD>ʍ<EFBFBD><EFBFBD>}<7D><>iu<69>Yi<59>DU<44>8H}0@u(8m ,a,U D4
|
||||||
1
gold.rem
Normal file
1
gold.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD>y<EFBFBD><EFBFBD>q־iƲa<EFBFBD><EFBFBD>Y<EFBFBD><EFBFBD>U<EFBFBD><EFBFBD>L<EFBFBD>u@<40>q8me8YU,UL$HD 844,(
|
||||||
1
gray.rem
Normal file
1
gray.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}q<>qeqYP]H@P<4P<4<,(<,(,,
|
||||||
1
green.rem
Normal file
1
green.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>慲<EFBFBD>}<7D><>u<EFBFBD><75>my<6D>ei<65>]YuLLe<<U00D$$4$4$
|
||||||
BIN
orange.rem
Normal file
BIN
orange.rem
Normal file
Binary file not shown.
BIN
salmon.rem
Normal file
BIN
salmon.rem
Normal file
Binary file not shown.
Reference in New Issue
Block a user