diff --git a/.gitignore b/.gitignore
index 6181bfa..3498656 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,9 @@
-.vs/
+# User-specific files
+*.user
+
+# Build results
[Bb]in/
[Oo]bj/
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
+# Visual Studio 2015/2017 cache/options directory
+.vs/
diff --git a/About.xaml b/About.xaml
new file mode 100644
index 0000000..c2be197
--- /dev/null
+++ b/About.xaml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+ https://github.com/CyberBotX/TerrariaPixelArtHelper
+
+
+
+ Terraria is copyright to
+ Re-Logic
+
+
+
+
+
+ https://fonts.google.com/specimen/Roboto+Mono
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/About.xaml.cs b/About.xaml.cs
new file mode 100644
index 0000000..bbf0287
--- /dev/null
+++ b/About.xaml.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Navigation;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for About.xaml
+ ///
+ public partial class About : Window
+ {
+ public static List Libraries = new List()
+ {
+ new LibraryData()
+ {
+ Library = "CalcBinding",
+ Version = typeof(CalcBinding.Binding).Assembly.GetName().Version,
+ Author = "Alexander Zinchenko",
+ Url = "https://github.com/Alex141/CalcBinding"
+ },
+ new LibraryData()
+ {
+ Library = "FontAwesome5",
+ Version = typeof(FontAwesome5.WPF.FontAwesome).Assembly.GetName().Version,
+ Author = "Codinion",
+ Url = "https://github.com/MartinTopfstedt/FontAwesome5"
+ },
+ new LibraryData()
+ {
+ Library = "JeremyAnsel.ColorQuant",
+ Version = typeof(JeremyAnsel.ColorQuant.WuColorQuantizer).Assembly.GetName().Version,
+ Author = "Jérémy Ansel",
+ Url = "https://github.com/JeremyAnsel/JeremyAnsel.ColorQuant"
+ },
+ new LibraryData()
+ {
+ Library = "Math.NET Numerics",
+ Version = typeof(MathNet.Numerics.Constants).Assembly.GetName().Version,
+ Author = "Christoph Ruegg, Marcus Cuda, Jurgen Van Gael",
+ Url = "https://numerics.mathdotnet.com/"
+ },
+ new LibraryData()
+ {
+ Library = "PostSharp",
+ Version = typeof(PostSharp.Post).Assembly.GetName().Version,
+ Author = "PostSharp Technologies",
+ Url = "https://www.postsharp.net/"
+ },
+ new LibraryData()
+ {
+ Library = "WriteableBitmapEx",
+ Version = typeof(System.Windows.Media.Imaging.BitmapFactory).Assembly.GetName().Version,
+ Author = "Schulte Software Development",
+ Url = "https://github.com/teichgraf/WriteableBitmapEx"
+ }
+ };
+
+ public static Version Version = typeof(About).Assembly.GetName().Version;
+
+ public About() => this.InitializeComponent();
+
+ void OK_Click(object sender, RoutedEventArgs e) => this.Close();
+
+ void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) => Process.Start(e.Uri.ToString());
+ }
+
+ public class LibraryData
+ {
+ public string Author { get; set; }
+
+ public string Library { get; set; }
+
+ public Version Version { get; set; }
+
+ public string Url { get; set; }
+ }
+}
diff --git a/App.xaml b/App.xaml
new file mode 100644
index 0000000..8f88385
--- /dev/null
+++ b/App.xaml
@@ -0,0 +1,22 @@
+
+
+ pack://application:,,,/Fonts/RobotoMono/#Roboto Mono
+
+
+
+
+
+
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
new file mode 100644
index 0000000..78741ff
--- /dev/null
+++ b/App.xaml.cs
@@ -0,0 +1,256 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Threading;
+using PostSharp.Patterns.Contracts;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ #region GetColoredMapWallPixels
+
+ static readonly ConcurrentDictionary<(string wallName, string color), Task> colorMapWallsPixelsCache = new ConcurrentDictionary<(string wallName, string color), Task>();
+
+ ///
+ /// Gets the colored pixels of a wall on the map.
+ ///
+ /// The name of the wall to get the pixels of.
+ /// The color of the wall to get the pixels of.
+ /// The pixels of the colored map wall.
+ internal static async Task GetColoredMapWallPixels([Required] string wallName, [Required] string color) => await App.colorMapWallsPixelsCache.GetOrAdd((wallName, color), async key =>
+ {
+ // Get the map color for the wall and colorize it if necessary.
+ var wallColor = ColorExtension.GetMapWallColor(wallName);
+ if (wallColor.HasValue)
+ wallColor = wallColor.Value.ColorizeMap(color);
+
+ // If we have a proper wall color, return the pixels, return null otherwise.
+ return wallColor.HasValue ? await Task.Run(() => new int[256].Populate((wallColor.Value.R << 16) | (wallColor.Value.G << 8) | wallColor.Value.B | (wallColor.Value.A << 24))) : null;
+ });
+
+ #endregion
+
+ #region GetColoredWallPixels
+
+ static readonly ConcurrentDictionary<(string wallName, string color), Task> colorWallsPixelsCache = new ConcurrentDictionary<(string wallName, string color), Task>();
+
+ ///
+ /// Gets the colored pixels of a wall in-game.
+ ///
+ /// The name of the wall to get the pixels of.
+ /// The name of the color to get the pixels of.
+ /// The pixels of the colored in-game wall.
+ internal static async Task GetColoredWallPixels([Required] string wallName, [Required] string color) => await App.colorWallsPixelsCache.GetOrAdd((wallName, color), async key =>
+ {
+ // Get the pixels of the in-game wall.
+ int[] pixels = await App.GetWallPixels(wallName);
+
+ // Only colorize the wall if we are using an actual color and had pixels.
+ if (color != "Uncolored" && pixels != null)
+ await Task.Run(() =>
+ {
+ // Create a copy of the pixels so we don't muck up the original wall's pixels.
+ pixels = pixels.ToArray();
+ // Colorize all the pixels.
+ int index = 0;
+ for (int y = 0; y < App.WallPixelHeight; ++y)
+ for (int x = 0; x < App.WallPixelWidth; ++x)
+ {
+ int c = pixels[index];
+ var newColor = Color.FromArgb((byte)(c >> 24), (byte)((c >> 16) & 0xFF), (byte)((c >> 8) & 0xFF), (byte)(c & 0xFF)).ColorizeInGame(color);
+ pixels[index++] = (newColor.R << 16) | (newColor.G << 8) | newColor.B | (newColor.A << 24);
+ }
+ });
+
+ // Return the pixels, if any.
+ return pixels;
+ });
+
+ #endregion
+
+ #region GetWallPixels
+
+ internal const int WallPixelWidth = 48;
+ internal const int WallPixelHeight = 80;
+
+ static readonly ConcurrentDictionary> wallPixelsCache = new ConcurrentDictionary>();
+
+ ///
+ /// Gets the pixels of a wall in-game.
+ ///
+ /// The name of the wall to get the pixels of.
+ /// The pixels of the in-game wall.
+ internal static async Task GetWallPixels([Required] string wallName) => await App.wallPixelsCache.GetOrAdd(wallName, async key =>
+ {
+ try
+ {
+ // Attempt to load the image from the application's resources, returning its pixels if successful.
+ using (var ms = new MemoryStream())
+ {
+ await Application.GetResourceStream(new Uri($"WallImages/Wall_{wallName.Replace(" ", "")}.png", UriKind.Relative)).Stream.CopyToAsync(ms);
+ var bitmap = new BitmapImage();
+ bitmap.BeginInit();
+ bitmap.CacheOption = BitmapCacheOption.OnLoad;
+ bitmap.StreamSource = ms;
+ bitmap.EndInit();
+ bitmap.Freeze();
+ int[] pixels = new int[bitmap.PixelWidth * bitmap.PixelHeight];
+ bitmap.CopyPixels(pixels, bitmap.PixelWidth * 4, 0);
+ return pixels;
+ }
+ }
+ catch (InvalidOperationException)
+ {
+ return null;
+ }
+ catch (IOException)
+ {
+ return null;
+ }
+ });
+
+ #endregion
+
+ #region GetWallFrame
+
+ static readonly ConcurrentDictionary<(string wallName, string color, int i, int j, int frame), Task> wallFramesCache =
+ new ConcurrentDictionary<(string wallName, string color, int i, int j, int frame), Task>();
+
+ ///
+ /// Gets a bitmap of the in-game wall frame.
+ ///
+ /// The name of the wall to get the bitmap of.
+ /// The color of the wall to get the bitmap of.
+ /// The X coordinate of the wall frame (used to determine which frame is used).
+ /// The Y coordinate of the wall frame (used to determine which frame is used).
+ /// The frame of the wall.
+ /// The bitmap of the in-game wall frame.
+ internal static async Task GetWallFrame([Required] string wallName, [Required] string color, int i, int j, int frame) =>
+ await App.wallFramesCache.GetOrAdd((wallName, color, i, j, frame), async key =>
+ {
+ // Get the pixels of the in-game wall frame.
+ int[] pixels = await App.GetWallFramePixels(wallName, color, i, j, frame);
+ if (pixels == null)
+ return null;
+
+ // Create a bitmap out of the pixels.
+ var bitmap = PixelManip.Create(16, 16, pixels);
+ bitmap.Freeze();
+ return bitmap;
+ });
+
+ #endregion
+
+ #region GetWallFramePixels
+
+ static readonly ConcurrentDictionary<(string wallName, string color, int i, int j, int frame), Task> wallFramesPixelsCache =
+ new ConcurrentDictionary<(string wallName, string color, int i, int j, int frame), Task>();
+
+ ///
+ /// Gets the pixels of the in-game wall frame.
+ ///
+ /// The name of the wall to get the pixels of.
+ /// The color of the wall to get the pixels of.
+ /// The X coordinate of the wall frame (used to determine which frame is used).
+ /// The Y coordinate of the wall frame (used to determine which frame is used).
+ /// The frame of the wall.
+ /// The pixels of the in-game wall frame.
+ internal static async Task GetWallFramePixels([Required] string wallName, [Required] string color, int i, int j, int frame) =>
+ await App.wallFramesPixelsCache.GetOrAdd((wallName, color, i, j, frame), async key =>
+ {
+ // Get the pixels of the colored in-game wall.
+ int[] pixels = await App.GetColoredWallPixels(wallName, color);
+ if (pixels == null)
+ return null;
+
+ // This section for picking y comes from the part of Terraria.Framing (partially the WallFrame() method) that picks a wall frame based on the X and Y coordinates of the tile.
+ int x = frame;
+ int y = i % 3 == 1 && j % 3 == 1 ? 1 : (i % 3 == 0 && j % 3 == 0 ? 2 : (i % 3 == 2 && j % 3 == 1 ? 3 : (i % 3 == 1 && j % 3 == 2 ? 4 : 0)));
+
+ // Copy the pixels specifically for the frame we want.
+ int[] framePixels = new int[256];
+ for (int y2 = 0; y2 < 16; ++y2)
+ Array.Copy(pixels, x * 16 + (y * 16 + y2) * App.WallPixelWidth, framePixels, y2 * 16, 16);
+ return framePixels;
+ });
+
+ #endregion
+
+ ///
+ /// Zooms the given bitmap to 16 times its original size.
+ ///
+ /// The original bitmap to zoom.
+ /// The zoomed bitmap.
+ internal static async Task ZoomBy16([Required] BitmapSource orig)
+ {
+ int width = orig.PixelWidth;
+ int height = orig.PixelHeight;
+
+ var cachedColorPixels = new Dictionary();
+ var colors = new Dictionary();
+ var pixelInfo = new Dictionary<(int x, int y), PixelInfo>();
+
+ int[] zoomedPixels = new int[width * height * 256];
+ await Task.Run(async () =>
+ {
+ // Get the pixels of the original bitmap.
+ int[] pixels = new int[width * height];
+ orig.CopyPixels(pixels, width * 4, 0);
+ int index = 0;
+
+ // Loop over the pixels of the original bitmap and create 16x16 "pixels" out of them.
+ for (int y = 0; y < height; ++y)
+ for (int x = 0; x < width; ++x)
+ {
+ int c = pixels[index++];
+ var color = Color.FromArgb((byte)(c >> 24), (byte)((c >> 16) & 0xFF), (byte)((c >> 8) & 0xFF), (byte)(c & 0xFF));
+ // Replace any pixels that have 0 alpha with the transparent color, makes things more consistent if there are somehow multiple 0 alpha colors.
+ if (color.A == 0)
+ color = Colors.Transparent;
+
+ colors.TryGetValue(color, out int colorCount);
+ colors[color] = colorCount + 1;
+
+ pixelInfo[(x, y)] = new PixelInfo()
+ {
+ Color = color
+ };
+
+ if (!cachedColorPixels.TryGetValue(color, out int[] fillRowPixels))
+ cachedColorPixels[color] = fillRowPixels = new int[256].Populate((color.R << 16) | (color.G << 8) | color.B | (color.A << 24));
+
+ await PixelManip.CopyFrom16x16(fillRowPixels, zoomedPixels, x, y, width);
+ }
+ });
+
+ return new BitmapData()
+ {
+ CachedColorPixels = cachedColorPixels,
+ Colors = colors,
+ PixelInfo = pixelInfo,
+ ZoomedPixels = zoomedPixels
+ };
+ }
+
+ void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ var unhandledException = new UnhandledException(e.Exception);
+ if (unhandledException.ShowDialog() ?? false)
+ this.Shutdown();
+ e.Handled = true;
+ }
+ }
+}
diff --git a/AsyncLazy.cs b/AsyncLazy.cs
new file mode 100644
index 0000000..f780a9f
--- /dev/null
+++ b/AsyncLazy.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Provides support for asynchronous lazy initialization. This type is fully threadsafe.
+ ///
+ ///
+ /// Comes from http://blog.stephencleary.com/2012/08/asynchronous-lazy-initialization.html
+ ///
+ /// The type of object that is being asynchronously initialized.
+ internal sealed class AsyncLazy
+ {
+ ///
+ /// The underlying lazy task.
+ ///
+ readonly Lazy> instance;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The delegate that is invoked on a background thread to produce the value when it is needed.
+ public AsyncLazy(Func factory) => this.instance = new Lazy>(() => Task.Run(factory));
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The asynchronous delegate that is invoked on a background thread to produce the value when it is needed.
+ public AsyncLazy(Func> factory) => this.instance = new Lazy>(() => Task.Run(factory));
+
+ ///
+ /// Asynchronous infrastructure support. This method permits instances of to be await'ed.
+ ///
+ public TaskAwaiter GetAwaiter() => this.instance.Value.GetAwaiter();
+
+ ///
+ /// Starts the asynchronous initialization, if it has not already started.
+ ///
+ public void Start()
+ {
+ var unused = this.instance.Value;
+ }
+ }
+}
diff --git a/BitmapData.cs b/BitmapData.cs
new file mode 100644
index 0000000..698ff4a
--- /dev/null
+++ b/BitmapData.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using System.Windows.Media;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Contains the data for a bitmap.
+ ///
+ internal class BitmapData
+ {
+ ///
+ /// Cache of color pixels for each color of the bitmap.
+ ///
+ public Dictionary CachedColorPixels { get; set; }
+
+ ///
+ /// The number of pixels per color.
+ ///
+ public Dictionary Colors { get; set; }
+
+ ///
+ /// The pixel info for each coordinate.
+ ///
+ public Dictionary<(int x, int y), PixelInfo> PixelInfo { get; set; }
+
+ ///
+ /// The pixels of the zoomed bitmap.
+ ///
+ public int[] ZoomedPixels { get; set; }
+ }
+}
diff --git a/CachedColor.cs b/CachedColor.cs
new file mode 100644
index 0000000..ba6cc9d
--- /dev/null
+++ b/CachedColor.cs
@@ -0,0 +1,44 @@
+using System.Diagnostics;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Cache of wall+color for the window.
+ ///
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class CachedColor
+ {
+ ///
+ /// The name of the color.
+ ///
+ public string ColorName { get; set; }
+
+ ///
+ /// The L*a*b* representation of the wall color.
+ ///
+ public LAB LABColor { get; set; }
+
+ ///
+ /// The color of the wall.
+ ///
+ public Color WallColor { get; set; }
+
+ ///
+ /// The colored bitmap of the wall.
+ ///
+ public BitmapSource WallImage { get; set; }
+
+ ///
+ /// The name of this wall.
+ ///
+ public string WallName { get; set; }
+
+ [DebuggerBrowsable(DebuggerBrowsableState.Never)]
+ string DebuggerDisplay => $"{{{this.WallName}, {this.ColorName}, {this.WallColor}, {this.LABColor}}}";
+ }
+}
diff --git a/ColorExtension.cs b/ColorExtension.cs
index 7f08906..dbe4cc6 100644
--- a/ColorExtension.cs
+++ b/ColorExtension.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Collections.Concurrent;
using System.Linq;
+using System.Windows.Media;
+using PostSharp.Patterns.Contracts;
///
/// See Program.cs for license.
@@ -11,10 +11,11 @@ namespace TerrariaPixelArtHelper
///
/// Extensions to the struct for handling Terraria colors.
///
- public static class ColorExtension
+ internal static class ColorExtension
{
- // Cache of in-game colorized colors
- static Dictionary, Color> cachedColorizeInGame = new Dictionary, Color>();
+ #region ColorizeInGame
+
+ static ConcurrentDictionary<(Color originalColor, string color), Color> colorizeInGameCache = new ConcurrentDictionary<(Color originalColor, string color), Color>();
///
/// Converts the current color into the in-game color given by the argument.
@@ -24,636 +25,510 @@ public static class ColorExtension
///
/// The color to convert the current color to.
/// The new in-game color after conversion.
- public static Color ColorizeInGame(this Color origColor, string color)
+ public static Color ColorizeInGame(this Color origColor, [Required] string color) => ColorExtension.colorizeInGameCache.GetOrAdd((origColor, color), key =>
+ {
+ float R = origColor.R / 255.0f;
+ float G = origColor.G / 255.0f;
+ float B = origColor.B / 255.0f;
+
+ float[] colors = new[] { R, G, B };
+ float max = colors.Max();
+ float min = colors.Min();
+
+ switch (color)
+ {
+ case "Red":
+ R = max;
+ G = B = min;
+ break;
+ case "Orange":
+ R = max;
+ G = (max + min) / 2f;
+ B = min;
+ break;
+ case "Yellow":
+ R = G = max;
+ B = min;
+ break;
+ case "Lime":
+ R = (max + min) / 2f;
+ G = max;
+ B = min;
+ break;
+ case "Green":
+ R = B = min;
+ G = max;
+ break;
+ case "Teal":
+ R = min;
+ G = max;
+ B = (min + max) / 2f;
+ break;
+ case "Cyan":
+ R = min;
+ G = B = max;
+ break;
+ case "Sky Blue":
+ R = min;
+ G = (max + min) / 2f;
+ B = max;
+ break;
+ case "Blue":
+ R = G = min;
+ B = max;
+ break;
+ case "Purple":
+ R = (max + min) / 2f;
+ G = min;
+ B = max;
+ break;
+ case "Violet":
+ R = B = max;
+ G = min;
+ break;
+ case "Pink":
+ R = max;
+ G = min;
+ B = (max + min) / 2f;
+ break;
+ case "Deep Red":
+ R = max;
+ G = B = min * 0.4f;
+ break;
+ case "Deep Orange":
+ R = max;
+ G = (max + min * 0.4f) / 2f;
+ B = min * 0.4f;
+ break;
+ case "Deep Yellow":
+ R = G = max;
+ B = min * 0.4f;
+ break;
+ case "Deep Lime":
+ R = (max + min * 0.4f) / 2f;
+ G = max;
+ B = min * 0.4f;
+ break;
+ case "Deep Green":
+ R = B = min * 0.4f;
+ G = max;
+ break;
+ case "Deep Teal":
+ R = min * 0.4f;
+ G = max;
+ B = (max + min * 0.4f) / 2f;
+ break;
+ case "Deep Cyan":
+ R = min * 0.4f;
+ G = B = max;
+ break;
+ // NOTE: Need to add something here to make it NOT apply anything to blue and use the original value, as that is how Terraria currently does things...
+ case "Deep Sky Blue":
+ R = min * 0.4f;
+ G = (max + min * 0.4f) / 2f;
+ B = max;
+ break;
+ case "Deep Blue":
+ R = G = min * 0.4f;
+ B = max;
+ break;
+ case "Deep Purple":
+ R = (max + min * 0.4f) / 2f;
+ G = min * 0.4f;
+ B = max;
+ break;
+ case "Deep Violet":
+ R = B = max;
+ G = min * 0.4f;
+ break;
+ case "Deep Pink":
+ R = max;
+ G = min * 0.4f;
+ B = (max + min * 0.4f) / 2f;
+ break;
+ case "Black":
+ R = G = B = (max + min) * 0.15f;
+ break;
+ case "Gray":
+ R = G = B = (max + min) / 2f;
+ break;
+ case "White":
+ R = G = B = (max * 0.7f + min * 0.3f) * (2f - (max + min) / 2f);
+ break;
+ case "Brown":
+ R = max;
+ G = max * 0.7f;
+ B = max * 0.49f;
+ break;
+ case "Shadow":
+ R = G = B = (max + min) * 0.025f;
+ break;
+ case "Negative":
+ R = 0.75f - 2.0f * R;
+ G = 0.75f - 2.0f * G;
+ B = 0.75f - 2.0f * B;
+ break;
+ }
+
+ return Color.FromArgb(origColor.A, (byte)(R.Clamp(0f, 1f) * 255f), (byte)(G.Clamp(0f, 1f) * 255f), (byte)(B.Clamp(0f, 1f) * 255f));
+ });
+
+ #endregion
+
+ #region GetMapWallColor
+
+ // Cache of map wall colors
+ static ConcurrentDictionary mapWallColorCache = new ConcurrentDictionary();
+
+ ///
+ /// Gets the map color for the given wall.
+ ///
+ ///
+ /// Colors come from Terraria itself, specifically the 2-dimensional color array from Terraria.Map.MapHelper.Initialize() whose first dimension is the same size as the number of walls.
+ ///
+ /// The name of the wall to get the map color of.
+ /// The map color for the given wall.
+ public static Color? GetMapWallColor([Required] string wallName) => ColorExtension.mapWallColorCache.GetOrAdd(wallName, key =>
{
- var tuple = Tuple.Create(origColor, color);
- Color ret;
- if (!ColorExtension.cachedColorizeInGame.TryGetValue(tuple, out ret))
+ switch (wallName)
{
- float R = origColor.R / 255.0f;
- float G = origColor.G / 255.0f;
- float B = origColor.B / 255.0f;
+ case "Stone Wall": // 1
+ case "Gray Brick Wall": // 5
+ return Color.FromRgb(52, 52, 52);
+ case "Wood Wall": // 4
+ return Color.FromRgb(73, 51, 36);
+ case "Red Brick Wall": // 6
+ return Color.FromRgb(91, 30, 30);
+ case "Gold Brick Wall": // 10
+ return Color.FromRgb(74, 62, 12);
+ case "Silver Brick Wall": // 11
+ return Color.FromRgb(46, 56, 59);
+ case "Copper Brick Wall": // 12
+ return Color.FromRgb(75, 32, 11);
+ case "Dirt Wall": // 16
+ return Color.FromRgb(88, 61, 46);
+ case "Blue Brick Wall": // 17
+ return Color.FromRgb(27, 31, 42);
+ case "Green Brick Wall": // 18
+ return Color.FromRgb(31, 39, 26);
+ case "Pink Brick Wall": // 19
+ return Color.FromRgb(41, 28, 36);
+ case "Obsidian Brick Wall": // 20
+ return Color.FromRgb(15, 15, 15);
+ case "Pearlstone Brick Wall": // 22
+ return Color.FromRgb(113, 99, 99);
+ case "Iridescent Brick Wall": // 23
+ return Color.FromRgb(38, 38, 43);
+ case "Mudstone Brick Wall": // 24
+ return Color.FromRgb(53, 39, 41);
+ case "Cobalt Brick Wall": // 25
+ return Color.FromRgb(11, 35, 62);
+ case "Mythril Brick Wall": // 26
+ return Color.FromRgb(21, 63, 70);
+ case "Candy Cane Wall": // 29
+ return Color.FromRgb(88, 23, 23);
+ case "Green Candy Cane Wall": // 30
+ return Color.FromRgb(28, 88, 23);
+ case "Snow Brick Wall": // 31
+ return Color.FromRgb(78, 87, 99);
+ case "Adamantite Beam Wall": // 32
+ return Color.FromRgb(86, 17, 40);
+ case "Demonite Brick Wall": // 33
+ return Color.FromRgb(49, 47, 83);
+ case "Sandstone Brick Wall": // 34
+ case "Yellow Stucco Wall": // 37
+ return Color.FromRgb(69, 67, 41);
+ case "Ebonstone Brick Wall": // 35
+ return Color.FromRgb(51, 51, 70);
+ case "Red Stucco Wall": // 36
+ return Color.FromRgb(87, 59, 55);
+ case "Green Stucco Wall": // 38
+ return Color.FromRgb(49, 57, 49);
+ case "Gray Stucco Wall": // 39
+ return Color.FromRgb(78, 79, 73);
+ case "Ebonwood Wall": // 41
+ return Color.FromRgb(52, 50, 62);
+ case "Rich Mahogany Wall": // 42
+ return Color.FromRgb(71, 42, 44);
+ case "Pearlwood Wall": // 43
+ return Color.FromRgb(73, 66, 50);
+ case "Tin Brick Wall": // 45
+ return Color.FromRgb(60, 59, 51);
+ case "Tungsten Brick Wall": // 46
+ return Color.FromRgb(48, 57, 47);
+ case "Platinum Brick Wall": // 47
+ return Color.FromRgb(71, 77, 85);
+ case "Grass Wall": // 66
+ case "Flower Wall": // 68
+ return Color.FromRgb(30, 80, 48);
+ case "Jungle Wall": // 67
+ return Color.FromRgb(53, 80, 30);
+ case "Cactus Wall": // 72
+ return Color.FromRgb(52, 84, 12);
+ case "Cloud Wall": // 73
+ return Color.FromRgb(190, 204, 223);
+ case "Mushroom Wall": // 74
+ return Color.FromRgb(64, 62, 80);
+ case "Bone Block Wall": // 75
+ return Color.FromRgb(65, 65, 35);
+ case "Slime Block Wall": // 76
+ return Color.FromRgb(20, 46, 104);
+ case "Flesh Block Wall": // 77
+ return Color.FromRgb(61, 13, 16);
+ case "Living Wood Wall": // 78
+ return Color.FromRgb(63, 39, 26);
+ case "Disc Wall": // 82
+ return Color.FromRgb(77, 64, 34);
+ case "Ice Brick Wall": // 84
+ return Color.FromRgb(48, 78, 93);
+ case "Shadewood Wall": // 85
+ return Color.FromRgb(54, 63, 69);
+ case "Blue Slab Wall": // 100
+ return Color.FromRgb(32, 40, 45);
+ case "Blue Tiled Wall": // 101
+ return Color.FromRgb(44, 41, 50);
+ case "Pink Slab Wall": // 102
+ return Color.FromRgb(72, 50, 77);
+ case "Pink Tiled Wall": // 103
+ return Color.FromRgb(78, 50, 69);
+ case "Green Slab Wall": // 104
+ return Color.FromRgb(36, 45, 44);
+ case "Green Tiled Wall": // 105
+ return Color.FromRgb(38, 49, 50);
+ case "Hive Wall": // 108
+ return Color.FromRgb(138, 73, 38);
+ case "Palladium Column Wall": // 109
+ return Color.FromRgb(94, 25, 17);
+ case "Bubblegum Block Wall": // 110
+ return Color.FromRgb(125, 36, 122);
+ case "Titanstone Block Wall": // 111
+ return Color.FromRgb(51, 35, 27);
+ case "Lihzahrd Brick Wall": // 112
+ return Color.FromRgb(50, 15, 8);
+ case "Pumpkin Wall": // 113
+ return Color.FromRgb(135, 58, 0);
+ case "Hay Wall": // 114
+ return Color.FromRgb(65, 52, 15);
+ case "Spooky Wood Wall": // 115
+ return Color.FromRgb(39, 42, 51);
+ case "Christmas Tree Wallpaper": // 116
+ return Color.FromRgb(89, 26, 27);
+ case "Ornament Wallpaper": // 117
+ return Color.FromRgb(126, 123, 115);
+ case "Candy Cane Wallpaper": // 118
+ return Color.FromRgb(8, 50, 19);
+ case "Festive Wallpaper": // 119
+ return Color.FromRgb(95, 21, 24);
+ case "Stars Wallpaper": // 120
+ return Color.FromRgb(17, 31, 65);
+ case "Squiggles Wallpaper": // 121
+ return Color.FromRgb(192, 173, 143);
+ case "Snowflake Wallpaper": // 122
+ return Color.FromRgb(114, 114, 131);
+ case "Krampus Horn Wallpaper": // 123
+ return Color.FromRgb(136, 119, 7);
+ case "Bluegreen Wallpaper": // 124
+ return Color.FromRgb(8, 72, 3);
+ case "Grinch Finger Wallpaper": // 125
+ return Color.FromRgb(117, 132, 82);
+ case "Fancy Gray Wallpaper": // 126
+ return Color.FromRgb(100, 102, 114);
+ case "Ice Floe Wallpaper": // 127
+ return Color.FromRgb(30, 118, 226);
+ case "Music Wallpaper": // 128
+ return Color.FromRgb(93, 6, 102);
+ case "Purple Rain Wallpaper": // 129
+ return Color.FromRgb(64, 40, 169);
+ case "Rainbow Wallpaper": // 130
+ return Color.FromRgb(39, 34, 180);
+ case "Sparkle Stone Wallpaper": // 131
+ return Color.FromRgb(87, 94, 125);
+ case "Starlit Heaven Wallpaper": // 132
+ return Color.FromRgb(6, 6, 6);
+ case "Bubble Wallpaper": // 133
+ return Color.FromRgb(69, 72, 186);
+ case "Copper Pipe Wallpaper": // 134
+ return Color.FromRgb(130, 62, 16);
+ case "Ducky Wallpaper": // 135
+ return Color.FromRgb(22, 123, 163);
+ case "White Dynasty Wall": // 142
+ return Color.FromRgb(17, 172, 143);
+ case "Blue Dynasty Wall": // 143
+ return Color.FromRgb(90, 112, 105);
+ case "Copper Plating Wall": // 146
+ return Color.FromRgb(120, 59, 19);
+ case "Stone Slab Wall": // 147
+ return Color.FromRgb(59, 59, 59);
+ case "Sail": // 148
+ return Color.FromRgb(229, 218, 161);
+ case "Boreal Wood Wall": // 149
+ return Color.FromRgb(73, 59, 50);
+ case "Palm Wood Wall": // 151
+ return Color.FromRgb(102, 75, 34);
+ case "Amber Gemspark Wall": // 153
+ return Color.FromRgb(255, 145, 79);
+ case "Amethyst Gemspark Wall": // 154
+ return Color.FromRgb(221, 79, 255);
+ case "Diamond Gemspark Wall": // 155
+ return Color.FromRgb(240, 240, 247);
+ case "Emerald Gemspark Wall": // 156
+ return Color.FromRgb(79, 255, 89);
+ case "Offline Amber Gemspark Wall": // 157
+ return Color.FromRgb(154, 83, 49);
+ case "Offline Amethyst Gemspark Wall": // 158
+ return Color.FromRgb(107, 49, 154);
+ case "Offline Diamond Gemspark Wall": // 159
+ return Color.FromRgb(85, 89, 118);
+ case "Offline Emerald Gemspark Wall": // 160
+ return Color.FromRgb(49, 154, 68);
+ case "Offline Ruby Gemspark Wall": // 161
+ return Color.FromRgb(154, 49, 77);
+ case "Offline Sapphire Gemspark Wall": // 162
+ return Color.FromRgb(49, 49, 154);
+ case "Offline Topaz Gemspark Wall": // 163
+ return Color.FromRgb(154, 148, 49);
+ case "Ruby Gemspark Wall": // 164
+ return Color.FromRgb(255, 79, 79);
+ case "Sapphire Gemspark Wall": // 165
+ return Color.FromRgb(79, 102, 255);
+ case "Topaz Gemspark Wall": // 166
+ return Color.FromRgb(250, 255, 79);
+ case "Tin Plating Wall": // 167
+ return Color.FromRgb(70, 68, 51);
+ case "Chlorophyte Brick Wall": // 173
+ return Color.FromRgb(94, 163, 46);
+ case "Crimtane Brick Wall": // 174
+ return Color.FromRgb(117, 32, 59);
+ case "Shroomite Plating Wall": // 175
+ return Color.FromRgb(20, 11, 203);
+ case "Martian Conduit Wall": // 176
+ return Color.FromRgb(74, 69, 88);
+ case "Hellstone Brick Wall": // 177
+ return Color.FromRgb(60, 30, 30);
+ case "Smooth Marble Wall": // 179
+ case "Marble Wall": // 183
+ return Color.FromRgb(111, 117, 135);
+ case "Smooth Granite Wall": // 181
+ case "Granite Wall": // 184
+ return Color.FromRgb(25, 23, 54);
+ case "Meteorite Brick Wall": // 182
+ return Color.FromRgb(74, 71, 129);
+ case "Crystal Block Wall": // 186
+ return Color.FromRgb(38, 9, 66);
+ case "Luminite Brick Wall": // 224
+ return Color.FromRgb(57, 55, 52);
+ case "Silly Pink Balloon Wall": // 228
+ return Color.FromRgb(160, 2, 75);
+ case "Silly Purple Balloon Wall": // 229
+ return Color.FromRgb(100, 55, 164);
+ case "Silly Green Balloon Wall": // 230
+ return Color.FromRgb(0, 117, 101);
+ case "Glass Wall": // 21 (special case)
+ return Color.FromArgb(0, 0, 0, 0);
+ default:
+ return null;
+ }
+ });
- var colors = new[] { R, G, B };
- float max = colors.Max();
- float min = colors.Min();
+ #endregion
- switch (color)
+ #region ColorizeMap
+
+ // Cache of map colorized colors
+ static ConcurrentDictionary<(Color origColor, string colorName), Color> colorizeMapCache = new ConcurrentDictionary<(Color origColor, string colorName), Color>();
+
+ ///
+ /// Converts the current color into the map color given by the argument.
+ ///
+ ///
+ /// Conversions come from Terraria itself, specifically the Terraria.Map.MapHelper.MapColor() and Terraria.WorldGen.paintColor() methods.
+ ///
+ /// The color to convert the current color to.
+ /// The new map color after conversion.
+ public static Color ColorizeMap(this Color origColor, [Required] string colorName) => ColorExtension.colorizeMapCache.GetOrAdd((origColor, colorName), key =>
+ {
+ float R = origColor.R / 255.0f;
+ float G = origColor.G / 255.0f;
+ float B = origColor.B / 255.0f;
+ if (G > R)
+ Extensions.Swap(ref R, ref G);
+ if (B > R)
+ Extensions.Swap(ref R, ref B);
+
+ if (colorName == "Shadow")
+ return Color.FromArgb(origColor.A, (byte)(25 * B * 0.3f), (byte)(25 * B * 0.3f), (byte)(25 * B * 0.3f));
+ else if (colorName == "Negative")
+ return Color.FromArgb(origColor.A, (byte)((255f - origColor.R) / 2.0f), (byte)((255f - origColor.G) / 2.0f), (byte)((255f - origColor.B) / 2.0f));
+ else
+ {
+ Color? color = null;
+ switch (colorName)
{
case "Red":
- R = max;
- G = B = min;
- break;
- case "Orange":
- R = max;
- G = (max + min) / 2f;
- B = min;
- break;
- case "Yellow":
- R = G = max;
- B = min;
- break;
- case "Lime":
- R = (max + min) / 2f;
- G = max;
- B = min;
- break;
- case "Green":
- R = B = min;
- G = max;
- break;
- case "Teal":
- R = min;
- G = max;
- B = (min + max) / 2f;
- break;
- case "Cyan":
- R = min;
- G = B = max;
- break;
- case "Sky Blue":
- R = min;
- G = (max + min) / 2f;
- B = max;
- break;
- case "Blue":
- R = G = min;
- B = max;
- break;
- case "Purple":
- R = (max + min) / 2f;
- G = min;
- B = max;
- break;
- case "Violet":
- R = B = max;
- G = min;
- break;
- case "Pink":
- R = max;
- G = min;
- B = (max + min) / 2f;
- break;
case "Deep Red":
- R = max;
- G = B = min * 0.4f;
+ color = Color.FromRgb(255, 0, 0);
break;
+ case "Orange":
case "Deep Orange":
- R = max;
- G = (max + min * 0.4f) / 2f;
- B = min * 0.4f;
+ color = Color.FromRgb(255, 127, 0);
break;
+ case "Yellow":
case "Deep Yellow":
- R = G = max;
- B = min * 0.4f;
+ color = Color.FromRgb(255, 255, 0);
break;
+ case "Lime":
case "Deep Lime":
- R = (max + min * 0.4f) / 2f;
- G = max;
- B = min * 0.4f;
+ color = Color.FromRgb(127, 255, 0);
break;
+ case "Green":
case "Deep Green":
- R = B = min * 0.4f;
- G = max;
+ color = Color.FromRgb(0, 255, 0);
break;
+ case "Teal":
case "Deep Teal":
- R = min * 0.4f;
- G = max;
- B = (max + min * 0.4f) / 2f;
+ color = Color.FromRgb(0, 255, 127);
break;
+ case "Cyan":
case "Deep Cyan":
- R = min * 0.4f;
- G = B = max;
+ color = Color.FromRgb(0, 255, 255);
break;
+ case "Sky Blue":
case "Deep Sky Blue":
- R = min * 0.4f;
- G = (max + min * 0.4f) / 2f;
- B = max;
+ color = Color.FromRgb(0, 127, 255);
break;
+ case "Blue":
case "Deep Blue":
- R = G = min * 0.4f;
- B = max;
+ color = Color.FromRgb(0, 0, 255);
break;
+ case "Purple":
case "Deep Purple":
- R = (max + min * 0.4f) / 2f;
- G = min * 0.4f;
- B = max;
+ color = Color.FromRgb(127, 0, 255);
break;
+ case "Violet":
case "Deep Violet":
- R = B = max;
- G = min * 0.4f;
+ color = Color.FromRgb(255, 0, 255);
break;
+ case "Pink":
case "Deep Pink":
- R = max;
- G = min * 0.4f;
- B = (max + min * 0.4f) / 2f;
+ color = Color.FromRgb(255, 0, 127);
break;
case "Black":
- R = G = B = (max + min) * 0.15f;
+ color = Color.FromRgb(75, 75, 75);
break;
case "Gray":
- R = G = B = (max + min) / 2f;
+ color = Color.FromRgb(175, 175, 175);
break;
case "White":
- R = G = B = (max * 0.7f + min * 0.3f) * (2f - (max + min) / 2f);
+ color = Color.FromRgb(255, 255, 255);
break;
case "Brown":
- R = max;
- G = max * 0.7f;
- B = max * 0.49f;
- break;
- case "Shadow":
- R = G = B = (max + min) * 0.025f;
- break;
- case "Negative":
- R = 0.75f - 2.0f * R;
- G = 0.75f - 2.0f * G;
- B = 0.75f - 2.0f * B;
+ color = Color.FromRgb(255, 178, 125);
break;
}
-
- ColorExtension.cachedColorizeInGame[tuple] = ret = Color.FromArgb(origColor.A, (int)(R.Clamp(0f, 1f) * 255f), (int)(G.Clamp(0f, 1f) * 255f), (int)(B.Clamp(0f, 1f) * 255f));
+ return color.HasValue ? Color.FromArgb(origColor.A, (byte)(color.Value.R * R), (byte)(color.Value.G * R), (byte)(color.Value.B * R)) : origColor;
}
- return ret;
- }
+ });
- // Cache of map wall colors
- static Dictionary cachedMapWallColor = new Dictionary();
-
- ///
- /// Gets the map color for the given wall.
- ///
- ///
- /// Colors come from Terraria itself, specifically the 2-dimensional color array from Terraria.Map.MapHelper.Initialize() whose first dimension is the same size as the number of walls.
- ///
- /// The name of the wall to get the map color of.
- /// The map color for the given wall.
- public static Color? GetMapWallColor(string wallName)
- {
- Color? ret = null;
- if (!ColorExtension.cachedMapWallColor.TryGetValue(wallName, out ret))
- {
- switch (wallName)
- {
- case "Stone Wall": // 1
- case "Gray Brick Wall": // 5
- ret = Color.FromArgb(52, 52, 52);
- break;
- case "Wood Wall": // 4
- ret = Color.FromArgb(73, 51, 36);
- break;
- case "Red Brick Wall": // 6
- ret = Color.FromArgb(91, 30, 30);
- break;
- case "Gold Brick Wall": // 10
- ret = Color.FromArgb(74, 62, 12);
- break;
- case "Silver Brick Wall": // 11
- ret = Color.FromArgb(46, 56, 59);
- break;
- case "Copper Brick Wall": // 12
- ret = Color.FromArgb(75, 32, 11);
- break;
- case "Dirt Wall": // 16
- ret = Color.FromArgb(88, 61, 46);
- break;
- case "Blue Brick Wall": // 17
- ret = Color.FromArgb(27, 31, 42);
- break;
- case "Green Brick Wall": // 18
- ret = Color.FromArgb(31, 39, 26);
- break;
- case "Pink Brick Wall": // 19
- ret = Color.FromArgb(41, 28, 36);
- break;
- case "Obsidian Brick Wall": // 20
- ret = Color.FromArgb(15, 15, 15);
- break;
- case "Pearlstone Brick Wall": // 22
- ret = Color.FromArgb(113, 99, 99);
- break;
- case "Iridescent Brick Wall": // 23
- ret = Color.FromArgb(38, 38, 43);
- break;
- case "Mudstone Brick Wall": // 24
- ret = Color.FromArgb(53, 39, 41);
- break;
- case "Cobalt Brick Wall": // 25
- ret = Color.FromArgb(11, 35, 62);
- break;
- case "Mythril Brick Wall": // 26
- ret = Color.FromArgb(21, 63, 70);
- break;
- case "Candy Cane Wall": // 29
- ret = Color.FromArgb(88, 23, 23);
- break;
- case "Green Candy Cane Wall": // 30
- ret = Color.FromArgb(28, 88, 23);
- break;
- case "Snow Brick Wall": // 31
- ret = Color.FromArgb(78, 87, 99);
- break;
- case "Adamantite Beam Wall": // 32
- ret = Color.FromArgb(86, 17, 40);
- break;
- case "Demonite Brick Wall": // 33
- ret = Color.FromArgb(49, 47, 83);
- break;
- case "Sandstone Brick Wall": // 34
- case "Yellow Stucco Wall": // 37
- ret = Color.FromArgb(69, 67, 41);
- break;
- case "Ebonstone Brick Wall": // 35
- ret = Color.FromArgb(51, 51, 70);
- break;
- case "Red Stucco Wall": // 36
- ret = Color.FromArgb(87, 59, 55);
- break;
- case "Green Stucco Wall": // 38
- ret = Color.FromArgb(49, 57, 49);
- break;
- case "Gray Stucco Wall": // 39
- ret = Color.FromArgb(78, 79, 73);
- break;
- case "Ebonwood Wall": // 41
- ret = Color.FromArgb(52, 50, 62);
- break;
- case "Rich Mahogany Wall": // 42
- ret = Color.FromArgb(71, 42, 44);
- break;
- case "Pearlwood Wall": // 43
- ret = Color.FromArgb(73, 66, 50);
- break;
- case "Tin Brick Wall": // 45
- ret = Color.FromArgb(60, 59, 51);
- break;
- case "Tungsten Brick Wall": // 46
- ret = Color.FromArgb(48, 57, 47);
- break;
- case "Platinum Brick Wall": // 47
- ret = Color.FromArgb(71, 77, 85);
- break;
- case "Grass Wall": // 66
- case "Flower Wall": // 68
- ret = Color.FromArgb(30, 80, 48);
- break;
- case "Jungle Wall": // 67
- ret = Color.FromArgb(53, 80, 30);
- break;
- case "Cactus Wall": // 72
- ret = Color.FromArgb(52, 84, 12);
- break;
- case "Cloud Wall": // 73
- ret = Color.FromArgb(190, 204, 223);
- break;
- case "Mushroom Wall": // 74
- ret = Color.FromArgb(64, 62, 80);
- break;
- case "Bone Block Wall": // 75
- ret = Color.FromArgb(65, 65, 35);
- break;
- case "Slime Block Wall": // 76
- ret = Color.FromArgb(20, 46, 104);
- break;
- case "Flesh Block Wall": // 77
- ret = Color.FromArgb(61, 13, 16);
- break;
- case "Living Wood Wall": // 78
- ret = Color.FromArgb(63, 39, 26);
- break;
- case "Disc Wall": // 82
- ret = Color.FromArgb(77, 64, 34);
- break;
- case "Ice Brick Wall": // 84
- ret = Color.FromArgb(48, 78, 93);
- break;
- case "Shadewood Wall": // 85
- ret = Color.FromArgb(54, 63, 69);
- break;
- case "Blue Slab Wall": // 100
- ret = Color.FromArgb(32, 40, 45);
- break;
- case "Blue Tiled Wall": // 101
- ret = Color.FromArgb(44, 41, 50);
- break;
- case "Pink Slab Wall": // 102
- ret = Color.FromArgb(72, 50, 77);
- break;
- case "Pink Tiled Wall": // 103
- ret = Color.FromArgb(78, 50, 69);
- break;
- case "Green Slab Wall": // 104
- ret = Color.FromArgb(36, 45, 44);
- break;
- case "Green Tiled Wall": // 105
- ret = Color.FromArgb(38, 49, 50);
- break;
- case "Hive Wall": // 108
- ret = Color.FromArgb(138, 73, 38);
- break;
- case "Palladium Column Wall": // 109
- ret = Color.FromArgb(94, 25, 17);
- break;
- case "Bubblegum Block Wall": // 110
- ret = Color.FromArgb(125, 36, 122);
- break;
- case "Titanstone Block Wall": // 111
- ret = Color.FromArgb(51, 35, 27);
- break;
- case "Lihzahrd Brick Wall": // 112
- ret = Color.FromArgb(50, 15, 8);
- break;
- case "Pumpkin Wall": // 113
- ret = Color.FromArgb(135, 58, 0);
- break;
- case "Hay Wall": // 114
- ret = Color.FromArgb(65, 52, 15);
- break;
- case "Spooky Wood Wall": // 115
- ret = Color.FromArgb(39, 42, 51);
- break;
- case "Christmas Tree Wallpaper": // 116
- ret = Color.FromArgb(89, 26, 27);
- break;
- case "Ornament Wallpaper": // 117
- ret = Color.FromArgb(126, 123, 115);
- break;
- case "Candy Cane Wallpaper": // 118
- ret = Color.FromArgb(8, 50, 19);
- break;
- case "Festive Wallpaper": // 119
- ret = Color.FromArgb(95, 21, 24);
- break;
- case "Stars Wallpaper": // 120
- ret = Color.FromArgb(17, 31, 65);
- break;
- case "Squiggles Wallpaper": // 121
- ret = Color.FromArgb(192, 173, 143);
- break;
- case "Snowflake Wallpaper": // 122
- ret = Color.FromArgb(114, 114, 131);
- break;
- case "Krampus Horn Wallpaper": // 123
- ret = Color.FromArgb(136, 119, 7);
- break;
- case "Bluegreen Wallpaper": // 124
- ret = Color.FromArgb(8, 72, 3);
- break;
- case "Grinch Finger Wallpaper": // 125
- ret = Color.FromArgb(117, 132, 82);
- break;
- case "Fancy Gray Wallpaper": // 126
- ret = Color.FromArgb(100, 102, 114);
- break;
- case "Ice Floe Wallpaper": // 127
- ret = Color.FromArgb(30, 118, 226);
- break;
- case "Music Wallpaper": // 128
- ret = Color.FromArgb(93, 6, 102);
- break;
- case "Purple Rain Wallpaper": // 129
- ret = Color.FromArgb(64, 40, 169);
- break;
- case "Rainbow Wallpaper": // 130
- ret = Color.FromArgb(39, 34, 180);
- break;
- case "Sparkle Stone Wallpaper": // 131
- ret = Color.FromArgb(87, 94, 125);
- break;
- case "Starlit Heaven Wallpaper": // 132
- ret = Color.FromArgb(6, 6, 6);
- break;
- case "Bubble Wallpaper": // 133
- ret = Color.FromArgb(69, 72, 186);
- break;
- case "Copper Pipe Wallpaper": // 134
- ret = Color.FromArgb(130, 62, 16);
- break;
- case "Ducky Wallpaper": // 135
- ret = Color.FromArgb(22, 123, 163);
- break;
- case "White Dynasty Wall": // 142
- ret = Color.FromArgb(17, 172, 143);
- break;
- case "Blue Dynasty Wall": // 143
- ret = Color.FromArgb(90, 112, 105);
- break;
- case "Copper Plating Wall": // 146
- ret = Color.FromArgb(120, 59, 19);
- break;
- case "Stone Slab Wall": // 147
- ret = Color.FromArgb(59, 59, 59);
- break;
- case "Sail": // 148
- ret = Color.FromArgb(229, 218, 161);
- break;
- case "Boreal Wood Wall": // 149
- ret = Color.FromArgb(73, 59, 50);
- break;
- case "Palm Wood Wall": // 151
- ret = Color.FromArgb(102, 75, 34);
- break;
- case "Amber Gemspark Wall": // 153
- ret = Color.FromArgb(255, 145, 79);
- break;
- case "Amethyst Gemspark Wall": // 154
- ret = Color.FromArgb(221, 79, 255);
- break;
- case "Diamond Gemspark Wall": // 155
- ret = Color.FromArgb(240, 240, 247);
- break;
- case "Emerald Gemspark Wall": // 156
- ret = Color.FromArgb(79, 255, 89);
- break;
- case "Offline Amber Gemspark Wall": // 157
- ret = Color.FromArgb(154, 83, 49);
- break;
- case "Offline Amethyst Gemspark Wall": // 158
- ret = Color.FromArgb(107, 49, 154);
- break;
- case "Offline Diamond Gemspark Wall": // 159
- ret = Color.FromArgb(85, 89, 118);
- break;
- case "Offline Emerald Gemspark Wall": // 160
- ret = Color.FromArgb(49, 154, 68);
- break;
- case "Offline Ruby Gemspark Wall": // 161
- ret = Color.FromArgb(154, 49, 77);
- break;
- case "Offline Sapphire Gemspark Wall": // 162
- ret = Color.FromArgb(49, 49, 154);
- break;
- case "Offline Topaz Gemspark Wall": // 163
- ret = Color.FromArgb(154, 148, 49);
- break;
- case "Ruby Gemspark Wall": // 164
- ret = Color.FromArgb(255, 79, 79);
- break;
- case "Sapphire Gemspark Wall": // 165
- ret = Color.FromArgb(79, 102, 255);
- break;
- case "Topaz Gemspark Wall": // 166
- ret = Color.FromArgb(250, 255, 79);
- break;
- case "Tin Plating Wall": // 167
- ret = Color.FromArgb(70, 68, 51);
- break;
- case "Chlorophyte Brick Wall": // 173
- ret = Color.FromArgb(94, 163, 46);
- break;
- case "Crimtane Brick Wall": // 174
- ret = Color.FromArgb(117, 32, 59);
- break;
- case "Shroomite Plating Wall": // 175
- ret = Color.FromArgb(20, 11, 203);
- break;
- case "Martian Conduit Wall": // 176
- ret = Color.FromArgb(74, 69, 88);
- break;
- case "Hellstone Brick Wall": // 177
- ret = Color.FromArgb(60, 30, 30);
- break;
- case "Smooth Marble Wall": // 179
- case "Marble Wall": // 183
- ret = Color.FromArgb(111, 117, 135);
- break;
- case "Smooth Granite Wall": // 181
- case "Granite Wall": // 184
- ret = Color.FromArgb(25, 23, 54);
- break;
- case "Meteorite Brick Wall": // 182
- ret = Color.FromArgb(74, 71, 129);
- break;
- case "Crystal Block Wall": // 186
- ret = Color.FromArgb(38, 9, 66);
- break;
- case "Luminite Brick Wall": // 224
- ret = Color.FromArgb(57, 55, 52);
- break;
- case "Silly Pink Balloon Wall": // 228
- ret = Color.FromArgb(160, 2, 75);
- break;
- case "Silly Purple Balloon Wall": // 229
- ret = Color.FromArgb(100, 55, 164);
- break;
- case "Silly Green Balloon Wall": // 230
- ret = Color.FromArgb(0, 117, 101);
- break;
- case "Glass Wall": // 21 (special case)
- ret = Color.FromArgb(0, 0, 0, 0);
- break;
- default:
- ret = null;
- break;
- }
- ColorExtension.cachedMapWallColor[wallName] = ret;
- }
- return ret;
- }
-
- // Cache of map colorized colors
- static Dictionary, Color> cachedColorizeMap = new Dictionary, Color>();
-
- ///
- /// Converts the current color into the map color given by the argument.
- ///
- ///
- /// Conversions come from Terraria itself, specifically the Terraria.Map.MapHelper.MapColor() and Terraria.WorldGen.paintColor() methods.
- ///
- /// The color to convert the current color to.
- /// The new map color after conversion.
- public static Color ColorizeMap(this Color origColor, string colorName)
- {
- var tuple = Tuple.Create(origColor, colorName);
- Color ret;
- if (!ColorExtension.cachedColorizeMap.TryGetValue(tuple, out ret))
- {
- float R = origColor.R / 255.0f;
- float G = origColor.G / 255.0f;
- float B = origColor.B / 255.0f;
- if (G > R)
- Extensions.Swap(ref R, ref G);
- if (B > R)
- Extensions.Swap(ref R, ref B);
-
- if (colorName == "Shadow")
- ret = Color.FromArgb(origColor.A, (int)(25 * B * 0.3f), (int)(25 * B * 0.3f), (int)(25 * B * 0.3f));
- else if (colorName == "Negative")
- ret = Color.FromArgb(origColor.A, (int)((255f - origColor.R) / 2.0f), (int)((255f - origColor.G) / 2.0f), (int)((255f - origColor.B) / 2.0f));
- else
- {
- Color? color = null;
- switch (colorName)
- {
- case "Red":
- case "Deep Red":
- color = Color.FromArgb(255, 0, 0);
- break;
- case "Orange":
- case "Deep Orange":
- color = Color.FromArgb(255, 127, 0);
- break;
- case "Yellow":
- case "Deep Yellow":
- color = Color.FromArgb(255, 255, 0);
- break;
- case "Lime":
- case "Deep Lime":
- color = Color.FromArgb(127, 255, 0);
- break;
- case "Green":
- case "Deep Green":
- color = Color.FromArgb(0, 255, 0);
- break;
- case "Teal":
- case "Deep Teal":
- color = Color.FromArgb(0, 255, 127);
- break;
- case "Cyan":
- case "Deep Cyan":
- color = Color.FromArgb(0, 255, 255);
- break;
- case "Sky Blue":
- case "Deep Sky Blue":
- color = Color.FromArgb(0, 127, 255);
- break;
- case "Blue":
- case "Deep Blue":
- color = Color.FromArgb(0, 0, 255);
- break;
- case "Purple":
- case "Deep Purple":
- color = Color.FromArgb(127, 0, 255);
- break;
- case "Violet":
- case "Deep Violet":
- color = Color.FromArgb(255, 0, 255);
- break;
- case "Pink":
- case "Deep Pink":
- color = Color.FromArgb(255, 0, 127);
- break;
- case "Black":
- color = Color.FromArgb(75, 75, 75);
- break;
- case "Gray":
- color = Color.FromArgb(175, 175, 175);
- break;
- case "White":
- color = Color.FromArgb(255, 255, 255);
- break;
- case "Brown":
- color = Color.FromArgb(255, 178, 125);
- break;
- }
- if (color.HasValue)
- ret = Color.FromArgb(origColor.A, (int)(color.Value.R * R), (int)(color.Value.G * R), (int)(color.Value.B * R));
- else
- ret = origColor;
- }
- ColorExtension.cachedColorizeMap[tuple] = ret;
- }
- return ret;
- }
+ #endregion
}
}
diff --git a/ColorItem.cs b/ColorItem.cs
new file mode 100644
index 0000000..43cce80
--- /dev/null
+++ b/ColorItem.cs
@@ -0,0 +1,46 @@
+using System.Diagnostics;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using PostSharp.Patterns.Model;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// An item for the window that stores the data needed to display in the window, as well as distance for sorting purposes.
+ ///
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ [NotifyPropertyChanged]
+ internal class ColorItem
+ {
+ ///
+ /// The name of the color being used.
+ ///
+ public string ColorName { get; set; }
+
+ ///
+ /// The color being used.
+ ///
+ public Color WallColor { get; set; }
+
+ ///
+ /// The image of the wall+color for this item.
+ ///
+ public BitmapSource WallImage { get; set; }
+
+ ///
+ /// The name of the wall being used.
+ ///
+ public string WallName { get; set; }
+
+ ///
+ /// The distance that is from the original color.
+ ///
+ public double Distance { get; set; }
+
+ [DebuggerBrowsable(DebuggerBrowsableState.Never)]
+ string DebuggerDisplay => $"{{{this.WallName}, {this.ColorName}, {this.WallColor}, {this.Distance}}}";
+ }
+}
diff --git a/ColorToWall.Designer.cs b/ColorToWall.Designer.cs
deleted file mode 100644
index 66943bc..0000000
--- a/ColorToWall.Designer.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-namespace TerrariaPixelArtHelper
-{
- partial class ColorToWall
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.lblColor = new System.Windows.Forms.Label();
- this.pnlColor = new System.Windows.Forms.Panel();
- this.cbWallColor = new System.Windows.Forms.ComboBox();
- this.btnFindClosestColor = new System.Windows.Forms.Button();
- this.btnReset = new System.Windows.Forms.Button();
- this.lblNumberOfPixels = new System.Windows.Forms.Label();
- this.cbWall = new TerrariaPixelArtHelper.WallSelector();
- this.SuspendLayout();
- //
- // lblColor
- //
- this.lblColor.AutoSize = true;
- this.lblColor.Location = new System.Drawing.Point(4, 56);
- this.lblColor.MaximumSize = new System.Drawing.Size(103, 0);
- this.lblColor.MinimumSize = new System.Drawing.Size(103, 0);
- this.lblColor.Name = "lblColor";
- this.lblColor.Size = new System.Drawing.Size(103, 13);
- this.lblColor.TabIndex = 0;
- this.lblColor.Text = "(R, G, B, A)";
- this.lblColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // pnlColor
- //
- this.pnlColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlColor.Location = new System.Drawing.Point(18, 3);
- this.pnlColor.Name = "pnlColor";
- this.pnlColor.Size = new System.Drawing.Size(75, 50);
- this.pnlColor.TabIndex = 1;
- //
- // cbWallColor
- //
- this.cbWallColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cbWallColor.Enabled = false;
- this.cbWallColor.FormattingEnabled = true;
- this.cbWallColor.Location = new System.Drawing.Point(99, 31);
- this.cbWallColor.Name = "cbWallColor";
- this.cbWallColor.Size = new System.Drawing.Size(175, 21);
- this.cbWallColor.TabIndex = 3;
- this.cbWallColor.SelectedIndexChanged += new System.EventHandler(this.cbWallColor_SelectedIndexChanged);
- //
- // btnFindClosestColor
- //
- this.btnFindClosestColor.Location = new System.Drawing.Point(280, 3);
- this.btnFindClosestColor.Name = "btnFindClosestColor";
- this.btnFindClosestColor.Size = new System.Drawing.Size(61, 47);
- this.btnFindClosestColor.TabIndex = 4;
- this.btnFindClosestColor.Text = "Find Closest Color";
- this.btnFindClosestColor.UseVisualStyleBackColor = true;
- this.btnFindClosestColor.Click += new System.EventHandler(this.btnFindClosestColor_Click);
- //
- // btnReset
- //
- this.btnReset.Location = new System.Drawing.Point(280, 56);
- this.btnReset.Name = "btnReset";
- this.btnReset.Size = new System.Drawing.Size(61, 23);
- this.btnReset.TabIndex = 5;
- this.btnReset.Text = "Reset";
- this.btnReset.UseVisualStyleBackColor = true;
- this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
- //
- // lblNumberOfPixels
- //
- this.lblNumberOfPixels.AutoSize = true;
- this.lblNumberOfPixels.Location = new System.Drawing.Point(113, 56);
- this.lblNumberOfPixels.Name = "lblNumberOfPixels";
- this.lblNumberOfPixels.Size = new System.Drawing.Size(113, 13);
- this.lblNumberOfPixels.TabIndex = 6;
- this.lblNumberOfPixels.Text = "Number of Pixels: XXX";
- //
- // cbWall
- //
- this.cbWall.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
- this.cbWall.DropDownHeight = 200;
- this.cbWall.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cbWall.FormattingEnabled = true;
- this.cbWall.IntegralHeight = false;
- this.cbWall.Location = new System.Drawing.Point(99, 4);
- this.cbWall.Name = "cbWall";
- this.cbWall.Size = new System.Drawing.Size(175, 21);
- this.cbWall.TabIndex = 2;
- this.cbWall.SelectedIndexChanged += new System.EventHandler(this.cbWall_SelectedIndexChanged);
- //
- // ColorToWall
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.Controls.Add(this.lblNumberOfPixels);
- this.Controls.Add(this.btnReset);
- this.Controls.Add(this.btnFindClosestColor);
- this.Controls.Add(this.cbWallColor);
- this.Controls.Add(this.cbWall);
- this.Controls.Add(this.pnlColor);
- this.Controls.Add(this.lblColor);
- this.Name = "ColorToWall";
- this.Size = new System.Drawing.Size(347, 84);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label lblColor;
- private System.Windows.Forms.Panel pnlColor;
- private WallSelector cbWall;
- private System.Windows.Forms.ComboBox cbWallColor;
- private System.Windows.Forms.Button btnFindClosestColor;
- private System.Windows.Forms.Button btnReset;
- private System.Windows.Forms.Label lblNumberOfPixels;
- }
-}
diff --git a/ColorToWall.cs b/ColorToWall.cs
deleted file mode 100644
index 5a09c56..0000000
--- a/ColorToWall.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Drawing;
-using System.Linq;
-using System.Threading;
-using System.Windows.Forms;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- ///
- /// A user control to select a wall and wall color for a specific color from the original image.
- ///
- public partial class ColorToWall : UserControl
- {
- // List of acceptable walls (ones which can be crafted, placed by a user and which don't animate). Comes from items where Terraria.Item.createWall is set to a non-0 value.
- // Names of the walls come from Terraria.Lang and checking for the respective item IDs.
- static readonly List walls = new List()
- {
- "Stone Wall",
- "Wood Wall",
- "Gray Brick Wall",
- "Red Brick Wall",
- "Gold Brick Wall",
- "Silver Brick Wall",
- "Copper Brick Wall",
- "Dirt Wall",
- "Blue Brick Wall",
- "Green Brick Wall",
- "Pink Brick Wall",
- "Obsidian Brick Wall",
- "Glass Wall",
- "Pearlstone Brick Wall",
- "Iridescent Brick Wall",
- "Mudstone Brick Wall",
- "Cobalt Brick Wall",
- "Mythril Brick Wall",
- "Candy Cane Wall",
- "Green Candy Cane Wall",
- "Snow Brick Wall",
- "Adamantite Beam Wall",
- "Demonite Brick Wall",
- "Sandstone Brick Wall",
- "Ebonstone Brick Wall",
- "Red Stucco Wall",
- "Yellow Stucco Wall",
- "Green Stucco Wall",
- "Gray Stucco Wall",
- "Ebonwood Wall",
- "Rich Mahogany Wall",
- "Pearlwood Wall",
- "Tin Brick Wall",
- "Tungsten Brick Wall",
- "Platinum Brick Wall",
- "Grass Wall",
- "Jungle Wall",
- "Flower Wall",
- "Cactus Wall",
- "Cloud Wall",
- "Mushroom Wall",
- "Bone Block Wall",
- "Slime Block Wall",
- "Flesh Block Wall",
- "Living Wood Wall",
- "Disc Wall",
- "Ice Brick Wall",
- "Shadewood Wall",
- "Blue Slab Wall",
- "Blue Tiled Wall",
- "Pink Slab Wall",
- "Pink Tiled Wall",
- "Green Slab Wall",
- "Green Tiled Wall",
- "Hive Wall",
- "Palladium Column Wall",
- "Bubblegum Block Wall",
- "Titanstone Block Wall",
- "Lihzahrd Brick Wall",
- "Pumpkin Wall",
- "Hay Wall",
- "Spooky Wood Wall",
- "Christmas Tree Wallpaper",
- "Ornament Wallpaper",
- "Candy Cane Wallpaper",
- "Festive Wallpaper",
- "Stars Wallpaper",
- "Squiggles Wallpaper",
- "Snowflake Wallpaper",
- "Krampus Horn Wallpaper",
- "Bluegreen Wallpaper",
- "Grinch Finger Wallpaper",
- "Fancy Gray Wallpaper",
- "Ice Floe Wallpaper",
- "Music Wallpaper",
- "Purple Rain Wallpaper",
- "Rainbow Wallpaper",
- "Sparkle Stone Wallpaper",
- "Starlit Heaven Wallpaper",
- "Bubble Wallpaper",
- "Copper Pipe Wallpaper",
- "Ducky Wallpaper",
- "White Dynasty Wall",
- "Blue Dynasty Wall",
- "Copper Plating Wall",
- "Stone Slab Wall",
- "Sail",
- "Boreal Wood Wall",
- "Palm Wood Wall",
- "Amber Gemspark Wall",
- "Amethyst Gemspark Wall",
- "Diamond Gemspark Wall",
- "Emerald Gemspark Wall",
- "Offline Amber Gemspark Wall",
- "Offline Amethyst Gemspark Wall",
- "Offline Diamond Gemspark Wall",
- "Offline Emerald Gemspark Wall",
- "Offline Ruby Gemspark Wall",
- "Offline Sapphire Gemspark Wall",
- "Offline Topaz Gemspark Wall",
- "Ruby Gemspark Wall",
- "Sapphire Gemspark Wall",
- "Topaz Gemspark Wall",
- "Tin Plating Wall",
- "Chlorophyte Brick Wall",
- "Crimtane Brick Wall",
- "Shroomite Plating Wall",
- "Martian Conduit Wall",
- "Hellstone Brick Wall",
- "Smooth Marble Wall",
- "Smooth Granite Wall",
- "Meteorite Brick Wall",
- "Marble Wall",
- "Granite Wall",
- "Crystal Block Wall",
- "Luminite Brick Wall",
- "Silly Pink Balloon Wall",
- "Silly Purple Balloon Wall",
- "Silly Green Balloon Wall"
- };
- // List of acceptable colors. Comes from items where Terraria.Item.paint is set to a non-0 value.
- static readonly List colors = new List()
- {
- "Uncolored",
- "Red",
- "Orange",
- "Yellow",
- "Lime",
- "Green",
- "Teal",
- "Cyan",
- "Sky Blue",
- "Blue",
- "Purple",
- "Violet",
- "Pink",
- "Deep Red",
- "Deep Orange",
- "Deep Yellow",
- "Deep Lime",
- "Deep Green",
- "Deep Teal",
- "Deep Cyan",
- "Deep Sky Blue",
- "Deep Blue",
- "Deep Purple",
- "Deep Violet",
- "Deep Pink",
- "Black",
- "Gray",
- "White",
- "Brown",
- "Shadow",
- "Negative"
- };
-
- /// Read-only collection of the acceptable walls.
- public static ReadOnlyCollection Walls => ColorToWall.walls.AsReadOnly();
-
- /// Read-only collection of the acceptable colors.
- public static ReadOnlyCollection Colors => ColorToWall.colors.AsReadOnly();
-
- public ColorToWall()
- {
- this.InitializeComponent();
-
- // Order the acceptable walls by name and then insert a "No Wall" option at the start
- var thisWalls = ColorToWall.walls.OrderBy(w => w.Name).ToList();
- thisWalls.Insert(0, "No Wall");
- this.cbWall.DataSource = thisWalls;
-
- this.cbWallColor.DataSource = ColorToWall.colors.ToList();
- }
-
- ///
- /// Gets or sets the color associated to this control.
- ///
- public Color Color
- {
- get { return this.pnlColor.BackColor; }
- set
- {
- this.pnlColor.BackColor = value;
- this.UpdateColorLabel();
-
- if (value.A == 0)
- this.cbWall.SelectedIndex = (this.cbWall.DataSource as List).IndexOf("Glass Wall");
- }
- }
-
- ///
- /// Updates the label showing the current color.
- ///
- public void UpdateColorLabel() => this.lblColor.Text = FormattableString.Invariant($"({this.Color.R}, {this.Color.G}, {this.Color.B}, {this.Color.A})");
-
- int numberOfPixels = 0;
-
- ///
- /// Gets or sets the number of pixels that share the color associated to this control.
- ///
- public int NumberOfPixels
- {
- get { return this.numberOfPixels; }
- set
- {
- this.numberOfPixels = value;
- this.UpdateNumberOfPixelsLabel();
- }
- }
-
- ///
- /// Updates the label showing the number of pixels that share the current color.
- ///
- public void UpdateNumberOfPixelsLabel() => this.lblNumberOfPixels.Text = FormattableString.Invariant($"Number of Pixels: {this.NumberOfPixels}");
-
- /// Gets the current wall name.
- public string CurrentWallName => (this.cbWall.SelectedItem as WallItem).Name;
-
- /// Gets the current wall color name.
- public string CurrentColorName => this.cbWallColor.SelectedItem as string;
-
- ///
- /// Gets the full name of the wall that has been selected by this control, for use in the status bar when hovering over a tile.
- ///
- public string SelectedWall =>
- FormattableString.Invariant($"{(this.cbWall.SelectedItem as WallItem).Name}{(this.cbWall.SelectedIndex != 0 ? FormattableString.Invariant($", {this.CurrentColorName}") : "")}");
-
- // TODO: Somehow figure out how to make it so the flash can be stopped mid-way
-
- public void Flash(int interval, Color color, int flashes) => new Thread(() => this.FlashInternal(interval, color, flashes)).Start();
-
- public void UpdateControlBackColor(Color color)
- {
- if (this.InvokeRequired)
- this.Invoke((Action)this.UpdateControlBackColor, color);
- this.BackColor = color;
- }
-
- void FlashInternal(int interval, Color flashColor, int flashes)
- {
- var original = this.BackColor;
- for (int i = 0; i < flashes; ++i)
- {
- this.UpdateControlBackColor(flashColor);
- Thread.Sleep(interval / 2);
- this.UpdateControlBackColor(original);
- Thread.Sleep(interval / 2);
- }
- }
-
- public event EventHandler WallSelectorChanged;
-
- void cbWall_SelectedIndexChanged(object sender, EventArgs e)
- {
- string wallItemName = this.CurrentWallName;
- this.cbWallColor.Enabled = wallItemName != "No Wall";
-
- this.WallSelectorChanged?.Invoke(sender, new WallSelectorChangedEventArgs(this.Color, wallItemName, this.CurrentColorName));
- }
-
- public event EventHandler WallColorSelectorChanged;
-
- void cbWallColor_SelectedIndexChanged(object sender, EventArgs e) =>
- this.WallColorSelectorChanged?.Invoke(sender, new WallSelectorChangedEventArgs(this.Color, this.CurrentWallName, this.CurrentColorName));
-
- void btnFindClosestColor_Click(object sender, EventArgs e)
- {
- using (var findClosestColor = new FindClosestColor(this.Color))
- {
- if (findClosestColor.ShowDialog(this.Parent) == DialogResult.OK)
- {
- this.cbWall.SelectedItem = findClosestColor.SelectedColorItem.WallItem;
- this.cbWallColor.SelectedItem = findClosestColor.SelectedColorItem.Color;
- }
- }
- }
-
- void btnReset_Click(object sender, EventArgs e)
- {
- this.cbWallColor.SelectedItem = "Uncolored";
- this.cbWall.SelectedIndex = 0;
- }
- }
-
- ///
- /// The event data for use when a control has had its wall or wall color changed.
- ///
- public class WallSelectorChangedEventArgs : EventArgs
- {
- /// Gets the color of the wall selector.
- public Color Color { get; }
-
- /// Gets the wall name of the wall selector.
- public string WallName { get; }
-
- /// Gets the wall color name of the wall selector.
- public string ColorName { get; }
-
- public WallSelectorChangedEventArgs(Color color, string wallName, string colorName) : base()
- {
- this.Color = color;
- this.WallName = wallName;
- this.ColorName = colorName;
- }
- }
-}
diff --git a/ColorToWall.resx b/ColorToWall.resx
deleted file mode 100644
index 44e9f97..0000000
--- a/ColorToWall.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
diff --git a/ColorToWall.xaml b/ColorToWall.xaml
new file mode 100644
index 0000000..3f9ec75
--- /dev/null
+++ b/ColorToWall.xaml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ColorToWall.xaml.cs b/ColorToWall.xaml.cs
new file mode 100644
index 0000000..959a18e
--- /dev/null
+++ b/ColorToWall.xaml.cs
@@ -0,0 +1,375 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using PostSharp.Patterns.Model;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for ColorToWall.xaml
+ ///
+ public partial class ColorToWall : UserControl
+ {
+ #region Events
+
+ public static readonly RoutedEvent FlashEvent = EventManager.RegisterRoutedEvent(nameof(ColorToWall.Flash), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ColorToWall));
+
+ public static readonly RoutedEvent SelectedColorChangedEvent = EventManager.RegisterRoutedEvent(nameof(ColorToWall.SelectedColorChanged), RoutingStrategy.Bubble,
+ typeof(EventHandler), typeof(ColorToWall));
+
+ #endregion
+
+ // List of acceptable colors. Comes from items where Terraria.Item.paint is set to a non-0 value.
+ internal static readonly List colors = new List()
+ {
+ "Uncolored",
+ "Red",
+ "Orange",
+ "Yellow",
+ "Lime",
+ "Green",
+ "Teal",
+ "Cyan",
+ "Sky Blue",
+ "Blue",
+ "Purple",
+ "Violet",
+ "Pink",
+ "Deep Red",
+ "Deep Orange",
+ "Deep Yellow",
+ "Deep Lime",
+ "Deep Green",
+ "Deep Teal",
+ "Deep Cyan",
+ "Deep Sky Blue",
+ "Deep Blue",
+ "Deep Purple",
+ "Deep Violet",
+ "Deep Pink",
+ "Black",
+ "Gray",
+ "White",
+ "Brown",
+ "Shadow",
+ "Negative"
+ };
+
+ // Order the acceptable walls by name and then insert a "No Wall" option at the start.
+ internal static AsyncLazy> Walls => new AsyncLazy>(async () =>
+ {
+ // List of acceptable walls (ones which can be crafted, placed by a user and which don't animate). Comes from items where Terraria.Item.createWall is set to a non-0 value.
+ // Names of the walls come from Terraria.Lang and checking for the respective item IDs.
+ var wallItems = await Task.WhenAll(new List()
+ {
+ "Stone Wall",
+ "Wood Wall",
+ "Gray Brick Wall",
+ "Red Brick Wall",
+ "Gold Brick Wall",
+ "Silver Brick Wall",
+ "Copper Brick Wall",
+ "Dirt Wall",
+ "Blue Brick Wall",
+ "Green Brick Wall",
+ "Pink Brick Wall",
+ "Obsidian Brick Wall",
+ "Glass Wall",
+ "Pearlstone Brick Wall",
+ "Iridescent Brick Wall",
+ "Mudstone Brick Wall",
+ "Cobalt Brick Wall",
+ "Mythril Brick Wall",
+ "Candy Cane Wall",
+ "Green Candy Cane Wall",
+ "Snow Brick Wall",
+ "Adamantite Beam Wall",
+ "Demonite Brick Wall",
+ "Sandstone Brick Wall",
+ "Ebonstone Brick Wall",
+ "Red Stucco Wall",
+ "Yellow Stucco Wall",
+ "Green Stucco Wall",
+ "Gray Stucco Wall",
+ "Ebonwood Wall",
+ "Rich Mahogany Wall",
+ "Pearlwood Wall",
+ "Tin Brick Wall",
+ "Tungsten Brick Wall",
+ "Platinum Brick Wall",
+ "Grass Wall",
+ "Jungle Wall",
+ "Flower Wall",
+ "Cactus Wall",
+ "Cloud Wall",
+ "Mushroom Wall",
+ "Bone Block Wall",
+ "Slime Block Wall",
+ "Flesh Block Wall",
+ "Living Wood Wall",
+ "Disc Wall",
+ "Ice Brick Wall",
+ "Shadewood Wall",
+ "Blue Slab Wall",
+ "Blue Tiled Wall",
+ "Pink Slab Wall",
+ "Pink Tiled Wall",
+ "Green Slab Wall",
+ "Green Tiled Wall",
+ "Hive Wall",
+ "Palladium Column Wall",
+ "Bubblegum Block Wall",
+ "Titanstone Block Wall",
+ "Lihzahrd Brick Wall",
+ "Pumpkin Wall",
+ "Hay Wall",
+ "Spooky Wood Wall",
+ "Christmas Tree Wallpaper",
+ "Ornament Wallpaper",
+ "Candy Cane Wallpaper",
+ "Festive Wallpaper",
+ "Stars Wallpaper",
+ "Squiggles Wallpaper",
+ "Snowflake Wallpaper",
+ "Krampus Horn Wallpaper",
+ "Bluegreen Wallpaper",
+ "Grinch Finger Wallpaper",
+ "Fancy Gray Wallpaper",
+ "Ice Floe Wallpaper",
+ "Music Wallpaper",
+ "Purple Rain Wallpaper",
+ "Rainbow Wallpaper",
+ "Sparkle Stone Wallpaper",
+ "Starlit Heaven Wallpaper",
+ "Bubble Wallpaper",
+ "Copper Pipe Wallpaper",
+ "Ducky Wallpaper",
+ "White Dynasty Wall",
+ "Blue Dynasty Wall",
+ "Copper Plating Wall",
+ "Stone Slab Wall",
+ "Sail",
+ "Boreal Wood Wall",
+ "Palm Wood Wall",
+ "Amber Gemspark Wall",
+ "Amethyst Gemspark Wall",
+ "Diamond Gemspark Wall",
+ "Emerald Gemspark Wall",
+ "Offline Amber Gemspark Wall",
+ "Offline Amethyst Gemspark Wall",
+ "Offline Diamond Gemspark Wall",
+ "Offline Emerald Gemspark Wall",
+ "Offline Ruby Gemspark Wall",
+ "Offline Sapphire Gemspark Wall",
+ "Offline Topaz Gemspark Wall",
+ "Ruby Gemspark Wall",
+ "Sapphire Gemspark Wall",
+ "Topaz Gemspark Wall",
+ "Tin Plating Wall",
+ "Chlorophyte Brick Wall",
+ "Crimtane Brick Wall",
+ "Shroomite Plating Wall",
+ "Martian Conduit Wall",
+ "Hellstone Brick Wall",
+ "Smooth Marble Wall",
+ "Smooth Granite Wall",
+ "Meteorite Brick Wall",
+ "Marble Wall",
+ "Granite Wall",
+ "Crystal Block Wall",
+ "Luminite Brick Wall",
+ "Silly Pink Balloon Wall",
+ "Silly Purple Balloon Wall",
+ "Silly Green Balloon Wall"
+ }.OrderBy(w => w).Select(async w => await WallItem.Create(w)));
+ var wallItemsList = wallItems.ToList();
+ wallItemsList.Insert(0, await WallItem.Create("No Wall"));
+ return wallItemsList.AsReadOnly();
+ });
+
+ ///
+ /// Read-only collection of the acceptable colors.
+ ///
+ internal static ReadOnlyCollection Colors => ColorToWall.colors.AsReadOnly();
+
+ internal new ColorToWallViewModel DataContext => base.DataContext as ColorToWallViewModel;
+
+ ///
+ /// Adds or removes the event to flash the background of this control.
+ ///
+ public event RoutedEventHandler Flash
+ {
+ add { this.AddHandler(ColorToWall.FlashEvent, value); }
+ remove { this.AddHandler(ColorToWall.FlashEvent, value); }
+ }
+
+ bool ProcessColorChange { get; set; }
+
+ ///
+ /// Adds or removes the event for handling the selected color changing.
+ ///
+ public event EventHandler SelectedColorChanged
+ {
+ add { this.AddHandler(ColorToWall.SelectedColorChangedEvent, value); }
+ remove { this.RemoveHandler(ColorToWall.SelectedColorChangedEvent, value); }
+ }
+
+ ColorToWall() => this.InitializeComponent();
+
+ public static async Task Create(Color color, int numberOfPixels, EventHandler selectedColorChanged)
+ {
+ var colorToWall = new ColorToWall();
+ colorToWall.cbWall.ItemsSource = await ColorToWall.Walls;
+ colorToWall.cbWallColor.ItemsSource = ColorToWall.Colors;
+ colorToWall.DataContext.Color = colorToWall.DataContext.SelectedColor = color;
+ colorToWall.DataContext.NumberOfPixels = numberOfPixels;
+ colorToWall.SelectedColorChanged += selectedColorChanged;
+ colorToWall.ProcessColorChange = true;
+ if (color.A == 0)
+ {
+ colorToWall.DataContext.SelectedWall = await WallItem.Create("Glass Wall");
+ colorToWall.Wall_SelectionChanged(colorToWall, null);
+ }
+ return colorToWall;
+ }
+
+ public void DoFlash() => this.RaiseEvent(new RoutedEventArgs(ColorToWall.FlashEvent));
+
+ async void FindClosestColor_Click(object sender, RoutedEventArgs e)
+ {
+ // Show the overlay on the main window and show the Find Closest Color dialog box.
+ var mainWindow = Window.GetWindow(this) as MainWindow;
+ mainWindow.ShowOverlay(false);
+ var findClosestColor = await FindClosestColor.Create(this.DataContext.Color);
+ findClosestColor.Owner = mainWindow;
+ if (findClosestColor.ShowDialog() ?? false)
+ {
+ // This will only happen if the user clicked OK in the Find Closest Color dialog box.
+ this.ProcessColorChange = false;
+ this.DataContext.SelectedWall = await WallItem.Create(findClosestColor.DataContext.SelectedColorItem.WallName);
+ this.DataContext.SelectedWallColor = findClosestColor.DataContext.SelectedColorItem.ColorName;
+ this.ProcessColorChange = true;
+ this.Wall_SelectionChanged(this, null);
+ }
+ mainWindow.HideOverlay();
+ }
+
+ void RaiseSelectedColorChangedEvent() => this.RaiseEvent(new WallSelectorChangedEventArgs(this.DataContext.Color, this.DataContext.CurrentWallName, this.DataContext.SelectedWallColor,
+ ColorToWall.SelectedColorChangedEvent));
+
+ void ResetButton_Click(object sender, RoutedEventArgs e)
+ {
+ // Reset back to No Wall, Uncolored (this will also disable the wall color combobox).
+ this.ProcessColorChange = false;
+ this.DataContext.SelectedWallIndex = this.DataContext.SelectedWallColorIndex = 0;
+ this.ProcessColorChange = true;
+ this.Wall_SelectionChanged(this, null);
+ }
+
+ void Wall_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (this.ProcessColorChange)
+ {
+ // When either the wall or the wall color changes, update the selected color.
+ var wallColor = ColorExtension.GetMapWallColor(this.DataContext.CurrentWallName);
+ if (wallColor.HasValue)
+ wallColor = wallColor.Value.ColorizeMap(this.DataContext.SelectedWallColor);
+ this.DataContext.SelectedColor = wallColor ?? this.DataContext.Color;
+ this.RaiseSelectedColorChangedEvent();
+ }
+ }
+ }
+
+ ///
+ /// The view model for .
+ ///
+ internal class ColorToWallViewModel
+ {
+ ///
+ /// The color associated with the control.
+ ///
+ public Color Color { get; set; } = Colors.White;
+
+ ///
+ /// The text representation of the color.
+ ///
+ [SafeForDependencyAnalysis]
+ public string ColorText => $"({this.Color.R}, {this.Color.G}, {this.Color.B}, {this.Color.A})";
+
+ ///
+ /// The name of the currently selected wall.
+ ///
+ public string CurrentWallName => this.SelectedWall?.Name ?? "";
+
+ ///
+ /// The number of pixels that match the color.
+ ///
+ public int NumberOfPixels { get; set; }
+
+ ///
+ /// The color of the selected wall and wall color.
+ ///
+ public Color SelectedColor { get; set; } = Colors.DarkGray;
+
+ ///
+ /// The text representation of the selected color.
+ ///
+ [SafeForDependencyAnalysis]
+ public string SelectedColorText => $"({this.SelectedColor.R}, {this.SelectedColor.G}, {this.SelectedColor.B}, {this.SelectedColor.A})";
+
+ ///
+ /// The currently selected wall.
+ ///
+ public WallItem SelectedWall { get; set; }
+
+ ///
+ /// The currently selected wall color.
+ ///
+ public string SelectedWallColor { get; set; }
+
+ ///
+ /// The index of the currently selected wall color.
+ ///
+ public int SelectedWallColorIndex { get; set; }
+
+ ///
+ /// The index of the currently selected wall.
+ ///
+ public int SelectedWallIndex { get; set; }
+
+ ///
+ /// The name of the currently selected wall and if applicable, the currently selected wall color.
+ ///
+ public string SelectedWallName => $"{this.CurrentWallName}{(this.SelectedWallIndex != 0 ? $", {this.SelectedWallColor}" : "")}";
+ }
+
+ ///
+ /// The event data for use when a control has had its wall or wall color changed.
+ ///
+ public class WallSelectorChangedEventArgs : RoutedEventArgs
+ {
+ /// The color of the wall selector.
+ public Color Color { get; }
+
+ /// The wall name of the wall selector.
+ public string WallName { get; }
+
+ /// The wall color name of the wall selector.
+ public string ColorName { get; }
+
+ public WallSelectorChangedEventArgs(Color color, string wallName, string colorName, RoutedEvent routedEvent) : base(routedEvent)
+ {
+ this.Color = color;
+ this.WallName = wallName;
+ this.ColorName = colorName;
+ }
+ }
+}
diff --git a/Extensions.cs b/Extensions.cs
index 1830ca4..fec7911 100644
--- a/Extensions.cs
+++ b/Extensions.cs
@@ -1,13 +1,11 @@
using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
///
/// See Program.cs for license.
///
namespace TerrariaPixelArtHelper
{
- public static class Extensions
+ internal static class Extensions
{
///
/// Clamps a value between the minimum and maximum.
@@ -17,14 +15,23 @@ public static class Extensions
/// The minimum value to clamp to.
/// The maximum value to clamp to.
/// The clamped value.
- public static T Clamp(this T value, T min, T max) where T : IComparable
+ public static T Clamp(this T value, T min, T max) where T : IComparable => value.CompareTo(min) < 0 ? min : (value.CompareTo(max) > 0 ? max : value);
+
+ ///
+ /// Populates an array with a single value.
+ ///
+ ///
+ /// Comes from https://stackoverflow.com/a/1014015
+ ///
+ /// The type being operated on.
+ /// The array to populate.
+ /// The value to populate the array with.
+ /// The array, for chaining.
+ public static T[] Populate(this T[] array, T value)
{
- if (value.CompareTo(min) < 0)
- return min;
- else if (value.CompareTo(max) > 0)
- return max;
- else
- return value;
+ for (int i = 0; i < array.Length; ++i)
+ array[i] = value;
+ return array;
}
///
@@ -35,24 +42,9 @@ public static T Clamp(this T value, T min, T max) where T : IComparable
/// The second value to swap.
public static void Swap(ref T a, ref T b)
{
- T temp = a;
+ var temp = a;
a = b;
b = temp;
}
-
- ///
- /// Erases a portion of a Graphics object.
- /// Code comes from http://stackoverflow.com/a/8485524
- ///
- /// Graphics object to erase from.
- /// Rectangle to erase.
- public static void EraseRectangle(this Graphics g, Rectangle rect)
- {
- var compMode = g.CompositingMode;
- g.FillRectangle(Brushes.White, rect);
- g.CompositingMode = CompositingMode.SourceCopy;
- g.FillRectangle(Brushes.Transparent, rect);
- g.CompositingMode = compMode;
- }
}
}
diff --git a/FindClosestColor.Designer.cs b/FindClosestColor.Designer.cs
deleted file mode 100644
index 2bbd2e3..0000000
--- a/FindClosestColor.Designer.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-namespace TerrariaPixelArtHelper
-{
- partial class FindClosestColor
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.btnOK = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.pnlOriginalColor = new System.Windows.Forms.Panel();
- this.lblOriginalColor = new System.Windows.Forms.Label();
- this.pnlSelectedColor = new System.Windows.Forms.Panel();
- this.lblSelectedColor = new System.Windows.Forms.Label();
- this.lbColors = new System.Windows.Forms.ListBox();
- this.pnlWall = new System.Windows.Forms.Panel();
- this.lblOriginal = new System.Windows.Forms.Label();
- this.lblSelected = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // btnOK
- //
- this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.btnOK.Location = new System.Drawing.Point(125, 191);
- this.btnOK.Name = "btnOK";
- this.btnOK.Size = new System.Drawing.Size(75, 23);
- this.btnOK.TabIndex = 0;
- this.btnOK.Text = "OK";
- this.btnOK.UseVisualStyleBackColor = true;
- //
- // btnCancel
- //
- this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(206, 191);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 23);
- this.btnCancel.TabIndex = 1;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- //
- // pnlOriginalColor
- //
- this.pnlOriginalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlOriginalColor.Location = new System.Drawing.Point(22, 25);
- this.pnlOriginalColor.Name = "pnlOriginalColor";
- this.pnlOriginalColor.Size = new System.Drawing.Size(75, 50);
- this.pnlOriginalColor.TabIndex = 3;
- //
- // lblOriginalColor
- //
- this.lblOriginalColor.AutoSize = true;
- this.lblOriginalColor.Location = new System.Drawing.Point(8, 78);
- this.lblOriginalColor.MaximumSize = new System.Drawing.Size(103, 0);
- this.lblOriginalColor.MinimumSize = new System.Drawing.Size(103, 0);
- this.lblOriginalColor.Name = "lblOriginalColor";
- this.lblOriginalColor.Size = new System.Drawing.Size(103, 13);
- this.lblOriginalColor.TabIndex = 2;
- this.lblOriginalColor.Text = "(R, G, B, A)";
- this.lblOriginalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // pnlSelectedColor
- //
- this.pnlSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlSelectedColor.Location = new System.Drawing.Point(22, 112);
- this.pnlSelectedColor.Name = "pnlSelectedColor";
- this.pnlSelectedColor.Size = new System.Drawing.Size(75, 50);
- this.pnlSelectedColor.TabIndex = 5;
- //
- // lblSelectedColor
- //
- this.lblSelectedColor.AutoSize = true;
- this.lblSelectedColor.Location = new System.Drawing.Point(8, 165);
- this.lblSelectedColor.MaximumSize = new System.Drawing.Size(103, 0);
- this.lblSelectedColor.MinimumSize = new System.Drawing.Size(103, 0);
- this.lblSelectedColor.Name = "lblSelectedColor";
- this.lblSelectedColor.Size = new System.Drawing.Size(103, 13);
- this.lblSelectedColor.TabIndex = 4;
- this.lblSelectedColor.Text = "(R, G, B, A)";
- this.lblSelectedColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // lbColors
- //
- this.lbColors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.lbColors.DisplayMember = "DisplayMember";
- this.lbColors.FormattingEnabled = true;
- this.lbColors.Location = new System.Drawing.Point(125, 12);
- this.lbColors.Name = "lbColors";
- this.lbColors.Size = new System.Drawing.Size(156, 173);
- this.lbColors.TabIndex = 6;
- this.lbColors.SelectedIndexChanged += new System.EventHandler(this.lbColors_SelectedIndexChanged);
- //
- // pnlWall
- //
- this.pnlWall.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlWall.Location = new System.Drawing.Point(4, 112);
- this.pnlWall.Name = "pnlWall";
- this.pnlWall.Size = new System.Drawing.Size(16, 16);
- this.pnlWall.TabIndex = 7;
- //
- // lblOriginal
- //
- this.lblOriginal.AutoSize = true;
- this.lblOriginal.Location = new System.Drawing.Point(37, 9);
- this.lblOriginal.Name = "lblOriginal";
- this.lblOriginal.Size = new System.Drawing.Size(45, 13);
- this.lblOriginal.TabIndex = 8;
- this.lblOriginal.Text = "Original:";
- //
- // lblSelected
- //
- this.lblSelected.AutoSize = true;
- this.lblSelected.Location = new System.Drawing.Point(33, 96);
- this.lblSelected.Name = "lblSelected";
- this.lblSelected.Size = new System.Drawing.Size(52, 13);
- this.lblSelected.TabIndex = 9;
- this.lblSelected.Text = "Selected:";
- //
- // FindClosestColor
- //
- this.AcceptButton = this.btnOK;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(293, 226);
- this.Controls.Add(this.lblSelected);
- this.Controls.Add(this.lblOriginal);
- this.Controls.Add(this.pnlWall);
- this.Controls.Add(this.lbColors);
- this.Controls.Add(this.pnlSelectedColor);
- this.Controls.Add(this.lblSelectedColor);
- this.Controls.Add(this.pnlOriginalColor);
- this.Controls.Add(this.lblOriginalColor);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOK);
- this.DoubleBuffered = true;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "FindClosestColor";
- this.ShowInTaskbar = false;
- this.Text = "Find Closest Color";
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Button btnOK;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Panel pnlOriginalColor;
- private System.Windows.Forms.Label lblOriginalColor;
- private System.Windows.Forms.Panel pnlSelectedColor;
- private System.Windows.Forms.Label lblSelectedColor;
- private System.Windows.Forms.ListBox lbColors;
- private System.Windows.Forms.Panel pnlWall;
- private System.Windows.Forms.Label lblOriginal;
- private System.Windows.Forms.Label lblSelected;
- }
-}
diff --git a/FindClosestColor.cs b/FindClosestColor.cs
deleted file mode 100644
index 8397bd5..0000000
--- a/FindClosestColor.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Windows.Forms;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- ///
- /// A form to find the closest combination of wall and wall color to the given color.
- ///
- public partial class FindClosestColor : Form
- {
- internal struct CachedColorKey
- {
- public WallItem WallItem { get; set; }
-
- public string Color { get; set; }
-
- public override string ToString() => FormattableString.Invariant($"{{{this.WallItem}, {this.Color}}}");
- }
-
- internal struct CachedColorValue
- {
- public Color WallColor { get; set; }
-
- public LAB LABColor { get; set; }
-
- public override string ToString() => FormattableString.Invariant($"{{{this.WallColor}, {this.LABColor}}}");
- }
-
- public struct ColorItem : IEquatable
- {
- public WallItem WallItem { get; set; }
-
- public string Color { get; set; }
-
- public Color WallColor { get; set; }
-
- public double Distance { get; set; }
-
- public string DisplayMember => FormattableString.Invariant($"{this.WallItem}, {this.Color}");
-
- public override bool Equals(object obj) => obj != null && obj is ColorItem && this.Equals((ColorItem)obj);
-
- public bool Equals(ColorItem other) => this == other;
-
- public static bool operator==(ColorItem colorItem1, ColorItem colorItem2) => colorItem1.WallItem == colorItem2.WallItem && colorItem1.Color == colorItem2.Color &&
- colorItem1.WallColor == colorItem2.WallColor && colorItem1.Distance == colorItem2.Distance;
-
- public static bool operator!=(ColorItem colorItem1, ColorItem colorItem2) => !(colorItem1 == colorItem2);
-
- public override int GetHashCode() => this.WallItem.GetHashCode() ^ this.Color.GetHashCode() ^ this.WallColor.GetHashCode() ^ this.Distance.GetHashCode();
-
- public override string ToString() => FormattableString.Invariant($"{{{this.DisplayMember}, {this.WallColor}, {this.Distance}}}");
- }
-
- static Dictionary cachedColors = ColorToWall.Walls.Where(w => w.Name != "Glass Wall").SelectMany(w => ColorToWall.Colors, (w, c) =>
- {
- var wallColor = ColorExtension.GetMapWallColor(w.Name).Value.ColorizeMap(c);
- return new { w, c, wallColor = (Color)wallColor, labColor = LAB.FromRGB(wallColor) };
- }).ToDictionary(x => new CachedColorKey() { WallItem = x.w, Color = x.c }, x => new CachedColorValue() { WallColor = x.wallColor, LABColor = x.labColor });
-
- public FindClosestColor(Color originalColor)
- {
- this.InitializeComponent();
-
- var originalLAB = LAB.FromRGB(originalColor);
- var colors = FindClosestColor.cachedColors.Select(c => new ColorItem()
- {
- WallItem = c.Key.WallItem,
- Color = c.Key.Color,
- WallColor = c.Value.WallColor,
- Distance = LAB.Distance(originalLAB, c.Value.LABColor)
- }).OrderBy(c => c.Distance);
- var bestMatch = colors.First();
-
- this.lbColors.DataSource = colors.ToList();
-
- this.OriginalColor = originalColor;
- this.SelectedColor = bestMatch.WallColor;
- this.selectedColorItem = bestMatch;
- this.UpdateSelectedColorWall();
- }
-
- public Color OriginalColor
- {
- get { return this.pnlOriginalColor.BackColor; }
- set
- {
- this.pnlOriginalColor.BackColor = value;
- this.UpdateOriginalColorLabel();
- }
- }
-
- public void UpdateOriginalColorLabel() =>
- this.lblOriginalColor.Text = FormattableString.Invariant($"({this.OriginalColor.R}, {this.OriginalColor.G}, {this.OriginalColor.B}, {this.OriginalColor.A})");
-
- public Color SelectedColor
- {
- get { return this.pnlSelectedColor.BackColor; }
- set
- {
- this.pnlSelectedColor.BackColor = value;
- this.UpdateSelectedColorLabel();
- }
- }
-
- ColorItem selectedColorItem = new ColorItem();
-
- public ColorItem SelectedColorItem => this.selectedColorItem;
-
- public void UpdateSelectedColorLabel() =>
- this.lblSelectedColor.Text = FormattableString.Invariant($"({this.SelectedColor.R}, {this.SelectedColor.G}, {this.SelectedColor.B}, {this.SelectedColor.A})");
-
- public void UpdateSelectedColorWall() =>
- this.pnlWall.BackgroundImage = MainForm.GetWallFrame(this.selectedColorItem.WallItem.Name, this.selectedColorItem.Color, 0, 0, 0);
-
- void lbColors_SelectedIndexChanged(object sender, EventArgs e)
- {
- var color = (ColorItem)this.lbColors.SelectedItem;
- this.SelectedColor = color.WallColor;
- this.selectedColorItem = color;
- this.UpdateSelectedColorWall();
- }
- }
-}
diff --git a/FindClosestColor.resx b/FindClosestColor.resx
deleted file mode 100644
index 44e9f97..0000000
--- a/FindClosestColor.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
diff --git a/FindClosestColor.xaml b/FindClosestColor.xaml
new file mode 100644
index 0000000..99dd257
--- /dev/null
+++ b/FindClosestColor.xaml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FindClosestColor.xaml.cs b/FindClosestColor.xaml.cs
new file mode 100644
index 0000000..db5fab9
--- /dev/null
+++ b/FindClosestColor.xaml.cs
@@ -0,0 +1,109 @@
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using PostSharp.Patterns.Model;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for FindClosestColor.xaml
+ ///
+ public partial class FindClosestColor : Window
+ {
+ static AsyncLazy> cachedColors = new AsyncLazy>(async () =>
+ {
+ // This creates a cache for every possible wall+paint (except for No Wall and Glass Wall).
+ var walls = await ColorToWall.Walls;
+ var items = await Task.WhenAll(walls.Where(w => w.Name != "No Wall" && w.Name != "Glass Wall").SelectMany(c => ColorToWall.Colors, async (w, c) =>
+ {
+ var wallColor = ColorExtension.GetMapWallColor(w.Name).Value.ColorizeMap(c);
+ return new CachedColor()
+ {
+ ColorName = c,
+ LABColor = LAB.FromRGB(wallColor),
+ WallColor = wallColor,
+ WallImage = await App.GetWallFrame(w.Name, c, 0, 0, 0),
+ WallName = w.Name
+ };
+ }));
+ return items.ToList();
+ });
+
+ static readonly ConcurrentDictionary>> colorItemCache = new ConcurrentDictionary>>();
+
+ internal new FindClosestColorViewModel DataContext => base.DataContext as FindClosestColorViewModel;
+
+ static async Task> GetColors(Color color) => await FindClosestColor.colorItemCache.GetOrAdd(color, async key =>
+ {
+ // Find the L*a*b* color for the given color, find the distance between that and the L*a*b* colors for all wall+paint combinations and sort by the distance.
+ var originalLAB = LAB.FromRGB(color);
+ var cachedColors = await FindClosestColor.InitializeCache();
+ var unorderedColors = await Task.WhenAll(cachedColors.Select(async c => await Task.Run(() => new ColorItem()
+ {
+ ColorName = c.ColorName,
+ Distance = LAB.Distance(originalLAB, c.LABColor),
+ WallColor = c.WallColor,
+ WallImage = c.WallImage,
+ WallName = c.WallName
+ })));
+ return unorderedColors.OrderBy(c => c.Distance).ToList();
+ });
+
+ public static async Task Create(Color originalColor)
+ {
+ var findClosestColor = new FindClosestColor();
+ var colors = await FindClosestColor.GetColors(originalColor);
+
+ // Set the data to show.
+ findClosestColor.lbColors.ItemsSource = colors;
+ findClosestColor.DataContext.OriginalColor = originalColor;
+ findClosestColor.DataContext.SelectedColorItem = colors[0];
+
+ return findClosestColor;
+ }
+
+ public static async Task> InitializeCache() => await FindClosestColor.cachedColors;
+
+ FindClosestColor() => this.InitializeComponent();
+
+ void OK_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ this.Close();
+ }
+ }
+
+ ///
+ /// The view model for .
+ ///
+ internal class FindClosestColorViewModel
+ {
+ ///
+ /// The original color we are matching against.
+ ///
+ public Color OriginalColor { get; set; } = Colors.White;
+
+ ///
+ /// The text display of the original color.
+ ///
+ [SafeForDependencyAnalysis]
+ public string OriginalColorText => $"({this.OriginalColor.R}, {this.OriginalColor.G}, {this.OriginalColor.B}, {this.OriginalColor.A})";
+
+ ///
+ /// The currently selected .
+ ///
+ public ColorItem SelectedColorItem { get; set; } = new ColorItem();
+
+ ///
+ /// The text display of the selected 's wall color.
+ ///
+ [SafeForDependencyAnalysis]
+ public string SelectedColorText => $"({this.SelectedColorItem.WallColor.R}, {this.SelectedColorItem.WallColor.G}, {this.SelectedColorItem.WallColor.B}, {this.SelectedColorItem.WallColor.A})";
+ }
+}
diff --git a/Fonts/RobotoMono/LICENSE.txt b/Fonts/RobotoMono/LICENSE.txt
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/Fonts/RobotoMono/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Fonts/RobotoMono/RobotoMono-Regular.ttf b/Fonts/RobotoMono/RobotoMono-Regular.ttf
new file mode 100644
index 0000000..b158a33
Binary files /dev/null and b/Fonts/RobotoMono/RobotoMono-Regular.ttf differ
diff --git a/GridLineData.cs b/GridLineData.cs
new file mode 100644
index 0000000..7f3198d
--- /dev/null
+++ b/GridLineData.cs
@@ -0,0 +1,34 @@
+using PostSharp.Patterns.Model;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Holds the data for a grid line. Either both X1 and X2 will be the same or both Y1 and Y2 will be the same.
+ ///
+ [NotifyPropertyChanged]
+ internal class GridLineData
+ {
+ ///
+ /// Either the X coordinate of a vertical line or the left X coordinate of a horizontal line.
+ ///
+ public double X1 { get; set; }
+
+ ///
+ /// Either the X coordinate of a vertical line or the right X coordinate of a horizontal line.
+ ///
+ public double X2 { get; set; }
+
+ ///
+ /// Either the Y coordinate of a horizontal line or the top Y coordinate of a vertical line.
+ ///
+ public double Y1 { get; set; }
+
+ ///
+ /// Either the Y coordinate of a horizontal line or the bottom Y coordinate of a vertical line.
+ ///
+ public double Y2 { get; set; }
+ }
+}
diff --git a/LAB.cs b/LAB.cs
index 5b828b0..0c7f7aa 100644
--- a/LAB.cs
+++ b/LAB.cs
@@ -1,5 +1,6 @@
using System;
-using System.Drawing;
+using System.Diagnostics;
+using System.Windows.Media;
using MathNet.Numerics.LinearAlgebra;
///
@@ -14,6 +15,7 @@ namespace TerrariaPixelArtHelper
/// Because I have attempted to calculate the matrices for conversions from RGB to XYZ, I have noticed that some of my L*a*b* values are slightly different
/// compared to most converters I have seen online. I'm not sure if my calculations are more accurate or less accurate as a result.
///
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct LAB : IEquatable
{
/// Gets the L* value (lightness of the color).
@@ -25,6 +27,9 @@ public struct LAB : IEquatable
/// Gets the b* value (position between yellow and blue).
public double B { get; }
+ [DebuggerBrowsable(DebuggerBrowsableState.Never)]
+ string DebuggerDisplay => $"L: {this.L}, A: {this.A}, B: {this.B}";
+
public LAB(double l, double a, double b)
{
this.L = l;
@@ -44,6 +49,7 @@ public LAB(double l, double a, double b)
/// The white point chromaticity coordinate for CIE Illuminant D65.
///
///
+ /// Calculation follows the Computation section from here: https://en.wikipedia.org/wiki/Standard_illuminant#Illuminant_series_D
/// The values calculated here are slightly different from the chromaticity coordinate listed here: https://en.wikipedia.org/wiki/Illuminant_D65
///
static readonly Lazy wxy_chromaticity = new Lazy(() =>
@@ -98,7 +104,7 @@ public LAB(double l, double a, double b)
///
/// The x, y or z value to convert.
/// The converted value.
- static double XYZf(double t) => t > LAB.deltaCubed ? Math.Pow(t, 1.0 / 3.0) : t / (3 * LAB.deltaSquared) + 4.0 / 29.0;
+ static double XYZf(double t) => t > LAB.deltaCubed ? Math.Pow(t, 1.0 / 3.0) : t / (3 * LAB.deltaSquared) + 4.0 / 29.0;
///
/// Converts a color from the sRGB color space to the CIE L*a*b* color space.
@@ -107,16 +113,16 @@ public LAB(double l, double a, double b)
/// The color in the CIE L*a*b* color space.
public static LAB FromRGB(Color sRGB)
{
- // First we convert the color to CIE XYZ
+ // First we convert the color to CIE XYZ.
var XYZ = LAB.RGB_TO_XYZ * Matrix.Build.DenseOfColumnMajor(3, 1, new[] { LAB.sRGBToLinear(sRGB.R / 255.0), LAB.sRGBToLinear(sRGB.G / 255.0), LAB.sRGBToLinear(sRGB.B / 255.0) });
- // Then we apply the f(t) function to the CIE XYZ values with respect to the white point
+ // Then we apply the f(t) function to the CIE XYZ values with respect to the white point.
double x = LAB.XYZf(XYZ[0, 0] / LAB.D65[0]);
double y = LAB.XYZf(XYZ[1, 0] / LAB.D65[1]);
double z = LAB.XYZf(XYZ[2, 0] / LAB.D65[2]);
- // Finally we convert the color to CIE L*a*b*
- return new LAB((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z));
+ // Finally we convert the color to CIE L*a*b*.
+ return new LAB(116.0 * y - 16.0, 500.0 * (x - y), 200.0 * (y - z));
}
///
@@ -134,16 +140,14 @@ public static double Distance(LAB lab1, LAB lab2)
return Math.Sqrt(deltaL * deltaL + deltaA * deltaA + deltaB * deltaB);
}
- public override bool Equals(object obj) => obj != null && obj is LAB && this.Equals((LAB)obj);
+ public override bool Equals(object obj) => obj is LAB lab && this.Equals(lab);
public bool Equals(LAB other) => this == other;
- public static bool operator==(LAB lab1, LAB lab2) => lab1.L == lab2.L && lab1.A == lab2.A && lab1.B == lab2.B;
+ public static bool operator ==(LAB lab1, LAB lab2) => lab1.L == lab2.L && lab1.A == lab2.A && lab1.B == lab2.B;
- public static bool operator!=(LAB lab1, LAB lab2) => !(lab1 == lab2);
+ public static bool operator !=(LAB lab1, LAB lab2) => !(lab1 == lab2);
public override int GetHashCode() => this.L.GetHashCode() ^ this.A.GetHashCode() ^ this.B.GetHashCode();
-
- public override string ToString() => FormattableString.Invariant($"L: {this.L}, A: {this.A}, B: {this.B}");
}
}
diff --git a/LICENSE b/LICENSE
index 28832f4..184501f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2013-2017 Naram Qashat
+Copyright (c) 2013-2018 Naram Qashat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/LoadingOverlay.xaml b/LoadingOverlay.xaml
new file mode 100644
index 0000000..037e1fc
--- /dev/null
+++ b/LoadingOverlay.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LoadingOverlay.xaml.cs b/LoadingOverlay.xaml.cs
new file mode 100644
index 0000000..fb36c11
--- /dev/null
+++ b/LoadingOverlay.xaml.cs
@@ -0,0 +1,38 @@
+using System.Windows.Controls;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for LoadingOverlay.xaml
+ ///
+ public partial class LoadingOverlay : UserControl
+ {
+ internal new LoadingOverlayViewModel DataContext => base.DataContext as LoadingOverlayViewModel;
+
+ public LoadingOverlay() => this.InitializeComponent();
+ }
+
+ ///
+ /// The view model for .
+ ///
+ internal class LoadingOverlayViewModel
+ {
+ ///
+ /// Whether there is a wait message or not.
+ ///
+ public bool HasWaitMessage => !string.IsNullOrEmpty(this.WaitMessage);
+
+ ///
+ /// If the Please Wait message should be showing or not.
+ ///
+ public bool ShowPleaseWait { get; set; } = true;
+
+ ///
+ /// The optional wait message to show below "Please Wait".
+ ///
+ public string WaitMessage { get; set; }
+ }
+}
diff --git a/LockBitmap.cs b/LockBitmap.cs
deleted file mode 100644
index a9d75ea..0000000
--- a/LockBitmap.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Runtime.InteropServices;
-
-namespace TerrariaPixelArtHelper
-{
- ///
- /// A class to hold a lock on a bitmap to allow for easier manipulation of the pixels in the bitmap.
- ///
- public class LockBitmap
- {
- Bitmap source = null;
- BitmapData bitmapData = null;
-
- /// The byte array of all the pixels in the locked bitmap.
- byte[] Pixels { get; }
-
- /// The depth of the bitmap in bits per pixel.
- int Depth { get; }
-
- /// The stride width of the bitmap, which is how many pixels make up a single row.
- int Stride { get; set; } = -1;
-
- /// The width of the bitmap.
- public int Width { get; }
-
- /// The height of the bitmap.
- public int Height { get; }
-
- public LockBitmap(Bitmap source)
- {
- this.source = source;
-
- // Get source bitmap pixel format size
- this.Depth = Image.GetPixelFormatSize(this.source.PixelFormat);
-
- // Check if bpp (bits per pixel) is 8, 24, or 32
- if (this.Depth != 8 && this.Depth != 24 && this.Depth != 32)
- throw new ArgumentException("Only 8, 24, and 32 bpp images are supported.");
-
- // Get width and height of bitmap
- this.Width = this.source.Width;
- this.Height = this.source.Height;
-
- // Create byte array to copy pixel values
- this.Pixels = new byte[this.Width * this.Height * this.Depth / 8];
- }
-
- ///
- /// Locks the bitmap data so it can be accessed quickly.
- ///
- public void LockBits()
- {
- // Lock bitmap and return bitmap data
- this.bitmapData = this.source.LockBits(new Rectangle(0, 0, this.Width, this.Height), ImageLockMode.ReadWrite, this.source.PixelFormat);
- this.Stride = Math.Abs(this.bitmapData.Stride);
-
- // Copy data from pointer to array
- Marshal.Copy(this.bitmapData.Scan0, this.Pixels, 0, this.Pixels.Length);
- }
-
- ///
- /// Unlocks the bitmap data to write it back to the bitmap.
- ///
- public void UnlockBits()
- {
- // Copy data from byte array to pointer
- Marshal.Copy(this.Pixels, 0, this.bitmapData.Scan0, this.Pixels.Length);
-
- // Unlock bitmap data
- this.source.UnlockBits(this.bitmapData);
- this.Stride = -1;
- }
-
- ///
- /// Gets the color of the specified pixel.
- ///
- /// The X coordinate of the pixel to get.
- /// The Y coordinate of the pixel to get.
- /// The color at the specified pixel.
- public Color GetPixel(int x, int y)
- {
- // Get color components count
- int cCount = this.Depth / 8;
-
- // Get start index of the specified pixel
- int i = y * this.Stride + x * cCount;
-
- if (i > this.Pixels.Length - cCount)
- throw new IndexOutOfRangeException();
-
- if (this.Depth == 32)
- return Color.FromArgb(this.Pixels[i + 3], this.Pixels[i + 2], this.Pixels[i + 1], this.Pixels[i]);
- else if (this.Depth == 24)
- return Color.FromArgb(this.Pixels[i + 2], this.Pixels[i + 1], this.Pixels[i]);
- else
- {
- byte c = this.Pixels[i];
- return Color.FromArgb(c, c, c);
- }
- }
-
- ///
- /// Sets the color of the specified pixel.
- ///
- /// The X coordinate of the pixel to set.
- /// The Y coordinate of the pixel to set.
- /// The color to set at the specified pixel.
- public void SetPixel(int x, int y, Color color)
- {
- // Get color components count
- int cCount = this.Depth / 8;
-
- // Get start index of the specified pixel
- int i = y * this.Stride + x * cCount;
-
- if (i > this.Pixels.Length - cCount)
- throw new IndexOutOfRangeException();
-
- if (this.Depth == 32 || this.Depth == 24)
- {
- this.Pixels[i] = color.B;
- this.Pixels[i + 1] = color.G;
- this.Pixels[i + 2] = color.R;
- if (this.Depth == 32)
- this.Pixels[i + 3] = color.A;
- }
- else
- this.Pixels[i] = color.B;
- }
- }
-}
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
deleted file mode 100644
index 684de7b..0000000
--- a/MainForm.Designer.cs
+++ /dev/null
@@ -1,461 +0,0 @@
-namespace TerrariaPixelArtHelper
-{
- partial class MainForm
- {
-
- #region Windows Form Designer generated code
- private void InitializeComponent()
- {
- this.pnlInGame = new System.Windows.Forms.Panel();
- this.pnlMap = new System.Windows.Forms.Panel();
- this.flpColorToWall = new System.Windows.Forms.FlowLayoutPanel();
- this.MenuStrip = new System.Windows.Forms.MenuStrip();
- this.miFile = new System.Windows.Forms.ToolStripMenuItem();
- this.miOpenFromFile = new System.Windows.Forms.ToolStripMenuItem();
- this.miOpenFromClipboard = new System.Windows.Forms.ToolStripMenuItem();
- this.MenuSeparator1 = new System.Windows.Forms.ToolStripSeparator();
- this.miExit = new System.Windows.Forms.ToolStripMenuItem();
- this.miView = new System.Windows.Forms.ToolStripMenuItem();
- this.miToggleGrid = new System.Windows.Forms.ToolStripMenuItem();
- this.miHelp = new System.Windows.Forms.ToolStripMenuItem();
- this.miAbout = new System.Windows.Forms.ToolStripMenuItem();
- this.StatusStrip = new System.Windows.Forms.StatusStrip();
- this.tsslImageDimensions = new System.Windows.Forms.ToolStripStatusLabel();
- this.tsslPipe = new System.Windows.Forms.ToolStripStatusLabel();
- this.tsslCurrentPixel = new System.Windows.Forms.ToolStripStatusLabel();
- this.tbWalls = new System.Windows.Forms.TextBox();
- this.tlpImages = new System.Windows.Forms.TableLayoutPanel();
- this.lblInGame = new System.Windows.Forms.Label();
- this.lblMap = new System.Windows.Forms.Label();
- this.tbColors = new System.Windows.Forms.TextBox();
- this.lblToMake = new System.Windows.Forms.Label();
- this.lblWalls = new System.Windows.Forms.Label();
- this.lblColors = new System.Windows.Forms.Label();
- this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
- this.scImages = new System.Windows.Forms.SplitContainer();
- this.tlpNeeded = new System.Windows.Forms.TableLayoutPanel();
- this.pbInGameGrid = new System.Windows.Forms.PictureBox();
- this.pbInGame = new System.Windows.Forms.PictureBox();
- this.pbMapGrid = new System.Windows.Forms.PictureBox();
- this.pbMap = new System.Windows.Forms.PictureBox();
- this.pnlInGame.SuspendLayout();
- this.pnlMap.SuspendLayout();
- this.MenuStrip.SuspendLayout();
- this.StatusStrip.SuspendLayout();
- this.tlpImages.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.scImages)).BeginInit();
- this.scImages.Panel1.SuspendLayout();
- this.scImages.Panel2.SuspendLayout();
- this.scImages.SuspendLayout();
- this.tlpNeeded.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pbInGameGrid)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbInGame)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbMapGrid)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbMap)).BeginInit();
- this.SuspendLayout();
- //
- // pnlInGame
- //
- this.pnlInGame.AutoScroll = true;
- this.pnlInGame.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.pnlInGame.Controls.Add(this.pbInGameGrid);
- this.pnlInGame.Controls.Add(this.pbInGame);
- this.pnlInGame.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlInGame.Location = new System.Drawing.Point(3, 16);
- this.pnlInGame.Name = "pnlInGame";
- this.pnlInGame.Size = new System.Drawing.Size(341, 317);
- this.pnlInGame.TabIndex = 1;
- //
- // pnlMap
- //
- this.pnlMap.AutoScroll = true;
- this.pnlMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.pnlMap.Controls.Add(this.pbMapGrid);
- this.pnlMap.Controls.Add(this.pbMap);
- this.pnlMap.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlMap.Location = new System.Drawing.Point(350, 16);
- this.pnlMap.Name = "pnlMap";
- this.pnlMap.Size = new System.Drawing.Size(341, 317);
- this.pnlMap.TabIndex = 2;
- //
- // flpColorToWall
- //
- this.flpColorToWall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.flpColorToWall.AutoScroll = true;
- this.flpColorToWall.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.flpColorToWall.Location = new System.Drawing.Point(12, 27);
- this.flpColorToWall.Name = "flpColorToWall";
- this.flpColorToWall.Size = new System.Drawing.Size(374, 467);
- this.flpColorToWall.TabIndex = 3;
- //
- // MenuStrip
- //
- this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miFile,
- this.miView,
- this.miHelp});
- this.MenuStrip.Location = new System.Drawing.Point(0, 0);
- this.MenuStrip.Name = "MenuStrip";
- this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
- this.MenuStrip.Size = new System.Drawing.Size(1098, 24);
- this.MenuStrip.TabIndex = 4;
- //
- // miFile
- //
- this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miOpenFromFile,
- this.miOpenFromClipboard,
- this.MenuSeparator1,
- this.miExit});
- this.miFile.Name = "miFile";
- this.miFile.Size = new System.Drawing.Size(37, 20);
- this.miFile.Text = "&File";
- //
- // miOpenFromFile
- //
- this.miOpenFromFile.Name = "miOpenFromFile";
- this.miOpenFromFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
- this.miOpenFromFile.Size = new System.Drawing.Size(228, 22);
- this.miOpenFromFile.Text = "&Open from File...";
- this.miOpenFromFile.Click += new System.EventHandler(this.miOpenFromFile_Click);
- //
- // miOpenFromClipboard
- //
- this.miOpenFromClipboard.Name = "miOpenFromClipboard";
- this.miOpenFromClipboard.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
- this.miOpenFromClipboard.Size = new System.Drawing.Size(228, 22);
- this.miOpenFromClipboard.Text = "Open from &Clipboard";
- this.miOpenFromClipboard.Click += new System.EventHandler(this.miOpenFromClipboard_Click);
- //
- // MenuSeparator1
- //
- this.MenuSeparator1.Name = "MenuSeparator1";
- this.MenuSeparator1.Size = new System.Drawing.Size(225, 6);
- //
- // miExit
- //
- this.miExit.Name = "miExit";
- this.miExit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
- this.miExit.Size = new System.Drawing.Size(228, 22);
- this.miExit.Text = "E&xit";
- this.miExit.Click += new System.EventHandler(this.miExit_Click);
- //
- // miView
- //
- this.miView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miToggleGrid});
- this.miView.Name = "miView";
- this.miView.Size = new System.Drawing.Size(44, 20);
- this.miView.Text = "&View";
- //
- // miToggleGrid
- //
- this.miToggleGrid.Checked = true;
- this.miToggleGrid.CheckState = System.Windows.Forms.CheckState.Checked;
- this.miToggleGrid.Name = "miToggleGrid";
- this.miToggleGrid.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G)));
- this.miToggleGrid.Size = new System.Drawing.Size(177, 22);
- this.miToggleGrid.Text = "Toggle &Grid";
- this.miToggleGrid.Click += new System.EventHandler(this.miToggleGrid_Click);
- //
- // miHelp
- //
- this.miHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miAbout});
- this.miHelp.Name = "miHelp";
- this.miHelp.Size = new System.Drawing.Size(44, 20);
- this.miHelp.Text = "&Help";
- //
- // miAbout
- //
- this.miAbout.Name = "miAbout";
- this.miAbout.Size = new System.Drawing.Size(107, 22);
- this.miAbout.Text = "&About";
- this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
- //
- // StatusStrip
- //
- this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.tsslImageDimensions,
- this.tsslPipe,
- this.tsslCurrentPixel});
- this.StatusStrip.Location = new System.Drawing.Point(0, 496);
- this.StatusStrip.Name = "StatusStrip";
- this.StatusStrip.Size = new System.Drawing.Size(1098, 22);
- this.StatusStrip.TabIndex = 5;
- //
- // tsslImageDimensions
- //
- this.tsslImageDimensions.Name = "tsslImageDimensions";
- this.tsslImageDimensions.Size = new System.Drawing.Size(0, 17);
- //
- // tsslPipe
- //
- this.tsslPipe.Name = "tsslPipe";
- this.tsslPipe.Size = new System.Drawing.Size(10, 17);
- this.tsslPipe.Text = "|";
- this.tsslPipe.Visible = false;
- //
- // tsslCurrentPixel
- //
- this.tsslCurrentPixel.Name = "tsslCurrentPixel";
- this.tsslCurrentPixel.Size = new System.Drawing.Size(0, 17);
- //
- // tbWalls
- //
- this.tbWalls.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tbWalls.Location = new System.Drawing.Point(3, 29);
- this.tbWalls.Multiline = true;
- this.tbWalls.Name = "tbWalls";
- this.tbWalls.ReadOnly = true;
- this.tbWalls.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.tbWalls.Size = new System.Drawing.Size(341, 94);
- this.tbWalls.TabIndex = 6;
- this.tbWalls.TabStop = false;
- //
- // tlpImages
- //
- this.tlpImages.ColumnCount = 2;
- this.tlpImages.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tlpImages.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tlpImages.Controls.Add(this.pnlInGame, 0, 1);
- this.tlpImages.Controls.Add(this.pnlMap, 1, 1);
- this.tlpImages.Controls.Add(this.lblInGame, 0, 0);
- this.tlpImages.Controls.Add(this.lblMap, 1, 0);
- this.tlpImages.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tlpImages.Location = new System.Drawing.Point(0, 0);
- this.tlpImages.Name = "tlpImages";
- this.tlpImages.RowCount = 2;
- this.tlpImages.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tlpImages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tlpImages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tlpImages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tlpImages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tlpImages.Size = new System.Drawing.Size(694, 336);
- this.tlpImages.TabIndex = 7;
- //
- // lblInGame
- //
- this.lblInGame.AutoSize = true;
- this.lblInGame.Location = new System.Drawing.Point(3, 0);
- this.lblInGame.Name = "lblInGame";
- this.lblInGame.Size = new System.Drawing.Size(50, 13);
- this.lblInGame.TabIndex = 3;
- this.lblInGame.Text = "In-Game:";
- //
- // lblMap
- //
- this.lblMap.AutoSize = true;
- this.lblMap.Location = new System.Drawing.Point(350, 0);
- this.lblMap.Name = "lblMap";
- this.lblMap.Size = new System.Drawing.Size(31, 13);
- this.lblMap.TabIndex = 4;
- this.lblMap.Text = "Map:";
- //
- // tbColors
- //
- this.tbColors.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tbColors.Location = new System.Drawing.Point(350, 29);
- this.tbColors.Multiline = true;
- this.tbColors.Name = "tbColors";
- this.tbColors.ReadOnly = true;
- this.tbColors.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.tbColors.Size = new System.Drawing.Size(341, 94);
- this.tbColors.TabIndex = 10;
- this.tbColors.TabStop = false;
- //
- // lblToMake
- //
- this.lblToMake.AutoSize = true;
- this.tlpNeeded.SetColumnSpan(this.lblToMake, 2);
- this.lblToMake.Location = new System.Drawing.Point(3, 0);
- this.lblToMake.Name = "lblToMake";
- this.lblToMake.Size = new System.Drawing.Size(159, 13);
- this.lblToMake.TabIndex = 7;
- this.lblToMake.Text = "To make the above, you\'ll need:";
- //
- // lblWalls
- //
- this.lblWalls.AutoSize = true;
- this.lblWalls.Location = new System.Drawing.Point(3, 13);
- this.lblWalls.Name = "lblWalls";
- this.lblWalls.Size = new System.Drawing.Size(36, 13);
- this.lblWalls.TabIndex = 8;
- this.lblWalls.Text = "Walls:";
- //
- // lblColors
- //
- this.lblColors.AutoSize = true;
- this.lblColors.Location = new System.Drawing.Point(350, 13);
- this.lblColors.Name = "lblColors";
- this.lblColors.Size = new System.Drawing.Size(39, 13);
- this.lblColors.TabIndex = 9;
- this.lblColors.Text = "Colors:";
- //
- // OpenFileDialog
- //
- this.OpenFileDialog.ReadOnlyChecked = true;
- this.OpenFileDialog.SupportMultiDottedExtensions = true;
- //
- // scImages
- //
- this.scImages.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.scImages.Location = new System.Drawing.Point(392, 27);
- this.scImages.Name = "scImages";
- this.scImages.Orientation = System.Windows.Forms.Orientation.Horizontal;
- //
- // scImages.Panel1
- //
- this.scImages.Panel1.Controls.Add(this.tlpImages);
- //
- // scImages.Panel2
- //
- this.scImages.Panel2.Controls.Add(this.tlpNeeded);
- this.scImages.Size = new System.Drawing.Size(694, 466);
- this.scImages.SplitterDistance = 336;
- this.scImages.TabIndex = 8;
- //
- // tlpNeeded
- //
- this.tlpNeeded.ColumnCount = 2;
- this.tlpNeeded.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tlpNeeded.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tlpNeeded.Controls.Add(this.tbColors, 1, 2);
- this.tlpNeeded.Controls.Add(this.lblToMake, 0, 0);
- this.tlpNeeded.Controls.Add(this.lblWalls, 0, 1);
- this.tlpNeeded.Controls.Add(this.tbWalls, 0, 2);
- this.tlpNeeded.Controls.Add(this.lblColors, 1, 1);
- this.tlpNeeded.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tlpNeeded.Location = new System.Drawing.Point(0, 0);
- this.tlpNeeded.Name = "tlpNeeded";
- this.tlpNeeded.RowCount = 3;
- this.tlpNeeded.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tlpNeeded.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tlpNeeded.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tlpNeeded.Size = new System.Drawing.Size(694, 126);
- this.tlpNeeded.TabIndex = 0;
- //
- // pbInGameGrid
- //
- this.pbInGameGrid.BackColor = System.Drawing.Color.Transparent;
- this.pbInGameGrid.Enabled = false;
- this.pbInGameGrid.Location = new System.Drawing.Point(0, 0);
- this.pbInGameGrid.Name = "pbInGameGrid";
- this.pbInGameGrid.Size = new System.Drawing.Size(0, 0);
- this.pbInGameGrid.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pbInGameGrid.TabIndex = 1;
- this.pbInGameGrid.TabStop = false;
- //
- // pbInGame
- //
- this.pbInGame.Location = new System.Drawing.Point(0, 0);
- this.pbInGame.Name = "pbInGame";
- this.pbInGame.Size = new System.Drawing.Size(0, 0);
- this.pbInGame.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pbInGame.TabIndex = 0;
- this.pbInGame.TabStop = false;
- this.pbInGame.Click += new System.EventHandler(this.pictureBox_Click);
- this.pbInGame.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox_Paint);
- this.pbInGame.MouseLeave += new System.EventHandler(this.pictureBox_MouseLeave);
- this.pbInGame.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picutreBox_MouseMove);
- //
- // pbMapGrid
- //
- this.pbMapGrid.BackColor = System.Drawing.Color.Transparent;
- this.pbMapGrid.Enabled = false;
- this.pbMapGrid.Location = new System.Drawing.Point(0, 0);
- this.pbMapGrid.Name = "pbMapGrid";
- this.pbMapGrid.Size = new System.Drawing.Size(0, 0);
- this.pbMapGrid.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pbMapGrid.TabIndex = 1;
- this.pbMapGrid.TabStop = false;
- //
- // pbMap
- //
- this.pbMap.Location = new System.Drawing.Point(0, 0);
- this.pbMap.Name = "pbMap";
- this.pbMap.Size = new System.Drawing.Size(0, 0);
- this.pbMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pbMap.TabIndex = 0;
- this.pbMap.TabStop = false;
- this.pbMap.Click += new System.EventHandler(this.pictureBox_Click);
- this.pbMap.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox_Paint);
- this.pbMap.MouseLeave += new System.EventHandler(this.pictureBox_MouseLeave);
- this.pbMap.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picutreBox_MouseMove);
- //
- // MainForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1098, 518);
- this.Controls.Add(this.scImages);
- this.Controls.Add(this.StatusStrip);
- this.Controls.Add(this.flpColorToWall);
- this.Controls.Add(this.MenuStrip);
- this.DoubleBuffered = true;
- this.MainMenuStrip = this.MenuStrip;
- this.Name = "MainForm";
- this.Text = "Terraria Pixel Art Helper";
- this.pnlInGame.ResumeLayout(false);
- this.pnlInGame.PerformLayout();
- this.pnlMap.ResumeLayout(false);
- this.pnlMap.PerformLayout();
- this.MenuStrip.ResumeLayout(false);
- this.MenuStrip.PerformLayout();
- this.StatusStrip.ResumeLayout(false);
- this.StatusStrip.PerformLayout();
- this.tlpImages.ResumeLayout(false);
- this.tlpImages.PerformLayout();
- this.scImages.Panel1.ResumeLayout(false);
- this.scImages.Panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.scImages)).EndInit();
- this.scImages.ResumeLayout(false);
- this.tlpNeeded.ResumeLayout(false);
- this.tlpNeeded.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pbInGameGrid)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbInGame)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbMapGrid)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pbMap)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
- #endregion
- private System.Windows.Forms.Panel pnlInGame;
- private System.Windows.Forms.PictureBox pbInGame;
- private System.Windows.Forms.Panel pnlMap;
- private System.Windows.Forms.PictureBox pbMap;
- private System.Windows.Forms.FlowLayoutPanel flpColorToWall;
- private System.Windows.Forms.MenuStrip MenuStrip;
- private System.Windows.Forms.ToolStripMenuItem miFile;
- private System.Windows.Forms.ToolStripMenuItem miOpenFromFile;
- private System.Windows.Forms.ToolStripMenuItem miExit;
- private System.Windows.Forms.ToolStripMenuItem miHelp;
- private System.Windows.Forms.ToolStripMenuItem miAbout;
- private System.Windows.Forms.ToolStripSeparator MenuSeparator1;
- private System.Windows.Forms.StatusStrip StatusStrip;
- private System.Windows.Forms.TextBox tbWalls;
- private System.Windows.Forms.TableLayoutPanel tlpImages;
- private System.Windows.Forms.OpenFileDialog OpenFileDialog;
- private System.Windows.Forms.ToolStripMenuItem miOpenFromClipboard;
- private System.Windows.Forms.ToolStripStatusLabel tsslCurrentPixel;
- private System.Windows.Forms.Label lblInGame;
- private System.Windows.Forms.Label lblMap;
- private System.Windows.Forms.TextBox tbColors;
- private System.Windows.Forms.Label lblToMake;
- private System.Windows.Forms.Label lblWalls;
- private System.Windows.Forms.Label lblColors;
- private System.Windows.Forms.PictureBox pbInGameGrid;
- private System.Windows.Forms.PictureBox pbMapGrid;
- private System.Windows.Forms.ToolStripMenuItem miView;
- private System.Windows.Forms.ToolStripMenuItem miToggleGrid;
- private System.Windows.Forms.ToolStripStatusLabel tsslImageDimensions;
- private System.Windows.Forms.ToolStripStatusLabel tsslPipe;
- private System.Windows.Forms.TableLayoutPanel tlpNeeded;
- private System.Windows.Forms.SplitContainer scImages;
- }
-}
-
diff --git a/MainForm.cs b/MainForm.cs
deleted file mode 100644
index e2af5ac..0000000
--- a/MainForm.cs
+++ /dev/null
@@ -1,430 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.IO;
-using System.Linq;
-using System.Windows.Forms;
-using nQuant;
-using TerrariaPixelArtHelper.Properties;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- public partial class MainForm : Form
- {
- static Dictionary cachedColorBlocks = new Dictionary();
- static Dictionary, Bitmap> cachedColorWalls = new Dictionary, Bitmap>();
- static Dictionary, Bitmap> cachedColorMapWalls = new Dictionary, Bitmap>();
- static Bitmap currentBitmap = null;
- static Dictionary currentImageColors = new Dictionary();
- static Dictionary currentWallInfo = new Dictionary();
-
- static Random rand = new Random();
-
- struct BitmapData
- {
- public Bitmap ZoomedBitmap { get; set; }
-
- public Dictionary Colors { get; set; }
-
- public Dictionary WallInfo { get; set; }
- }
-
- class WallInfo
- {
- public string WallName { get; set; }
-
- public int WallFrame { get; set; }
- }
-
- ///
- /// Will convert an image to be 32bpp, if necessary.
- ///
- /// The original bitmap. It will be disposed if replaced, so use only the return value.
- /// The new image in 32bpp, if necessary.
- static Bitmap Make32BPPBitmap(Bitmap origBitmap)
- {
- if (origBitmap.PixelFormat != PixelFormat.Format32bppArgb)
- {
- var newBitmap = new Bitmap(origBitmap.Width, origBitmap.Height, PixelFormat.Format32bppArgb);
- using (var g = Graphics.FromImage(newBitmap))
- g.DrawImage(origBitmap, new Rectangle(0, 0, origBitmap.Width, origBitmap.Height));
- origBitmap.Dispose();
- return newBitmap;
- }
- else
- return origBitmap;
- }
-
- public MainForm()
- {
- this.InitializeComponent();
-
- using (var ms = new MemoryStream(Resources.Eyedropper))
- this.pbInGame.Cursor = this.pbMap.Cursor = new Cursor(ms);
-
- this.tbWalls.Font = new Font(FontFamily.GenericMonospace, this.tbWalls.Font.Size);
- this.tbColors.Font = new Font(FontFamily.GenericMonospace, this.tbColors.Font.Size);
-
- // The grid controls are added to the non-grid controls as children so transparency can be used. This cannot be done in the designer, which is why it is done here instead.
- this.pbInGame.Controls.Add(this.pbInGameGrid);
- this.pbMap.Controls.Add(this.pbMapGrid);
- }
-
- void colorToWall_WallSelectorChanged(object sender, WallSelectorChangedEventArgs e)
- {
- var locked = new LockBitmap(MainForm.currentBitmap);
- locked.LockBits();
-
- var color = (Color)e.Color;
-
- using (var g1 = Graphics.FromImage(this.pbInGame.Image))
- using (var g2 = Graphics.FromImage(this.pbMap.Image))
- for (int x = 0; x < locked.Width; ++x)
- for (int y = 0; y < locked.Height; ++y)
- {
- if (locked.GetPixel(x, y) != color)
- continue;
-
- // Using the existing wall frame or getting a random one comes from Terraria.Framing.WallFrame().
- var point = new Point(x, y);
- var wallInfo = MainForm.currentWallInfo[point];
- int wallFrameNum;
- if (wallInfo != null && wallInfo.WallName == e.WallName)
- wallFrameNum = wallInfo.WallFrame;
- else
- wallFrameNum = MainForm.rand.Next(0, 2);
-
- var wallFrame = MainForm.GetWallFrame(e.WallName, e.ColorName, x, y, wallFrameNum);
- if (wallFrame == null)
- {
- MainForm.currentWallInfo[point] = null;
- wallFrame = MainForm.cachedColorBlocks[e.Color];
- }
- else
- MainForm.currentWallInfo[point] = new WallInfo()
- {
- WallName = e.WallName,
- WallFrame = wallFrameNum
- };
-
- g1.EraseRectangle(new Rectangle(x * 16, y * 16, 16, 16));
- g1.DrawImage(wallFrame, x * 16, y * 16);
-
- var mapWall = MainForm.GetColoredMapWall(e.WallName, e.ColorName);
- if (mapWall == null)
- mapWall = MainForm.cachedColorBlocks[e.Color];
-
- g2.EraseRectangle(new Rectangle(x * 16, y * 16, 16, 16));
- g2.DrawImage(mapWall, x * 16, y * 16);
- }
-
- locked.UnlockBits();
-
- this.pbInGame.Invalidate();
- this.pbMap.Invalidate();
-
- this.UpdateNeededWallsAndColors();
- }
-
- void pictureBox_Click(object sender, EventArgs e)
- {
- if (MainForm.currentBitmap == null)
- return;
- var mouseArgs = e as MouseEventArgs;
- int x = mouseArgs.X / 16;
- int y = mouseArgs.Y / 16;
- var color = MainForm.currentBitmap.GetPixel(x, y);
- int colorIndex = MainForm.currentImageColors.Keys.ToList().IndexOf(color);
- (this.flpColorToWall.Controls[colorIndex] as ColorToWall).Flash(500, Color.Red, 3);
- this.flpColorToWall.ScrollControlIntoView(this.flpColorToWall.Controls[colorIndex]);
- }
-
- // The following 2 variables plus the function come from http://stackoverflow.com/a/1041986
- Point prevPanel1Pos = new Point();
- Point prevPanel2Pos = new Point();
-
- void pictureBox_Paint(object sender, PaintEventArgs e)
- {
- if (this.pnlInGame.AutoScrollPosition != this.prevPanel1Pos)
- {
- this.pnlMap.AutoScrollPosition = new Point(-this.pnlInGame.AutoScrollPosition.X, -this.pnlInGame.AutoScrollPosition.Y);
- this.prevPanel1Pos = this.pnlInGame.AutoScrollPosition;
- }
- else if (this.pnlMap.AutoScrollPosition != this.prevPanel2Pos)
- {
- this.pnlInGame.AutoScrollPosition = new Point(-this.pnlMap.AutoScrollPosition.X, -this.pnlMap.AutoScrollPosition.Y);
- this.prevPanel2Pos = this.pnlMap.AutoScrollPosition;
- }
- }
-
- void picutreBox_MouseMove(object sender, MouseEventArgs e)
- {
- if (MainForm.currentBitmap == null)
- return;
- int x = e.X / 16;
- int y = e.Y / 16;
- if (x == MainForm.currentBitmap.Width || y == MainForm.currentBitmap.Height)
- return;
- var color = MainForm.currentBitmap.GetPixel(x, y);
- int colorIndex = MainForm.currentImageColors.Keys.ToList().IndexOf(color);
- var colorToWall = this.flpColorToWall.Controls[colorIndex] as ColorToWall;
- this.tsslPipe.Visible = true;
- this.tsslCurrentPixel.Text = FormattableString.Invariant($"Current Pixel: {x}, {y} | Currently Selected Wall: {colorToWall.SelectedWall}");
- }
-
- void pictureBox_MouseLeave(object sender, EventArgs e)
- {
- this.tsslPipe.Visible = false;
- this.tsslCurrentPixel.Text = "";
- }
-
- void miExit_Click(object sender, EventArgs e) => this.Close();
-
- void HandleImage(Bitmap origBitmap)
- {
- origBitmap = MainForm.Make32BPPBitmap(origBitmap);
- var bitmapData = MainForm.ZoomBy16(origBitmap);
-
- if (bitmapData.Colors.Count > 256 &&
- MessageBox.Show(this, "The selected image contains over 256 colors. Would you like to reduce its color count?\n\n(If you select No, it may take forever to handle this image.)",
- "Color count too high", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
- {
- var quantizer = new WuQuantizer();
- var newBitmap = quantizer.QuantizeImage(origBitmap) as Bitmap;
- origBitmap.Dispose();
- origBitmap = MainForm.Make32BPPBitmap(newBitmap);
- bitmapData = MainForm.ZoomBy16(origBitmap);
- }
-
- this.tsslImageDimensions.Text = FormattableString.Invariant($"Image Size: {origBitmap.Width}x{origBitmap.Height}");
-
- var gridBitmap = new Bitmap(bitmapData.ZoomedBitmap.Width + 1, bitmapData.ZoomedBitmap.Height + 1, PixelFormat.Format32bppArgb);
- using (var g = Graphics.FromImage(gridBitmap))
- using (var pen = new Pen(Color.Black, 1)
- {
- DashStyle = DashStyle.Dash
- })
- {
- for (int x = 0; x <= origBitmap.Width; ++x)
- g.DrawLine(pen, new Point(x * 16, 0), new Point(x * 16, bitmapData.ZoomedBitmap.Height + 1));
- for (int y = 0; y <= origBitmap.Height; ++y)
- g.DrawLine(pen, new Point(0, y * 16), new Point(bitmapData.ZoomedBitmap.Width + 1, y * 16));
- }
-
- var zoomedBitmapExtra = new Bitmap(bitmapData.ZoomedBitmap.Width + 1, bitmapData.ZoomedBitmap.Height + 1, PixelFormat.Format32bppArgb);
- using (var g = Graphics.FromImage(zoomedBitmapExtra))
- g.DrawImage(bitmapData.ZoomedBitmap, new Point(0, 0));
-
- this.pbInGame.Image = new Bitmap(zoomedBitmapExtra);
- this.pbMap.Image = new Bitmap(zoomedBitmapExtra);
- this.pbInGameGrid.Image = new Bitmap(gridBitmap);
- this.pbMapGrid.Image = new Bitmap(gridBitmap);
-
- MainForm.currentBitmap = origBitmap;
- MainForm.currentImageColors = bitmapData.Colors;
- MainForm.currentWallInfo = bitmapData.WallInfo;
- this.flpColorToWall.Controls.Clear();
- this.flpColorToWall.SuspendLayout();
- foreach (var color in bitmapData.Colors)
- {
- var colorToWall = new ColorToWall();
- colorToWall.WallSelectorChanged += this.colorToWall_WallSelectorChanged;
- colorToWall.WallColorSelectorChanged += this.colorToWall_WallSelectorChanged;
- colorToWall.Color = color.Key;
- colorToWall.NumberOfPixels = color.Value;
- this.flpColorToWall.Controls.Add(colorToWall);
- }
- this.flpColorToWall.ResumeLayout();
-
- this.UpdateNeededWallsAndColors();
- }
-
- void miOpenFromFile_Click(object sender, EventArgs e)
- {
- // TODO: An error if the opened file isn't an image
-
- if (this.OpenFileDialog.ShowDialog() == DialogResult.OK)
- {
- var origBitmap = Image.FromFile(this.OpenFileDialog.FileName) as Bitmap;
- if (origBitmap != null)
- this.HandleImage(origBitmap);
- }
- }
-
- void miOpenFromClipboard_Click(object sender, EventArgs e)
- {
- // TODO: An error if the clipboard doesn't contain an image
-
- try
- {
- var data = Clipboard.GetDataObject();
- var newBitmap = Image.FromStream(data.GetData(data.GetFormats()[0]) as MemoryStream) as Bitmap;
- if (newBitmap != null)
- this.HandleImage(newBitmap);
- }
- catch
- {
- }
- }
-
- void miToggleGrid_Click(object sender, EventArgs e) => this.pbInGameGrid.Visible = this.pbMapGrid.Visible = this.miToggleGrid.Checked = !this.miToggleGrid.Checked;
-
- void miAbout_Click(object sender, EventArgs e) =>
- MessageBox.Show(this, "Terraria Pixel Art Helper\nBy: Naram Qashat (CyberBotX)", "About", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
-
- void UpdateNeededWallsAndColors()
- {
- var wallPixels = new Dictionary();
- var colorPixels = new Dictionary();
- foreach (ColorToWall colorToWall in this.flpColorToWall.Controls)
- {
- string wallName = colorToWall.CurrentWallName;
- if (wallName != "No Wall")
- {
- if (!wallPixels.ContainsKey(wallName))
- wallPixels[wallName] = 0;
- wallPixels[wallName] += colorToWall.NumberOfPixels;
- string colorName = colorToWall.CurrentColorName;
- if (colorName != "Uncolored")
- {
- if (!colorPixels.ContainsKey(colorName))
- colorPixels[colorName] = 0;
- colorPixels[colorName] += colorToWall.NumberOfPixels;
- }
- }
- }
- this.tbWalls.Clear();
- this.tbColors.Clear();
- if (wallPixels.Count != 0)
- this.tbWalls.Text = string.Join(Environment.NewLine, wallPixels.OrderBy(wp => wp.Key).Select(wp => FormattableString.Invariant($"{wp.Key}: {wp.Value}")));
- if (colorPixels.Count != 0)
- this.tbColors.Text = string.Join(Environment.NewLine, colorPixels.OrderBy(cp => ColorToWall.Colors.IndexOf(cp.Key)).Select(cp => FormattableString.Invariant($"{cp.Key}: {cp.Value}")));
- }
-
- internal static Bitmap GetWall(string wallName) => Resources.ResourceManager.GetObject(FormattableString.Invariant($"Wall_{wallName.Replace(" ", "")}"), Resources.Culture) as Bitmap;
-
- static Bitmap GetColoredWall(string wallName, string color)
- {
- var wallTuple = Tuple.Create(wallName, color);
- Bitmap wallBitmap;
- if (!MainForm.cachedColorWalls.TryGetValue(wallTuple, out wallBitmap))
- {
- wallBitmap = MainForm.GetWall(wallName);
-
- if (color != "Uncolored" && wallBitmap != null)
- {
- var locked = new LockBitmap(wallBitmap);
- locked.LockBits();
-
- for (int x = 0; x < locked.Width; ++x)
- for (int y = 0; y < locked.Height; ++y)
- locked.SetPixel(x, y, locked.GetPixel(x, y).ColorizeInGame(color));
-
- locked.UnlockBits();
- }
-
- MainForm.cachedColorWalls[wallTuple] = wallBitmap;
- }
- return wallBitmap;
- }
-
- internal static Bitmap GetWallFrame(string wallName, string color, int i, int j, int frame)
- {
- var wallBitmap = MainForm.GetColoredWall(wallName, color);
- if (wallBitmap == null)
- return null;
-
- // This section for picking y comes from the part of Terraria.Framing (partially the WallFrame() method) that picks a wall frame based on the X and Y coordinates of the tile
- int x = frame, y = -1;
- if (i % 3 == 1 && j % 3 == 1)
- y = 1;
- else if (i % 3 == 0 && j % 3 == 0)
- y = 2;
- else if (i % 3 == 2 && j % 3 == 1)
- y = 3;
- else if (i % 3 == 1 && j % 3 == 2)
- y = 4;
- else
- y = 0;
-
- var wallFrame = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
- using (var g = Graphics.FromImage(wallFrame))
- g.DrawImage(wallBitmap, 0, 0, new Rectangle(x * 16, y * 16, 16, 16), GraphicsUnit.Pixel);
-
- return wallFrame;
- }
-
- static Bitmap GetColoredMapWall(string wallName, string color)
- {
- var wallTuple = Tuple.Create(wallName, color);
- Bitmap wallBitmap;
- if (!MainForm.cachedColorMapWalls.TryGetValue(wallTuple, out wallBitmap))
- {
- var wallColor = ColorExtension.GetMapWallColor(wallName);
- if (wallColor.HasValue)
- wallColor = wallColor.Value.ColorizeMap(color);
-
- wallBitmap = null;
-
- if (wallColor.HasValue)
- {
- wallBitmap = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
- using (var g = Graphics.FromImage(wallBitmap))
- using (var brush = new SolidBrush(wallColor.Value))
- g.FillRectangle(brush, 0, 0, 16, 16);
- }
-
- MainForm.cachedColorMapWalls[wallTuple] = wallBitmap;
- }
- return wallBitmap;
- }
-
- static BitmapData ZoomBy16(Bitmap orig)
- {
- var zoomed = new Bitmap(orig.Width * 16, orig.Height * 16, orig.PixelFormat);
- var locked = new LockBitmap(orig);
- locked.LockBits();
-
- MainForm.cachedColorBlocks = new Dictionary();
- var colors = new Dictionary();
- var wallInfo = new Dictionary();
- using (var zoomg = Graphics.FromImage(zoomed))
- for (int x = 0; x < locked.Width; ++x)
- for (int y = 0; y < locked.Height; ++y)
- {
- var color = locked.GetPixel(x, y);
- if (!colors.ContainsKey(color))
- colors.Add(color, 1);
- else
- ++colors[color];
-
- wallInfo.Add(new Point(x, y), null);
-
- Bitmap fill;
- if (!MainForm.cachedColorBlocks.TryGetValue(color, out fill))
- {
- fill = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
- using (var fillg = Graphics.FromImage(fill))
- using (var brush = new SolidBrush(color))
- fillg.FillRectangle(brush, 0, 0, 16, 16);
- MainForm.cachedColorBlocks[color] = fill;
- }
- zoomg.DrawImage(fill, x * 16, y * 16);
- }
-
- locked.UnlockBits();
-
- return new BitmapData()
- {
- ZoomedBitmap = zoomed,
- Colors = colors,
- WallInfo = wallInfo
- };
- }
- }
-}
diff --git a/MainForm.resx b/MainForm.resx
deleted file mode 100644
index 656809e..0000000
--- a/MainForm.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 125, 17
-
-
- 235, 17
-
-
diff --git a/MainWindow.xaml b/MainWindow.xaml
new file mode 100644
index 0000000..7c8a07c
--- /dev/null
+++ b/MainWindow.xaml
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
new file mode 100644
index 0000000..8603458
--- /dev/null
+++ b/MainWindow.xaml.cs
@@ -0,0 +1,484 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using JeremyAnsel.ColorQuant;
+using Microsoft.Win32;
+using PostSharp.Patterns.Contracts;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ #region Commands
+
+ public static readonly RoutedUICommand AboutCommand = new RoutedUICommand("_About", "About", typeof(MainWindow));
+
+ public static readonly RoutedUICommand ToggleGridCommand = new RoutedUICommand("Toggle _Grid", "ToggleGrid", typeof(MainWindow), new InputGestureCollection(new[]
+ {
+ new KeyGesture(Key.G, ModifierKeys.Control)
+ }));
+
+ #endregion
+
+ static readonly Random rand = new Random();
+
+ new MainWindowViewModel DataContext => base.DataContext as MainWindowViewModel;
+
+ public MainWindow() => this.InitializeComponent();
+
+ void About_Executed(object sender, ExecutedRoutedEventArgs e) => new About()
+ {
+ Owner = this
+ }.ShowDialog();
+
+ void Close_Executed(object sender, ExecutedRoutedEventArgs e) => this.Close();
+
+ async void ColorToWall_SelectedColorChanged(object sender, WallSelectorChangedEventArgs e)
+ {
+ // Check if we have an image loaded first.
+ var bitmapData = this.DataContext.CurrentBitmapData;
+ if (bitmapData == null)
+ return;
+
+ int width = this.DataContext.ImageWidth;
+ int height = this.DataContext.ImageHeight;
+ // Get the pixels into temporary arrays in order to allow use to write all the pixels in a thread to avoid slowdowns from block copying to the writeable bitmap.
+ int[] inGamePixels = new int[width * height * 256];
+ using (var context = this.DataContext.InGameBitmap.GetBitmapContext(ReadWriteMode.ReadOnly))
+ BitmapContext.BlockCopy(context, 0, inGamePixels, 0, width * height * 1024);
+ int[] mapPixels = new int[width * height * 256];
+ using (var context = this.DataContext.MapBitmap.GetBitmapContext(ReadWriteMode.ReadOnly))
+ BitmapContext.BlockCopy(context, 0, mapPixels, 0, width * height * 1024);
+ await Task.Run(async () =>
+ {
+ // Loop over all the pixels of the image.
+ for (int x = 0; x < width; ++x)
+ for (int y = 0; y < height; ++y)
+ {
+ // Check if the pixel's color matches the color that was just changed.
+ var wallInfo = bitmapData.PixelInfo[(x, y)];
+ if (wallInfo.Color != e.Color)
+ continue;
+
+ // Using the existing wall frame or getting a random one comes from Terraria.Framing.WallFrame().
+ int wallFrameNum = wallInfo.WallName == e.WallName ? wallInfo.WallFrame : MainWindow.rand.Next(0, 3);
+
+ // Get the in-game wall frame (or the original color).
+ int[] wallFramePixels = await App.GetWallFramePixels(e.WallName, e.ColorName, x, y, wallFrameNum);
+ if (wallFramePixels == null)
+ {
+ wallInfo.WallName = null;
+ wallFramePixels = bitmapData.CachedColorPixels[e.Color];
+ }
+ else
+ {
+ wallInfo.WallName = e.WallName;
+ wallInfo.WallFrame = wallFrameNum;
+ }
+
+ // Update the in-game image with the wall frame.
+ await PixelManip.CopyFrom16x16(wallFramePixels, inGamePixels, x, y, width);
+
+ // Get the map wall (or the original color).
+ int[] mapWallPixels = await App.GetColoredMapWallPixels(e.WallName, e.ColorName);
+ if (mapWallPixels == null)
+ mapWallPixels = bitmapData.CachedColorPixels[e.Color];
+
+ // Update the map image with the wall.
+ await PixelManip.CopyFrom16x16(mapWallPixels, mapPixels, x, y, width);
+ }
+ });
+
+ using (var context = this.DataContext.InGameBitmap.GetBitmapContext())
+ BitmapContext.BlockCopy(inGamePixels, 0, context, 0, width * height * 1024);
+ using (var context = this.DataContext.MapBitmap.GetBitmapContext())
+ BitmapContext.BlockCopy(mapPixels, 0, context, 0, width * height * 1024);
+
+ inGamePixels = null;
+ mapPixels = null;
+
+ this.UpdateNeededWallsAndColors();
+ }
+
+ async Task HandleImage([Required] BitmapSource origBitmap)
+ {
+ this.ShowOverlay(true, "Processing Image...");
+
+ // Check if the image is in BGRA format, if not, convert it.
+ if (origBitmap.Format != PixelFormats.Bgra32 || origBitmap.Format != PixelFormats.Pbgra32)
+ {
+ origBitmap = new FormatConvertedBitmap(origBitmap, PixelFormats.Bgra32, null, 0);
+ origBitmap.Freeze();
+ }
+
+ // Zoom the image.
+ var bitmapData = await App.ZoomBy16(origBitmap);
+
+ int imageWidth = origBitmap.PixelWidth;
+ int imageHeight = origBitmap.PixelHeight;
+
+ // If the image has more than 256 colors, inform the user and give them the option to reduce the color count.
+ if (bitmapData.Colors.Count > 256)
+ {
+ var response = MessageBox.Show(this, "The selected image contains over 256 colors. Would you like to reduce its color count?\n\n(If you select No, it may take a long time to handle this image and the program may possibly crash from having not enough memory.)",
+ "Color count too high", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);
+ if (response == MessageBoxResult.Yes)
+ {
+ // If the user wants to reduce the color count, use a quantizer to do so.
+ var quantizer = new WuAlphaColorQuantizer();
+ byte[] bitmapBytes = new byte[origBitmap.PixelWidth * origBitmap.PixelHeight * 4];
+ origBitmap.CopyPixels(bitmapBytes, origBitmap.PixelWidth * 4, 0);
+ origBitmap = await Task.Run(() =>
+ {
+ var result = quantizer.Quantize(bitmapBytes);
+ // This will create an indexed bitmap from the palette and bytes of the quantizer's result, then convert that into a BGRA image.
+ var newIndexedBitmap = BitmapSource.Create(imageWidth, imageHeight, 96, 96, PixelFormats.Indexed8, new BitmapPalette(Enumerable.Range(0, 256).Select(i =>
+ Color.FromArgb(result.Palette[i * 4 + 3], result.Palette[i * 4 + 2], result.Palette[i * 4 + 1], result.Palette[i * 4])).ToArray()), result.Bytes, imageWidth);
+ newIndexedBitmap.Freeze();
+ var newBitmap = new FormatConvertedBitmap(newIndexedBitmap, PixelFormats.Bgra32, null, 0);
+ newBitmap.Freeze();
+ return newBitmap;
+ });
+ bitmapData = await App.ZoomBy16(origBitmap);
+ }
+ else if (response == MessageBoxResult.Cancel)
+ {
+ this.HideOverlay();
+ return;
+ }
+ }
+
+ // Remove the previous Color to Wall controls and create new ones for this image's colors.
+ if (this.DataContext.ColorToWallControls != null)
+ foreach (var colorToWall in this.DataContext.ColorToWallControls)
+ colorToWall.SelectedColorChanged -= this.ColorToWall_SelectedColorChanged;
+ var newColorToWallControls = new List();
+ foreach (var color in bitmapData.Colors)
+ newColorToWallControls.Add(await ColorToWall.Create(color.Key, color.Value, this.ColorToWall_SelectedColorChanged));
+ this.DataContext.ColorToWallControls = newColorToWallControls;
+
+ // Set the image resolution in the status bar and create the actual bitmaps to display.
+ this.DataContext.ImageWidth = imageWidth;
+ this.DataContext.ImageHeight = imageHeight;
+ this.DataContext.ShowImageResolution = true;
+ this.DataContext.InGameBitmap?.Freeze();
+ this.DataContext.InGameBitmap = new WriteableBitmap(PixelManip.Create(imageWidth * 16, imageHeight * 16, bitmapData.ZoomedPixels));
+ this.DataContext.MapBitmap?.Freeze();
+ this.DataContext.MapBitmap = new WriteableBitmap(PixelManip.Create(imageWidth * 16, imageHeight * 16, bitmapData.ZoomedPixels));
+ bitmapData.ZoomedPixels = null;
+
+ // Create the grid lines.
+ var gridLines = new List();
+ for (int x = 0; x <= imageWidth; ++x)
+ gridLines.Add(new GridLineData()
+ {
+ X1 = x * 16 + 0.5,
+ X2 = x * 16 + 0.5,
+ Y1 = 0.5,
+ Y2 = imageHeight * 16 + 0.5
+ });
+ for (int y = 0; y <= imageHeight; ++y)
+ gridLines.Add(new GridLineData()
+ {
+ X1 = 0.5,
+ X2 = imageWidth * 16 + 0.5,
+ Y1 = y * 16 + 0.5,
+ Y2 = y * 16 + 0.5
+ });
+
+ this.DataContext.GridLines = gridLines;
+ this.DataContext.CurrentBitmapData = bitmapData;
+
+ this.UpdateNeededWallsAndColors();
+
+ this.HideOverlay();
+ }
+
+ public void HideOverlay() => this.overlay.Visibility = Visibility.Hidden;
+
+ void Image_MouseLeave(object sender, MouseEventArgs e) => this.DataContext.ShowPixelStatus = false;
+
+ void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ // If there is no image loaded, ignore clicks, shouldn't be possible as there won't be anything in the first place.
+ var currentBitmapData = this.DataContext.CurrentBitmapData;
+ if (currentBitmapData == null)
+ return;
+ // Get the position of the mouse and convert to pixel coordinates.
+ var point = e.GetPosition(sender as IInputElement);
+ int x = (int)(point.X / 16);
+ int y = (int)(point.Y / 16);
+ // Ignore the mouse if it is outside the image width (I don't think this will actually be able to happen, though).
+ if (x == this.DataContext.ImageWidth || y == this.DataContext.ImageHeight)
+ return;
+ // Find the Color to Wall control matching the color of the pixel, make it flash and bring it into view.
+ var color = currentBitmapData.PixelInfo[(x, y)].Color;
+ int colorIndex = currentBitmapData.Colors.Keys.ToList().IndexOf(color);
+ var colorToWall = this.DataContext.ColorToWallControls[colorIndex];
+ colorToWall.DoFlash();
+ colorToWall.BringIntoView();
+ }
+
+ void Image_MouseMove(object sender, MouseEventArgs e)
+ {
+ // If there is no image loaded, ignore clicks, shouldn't be possible as there won't be anything in the first place.
+ var currentBitmapData = this.DataContext.CurrentBitmapData;
+ if (currentBitmapData == null)
+ return;
+ // Get the position of the mouse and convert to pixel coordinates.
+ var point = e.GetPosition(sender as IInputElement);
+ int x = (int)(point.X / 16);
+ int y = (int)(point.Y / 16);
+ // Ignore the mouse if it is outside the image width (I don't think this will actually be able to happen, though).
+ if (x == this.DataContext.ImageWidth || y == this.DataContext.ImageHeight)
+ return;
+ // Find the Color to Wall control matching the color of the pixel.
+ var color = currentBitmapData.PixelInfo[(x, y)].Color;
+ int colorIndex = currentBitmapData.Colors.Keys.ToList().IndexOf(color);
+ // Set the status to show in the status bar.
+ this.DataContext.ShowPixelStatus = true;
+ this.DataContext.CurrentPixelX = x;
+ this.DataContext.CurrentPixelY = y;
+ this.DataContext.CurrentColorToWall = this.DataContext.ColorToWallControls[colorIndex];
+ }
+
+ void NoOverlay_CanExecute(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = this.overlay.Visibility != Visibility.Visible;
+
+ void OpenFromClipboard_CanExecute(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute = this.overlay.Visibility != Visibility.Visible && Clipboard.ContainsImage();
+
+ async void OpenFromClipboard_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ var dataObject = Clipboard.GetDataObject();
+ // Check each format in the clipboard data, only checking the ones that are memory streams.
+ foreach (string format in dataObject.GetFormats())
+ if (dataObject.GetData(format) is MemoryStream ms)
+ try
+ {
+ // Attempt to load the image as a BitmapImage, will throw an exception if the stream isn't image data that can be read in.
+ var bitmap = new BitmapImage();
+ bitmap.BeginInit();
+ bitmap.CacheOption = BitmapCacheOption.OnLoad;
+ bitmap.StreamSource = ms;
+ bitmap.EndInit();
+ bitmap.Freeze();
+ await this.HandleImage(bitmap);
+ return;
+ }
+ catch (InvalidOperationException)
+ {
+ }
+ catch (NotSupportedException)
+ {
+ }
+ MessageBox.Show(this, "The clipboard did not contain a suitable image.", "Unable to Load", MessageBoxButton.OK, MessageBoxImage.Error);
+ this.HideOverlay();
+ }
+
+ static (string descr, string exts)[] Filters = new[]
+ {
+ (descr: "BMP files", exts: new[] { "bmp", "dib" }),
+ (descr: "JPEF files", exts: new[] { "jpg", "jpeg", "jpe", "jif", "jfif", "jfi" }),
+ (descr: "PNG files", exts: new[] { "png" }),
+ (descr: "TIFF files", exts: new[] { "tiff", "tif" }),
+ (descr: "Windows Media Photo files", exts: new[] { "hdp", "wdp" }),
+ (descr: "GIF files", exts: new[] { "gif" }),
+ (descr: "ICO files", exts: new[] { "ico" })
+ }.Select(x => (x.descr, exts: string.Join(";", x.exts.Select(y => $"*.{y}")))).ToArray();
+ static string AllExts = string.Join(";", MainWindow.Filters.Select(x => x.exts));
+
+ static OpenFileDialog OpenImageDialog = new OpenFileDialog()
+ {
+ Filter = $"Image files ({MainWindow.AllExts})|{MainWindow.AllExts}|{string.Join("|", MainWindow.Filters.Select(x => $"{x.descr} ({x.exts})|{x.exts}"))}|All files (*.*)|*.*",
+ ReadOnlyChecked = true,
+ Title = "Select image..."
+ };
+
+ async void OpenFromFile_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ void OnInvalidImage()
+ {
+ MessageBox.Show(this, "The file you selected could not be loaded as an image.", "Unable to Load", MessageBoxButton.OK, MessageBoxImage.Error);
+ this.HideOverlay();
+ }
+ // Show the Open File dialog and attempt to load the file as a BitmapImage, will throw an exception if the file isn't image data that can be read in.
+ if (MainWindow.OpenImageDialog.ShowDialog(this) ?? false)
+ try
+ {
+ var bitmap = new BitmapImage();
+ using (var stream = File.OpenRead(MainWindow.OpenImageDialog.FileName))
+ {
+ bitmap.BeginInit();
+ bitmap.CacheOption = BitmapCacheOption.OnLoad;
+ bitmap.StreamSource = stream;
+ bitmap.EndInit();
+ }
+ bitmap.Freeze();
+ await this.HandleImage(bitmap);
+ }
+ catch (InvalidOperationException)
+ {
+ OnInvalidImage();
+ }
+ catch (NotSupportedException)
+ {
+ OnInvalidImage();
+ }
+ }
+
+ void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
+ {
+ // Synchronize both scroll viewers to each other.
+ var other = sender == this.inGameScrollViewer ? this.mapScrollViewer : this.inGameScrollViewer;
+ other.ScrollToVerticalOffset(e.VerticalOffset);
+ other.ScrollToHorizontalOffset(e.HorizontalOffset);
+ }
+
+ ///
+ /// Shows the overlay over the main window.
+ ///
+ /// Whether or not we should show the "Please Wait" message.
+ /// An optional wait message to show below "Please Wait".
+ public void ShowOverlay(bool showPleaseWait, string waitMessage = "")
+ {
+ this.overlay.Visibility = Visibility.Visible;
+ this.overlay.DataContext.ShowPleaseWait = showPleaseWait;
+ this.overlay.DataContext.WaitMessage = waitMessage;
+ }
+
+ void ToggleGrid_Executed(object sender, ExecutedRoutedEventArgs e) => this.DataContext.ShowGrid = !this.DataContext.ShowGrid;
+
+ void UpdateNeededWallsAndColors()
+ {
+ // Ignore if there are no ColorToWall controls available yet.
+ if (this.DataContext.ColorToWallControls == null)
+ return;
+ // Collect the number of pixels for each wall and each color.
+ var wallPixels = new Dictionary();
+ var colorPixels = new Dictionary();
+ foreach (var colorToWall in this.DataContext.ColorToWallControls)
+ {
+ string wallName = colorToWall.DataContext.CurrentWallName;
+ if (wallName != "No Wall")
+ {
+ int numberOfPixels = colorToWall.DataContext.NumberOfPixels;
+ wallPixels.TryGetValue(wallName, out int wallPixelsCount);
+ wallPixels[wallName] = wallPixelsCount + numberOfPixels;
+ string colorName = colorToWall.DataContext.SelectedWallColor;
+ if (!string.IsNullOrEmpty(colorName) && colorName != "Uncolored")
+ {
+ colorPixels.TryGetValue(colorName, out int colorPixelsCount);
+ colorPixels[colorName] = colorPixelsCount + numberOfPixels;
+ }
+ }
+ }
+ // Set the text for the walls and colors needed.
+ this.DataContext.WallsText = wallPixels.Count != 0 ? string.Join(Environment.NewLine, wallPixels.OrderBy(wp => wp.Key).Select(wp => $"{wp.Key}: {wp.Value}")) : "";
+ this.DataContext.ColorsText =
+ colorPixels.Count != 0 ? string.Join(Environment.NewLine, colorPixels.OrderBy(cp => ColorToWall.Colors.IndexOf(cp.Key)).Select(cp => $"{cp.Key}: {cp.Value}")) : "";
+ }
+
+ async void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ // Initialize the cache for the Find Closest Color windows on startup, to make it so the first time we create one, it doesn't take forever then.
+ this.ShowOverlay(true, "Initializing...");
+
+ await FindClosestColor.InitializeCache();
+
+ this.HideOverlay();
+ }
+ }
+
+ ///
+ /// The view model for .
+ ///
+ class MainWindowViewModel
+ {
+ ///
+ /// The text for how many of each color will be needed.
+ ///
+ public string ColorsText { get; set; }
+
+ ///
+ /// The controls for each pixel color.
+ ///
+ public List ColorToWallControls { get; set; }
+
+ ///
+ /// The current bitmap's data.
+ ///
+ public BitmapData CurrentBitmapData { get; set; }
+
+ ///
+ /// The current control that is under the mouse cursor.
+ ///
+ public ColorToWall CurrentColorToWall { get; set; }
+
+ ///
+ /// The current X coordinate that is under the mouse cursor.
+ ///
+ public int CurrentPixelX { get; set; }
+
+ ///
+ /// The current Y coordinate that is under the mouse cursor.
+ ///
+ public int CurrentPixelY { get; set; }
+
+ ///
+ /// The list of grid lines to display.
+ ///
+ public List GridLines { get; set; }
+
+ ///
+ /// The height of the current image.
+ ///
+ public int ImageHeight { get; set; }
+
+ ///
+ /// The width of the current image.
+ ///
+ public int ImageWidth { get; set; }
+
+ ///
+ /// The in-game bitmap of the image.
+ ///
+ public WriteableBitmap InGameBitmap { get; set; }
+
+ ///
+ /// The map bitmap of the image.
+ ///
+ public WriteableBitmap MapBitmap { get; set; }
+
+ ///
+ /// True to show the grid, false otherwise.
+ ///
+ public bool ShowGrid { get; set; } = true;
+
+ ///
+ /// True to show the image resolution on the status bar, false otherwise.
+ ///
+ public bool ShowImageResolution { get; set; }
+
+ ///
+ /// True to show the status of the pixel under the mouse cursor, false otherwise.
+ ///
+ public bool ShowPixelStatus { get; set; }
+
+ ///
+ /// The text for how many walls will be needed.
+ ///
+ public string WallsText { get; set; }
+ }
+}
diff --git a/MouseWheelRedirector.cs b/MouseWheelRedirector.cs
deleted file mode 100644
index da05bf5..0000000
--- a/MouseWheelRedirector.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- ///
- /// Redirects mouse wheel events to the control under the cursor.
- ///
- ///
- /// Comes from http://stackoverflow.com/a/4769961
- ///
- public class MouseWheelRedirector : IMessageFilter
- {
- const int WM_MOUSEWHEEL = 0x020A;
-
- public bool PreFilterMessage(ref Message m)
- {
- if (m.Msg == WM_MOUSEWHEEL)
- {
- var hWnd = NativeMethods.WindowFromPoint(new Point(m.LParam.ToInt32() & 0xFFFF, m.LParam.ToInt32() >> 16));
- if (hWnd != IntPtr.Zero && hWnd != m.HWnd && Control.FromHandle(hWnd) != null)
- {
- NativeMethods.SendMessage(hWnd, (uint)m.Msg, m.WParam, m.LParam);
- return true;
- }
- }
- return false;
- }
- }
-}
diff --git a/NativeMethods.cs b/NativeMethods.cs
deleted file mode 100644
index 196dce9..0000000
--- a/NativeMethods.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- ///
- /// Methods that come from outside the .NET Framework using Platform Invoke (P/Invoke).
- ///
- internal static class NativeMethods
- {
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
-
- [DllImport("user32.dll")]
- [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", MessageId = "0",
- Justification = "Windows API POINT is defined using LONG, which is a 32-bit integer. .NET System.Drawing.Point is defined using Int32. There is no portablity issue here.")]
- public static extern IntPtr WindowFromPoint(Point Point);
- }
-}
diff --git a/PixelInfo.cs b/PixelInfo.cs
new file mode 100644
index 0000000..b0922f5
--- /dev/null
+++ b/PixelInfo.cs
@@ -0,0 +1,28 @@
+using System.Windows.Media;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Holds information about a specific pixel.
+ ///
+ internal class PixelInfo
+ {
+ ///
+ /// The color of the pixel.
+ ///
+ public Color Color { get; set; }
+
+ ///
+ /// The current wall name of the pixel.
+ ///
+ public string WallName { get; set; }
+
+ ///
+ /// The current wall frame of the pixel.
+ ///
+ public int WallFrame { get; set; }
+ }
+}
diff --git a/PixelManip.cs b/PixelManip.cs
new file mode 100644
index 0000000..caeffee
--- /dev/null
+++ b/PixelManip.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using PostSharp.Patterns.Contracts;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Pixel manipulation methods.
+ ///
+ internal static class PixelManip
+ {
+ ///
+ /// Copies integer-based pixels from a 16x16 image into another image.
+ ///
+ /// The 16x16 image to copy from.
+ /// The image to copy to.
+ /// The destination X coordinate.
+ /// The destination Y coordinate.
+ /// The width of the destination image.
+ internal static async Task CopyFrom16x16([Required] int[] source, [Required] int[] dest, int x, int y, int width) => await Task.Run(() =>
+ {
+ for (int y2 = 0; y2 < 16; ++y2)
+ Array.Copy(source, y2 * 16, dest, (x + (y * 16 + y2) * width) * 16, 16);
+ });
+
+ ///
+ /// Copies integer-based pixels from a 16x16 image into a .
+ ///
+ /// The 16x16 image to copy from.
+ /// The to copy to.
+ /// The destination X coordinate.
+ /// The destination Y coordinate.
+ /// The width of the destination image.
+ internal static async Task CopyFrom16x16([Required] int[] source, [Required] WriteableBitmap dest, int x, int y, int width)
+ {
+ using (var context = dest.GetBitmapContext())
+ await Task.Run(() =>
+ {
+ for (int y2 = 0; y2 < 16; ++y2)
+ BitmapContext.BlockCopy(source, y2 * 64, context, (x + (y * 16 + y2) * width) * 64, 64);
+ });
+ }
+
+ ///
+ /// Creates a new from the given pixels.
+ ///
+ ///
+ /// Pixel data must be in BGRA format, not premultiplied.
+ ///
+ /// The width of the new bitmap.
+ /// The height of the new bitmap.
+ /// The pixels of the new bitmap.
+ /// The new .
+ internal static BitmapSource Create(int width, int height, [Required] Array pixels) => BitmapSource.Create(width, height, 96, 96, PixelFormats.Bgra32, null, pixels, width * 4);
+ }
+}
diff --git a/Program.cs b/Program.cs
index 36ae512..11d39d3 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,18 +1,20 @@
-// Undefine the following to make the program only create the PNGs and resource file, see below.
+// Undefine the following to make the program only create the PNGs and update the project file, see below.
//#define BUILD_WALLS
using System;
#if BUILD_WALLS
using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Imaging;
using System.IO;
-using System.Resources;
using System.Linq;
-#else
-using System.Windows.Forms;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using Microsoft.Build.Evaluation;
#endif
+[assembly: PostSharp.Patterns.Model.WeakEvent]
+[assembly: PostSharp.Patterns.Model.NotifyPropertyChanged(AttributeTargetTypes = "TerrariaPixelArtHelper.*ViewModel")]
+
///
/// See README.md for extra information regarding the license.
///
@@ -20,7 +22,7 @@
///
/// The MIT License (MIT)
///
-/// Copyright(c) 2013-2017 Naram Qashat
+/// Copyright(c) 2013-2018 Naram Qashat
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
@@ -51,8 +53,8 @@ static class Program
static void Main()
{
#if BUILD_WALLS
- // This section, when enabled, will rebuild the PNG image files of all the acceptable walls, as well as update the resources file to contain all the walls as well as the eyedropper cursor.
- // It does not run the WinForms application, and thus BUILD_WALLS should only be defined at the top of this file when the wall images need rebuilding.
+ // This section, when enabled, will rebuild the PNG image files of all the acceptable walls.
+ // It does not run the WPF application, and thus BUILD_WALLS should only be defined at the top of this file when the wall images need rebuilding.
var walls = new Dictionary()
{
@@ -180,64 +182,64 @@ static void Main()
// Set the below to the path of where you have the PNGs of Terraria's walls, extracted from their XNBs.
string terrariaImagesDirectory = Path.Combine("D:" + Path.DirectorySeparatorChar, "Users", "CyberBotX", "Downloads", "0_TerrariaAssets", "Images");
- foreach (var file in new DirectoryInfo(Path.Combine("..", "..", "..", "WallImages")).EnumerateFiles())
- file.Delete();
+ string wallImagesDirectory = Path.Combine("..", "..", "..", "WallImages");
+ if (Directory.Exists(wallImagesDirectory))
+ foreach (var file in new DirectoryInfo(wallImagesDirectory).EnumerateFiles())
+ file.Delete();
+ else
+ Directory.CreateDirectory(wallImagesDirectory);
- // The following creates the stripped down versions of the walls
+ // Load the project, remove the old items for the WallImages, and create a new group to store the images.
+ var project = new Project(Path.Combine("..", "..", "..", "TerrariaPixelArtHelperWPF.csproj"));
+ foreach (var item in project.Xml.Items.Where(i => i.Include.StartsWith(@"WallImages\")))
+ item.Parent.RemoveChild(item);
+ foreach (var itemGroup in project.Xml.ItemGroups.Where(ig => ig.Count == 0))
+ project.Xml.RemoveChild(itemGroup);
+ var newItemGroup = project.Xml.AddItemGroup();
+
+ // The following creates the stripped down versions of the walls.
foreach (var kvp in walls)
{
- var path = Path.Combine(terrariaImagesDirectory, FormattableString.Invariant($"Wall_{kvp.Key}.png"));
- using (var bitmap = new Bitmap(path))
- using (var newBitmap = new Bitmap(48, 80))
- {
- using (var g = Graphics.FromImage(newBitmap))
- {
- // The locations of these comes from Terraria.Framing for wall frame lookups 15-19
- // The position is the X and Y points multiplied by 36 and then 8 added to them
- // All the portions I an using are 16x16 in size
- // Point 3 of each lookup is not used
- g.DrawImage(bitmap, 0, 0, new Rectangle(44, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 0, Point 0: 1, 1
- g.DrawImage(bitmap, 16, 0, new Rectangle(80, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 0, Point 1: 2, 1
- g.DrawImage(bitmap, 32, 0, new Rectangle(116, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 0, Point 2: 3, 1
- g.DrawImage(bitmap, 0, 16, new Rectangle(224, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 1, Point 0: 6, 1
- g.DrawImage(bitmap, 16, 16, new Rectangle(260, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 1, Point 1: 7, 1
- g.DrawImage(bitmap, 32, 16, new Rectangle(296, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 1, Point 2: 8, 1
- g.DrawImage(bitmap, 0, 32, new Rectangle(224, 80, 16, 16), GraphicsUnit.Pixel); // Lookup 2, Point 0: 6, 2
- g.DrawImage(bitmap, 16, 32, new Rectangle(260, 80, 16, 16), GraphicsUnit.Pixel); // Lookup 2, Point 1: 7, 2
- g.DrawImage(bitmap, 32, 32, new Rectangle(296, 80, 16, 16), GraphicsUnit.Pixel); // Lookup 2, Point 2: 8, 2
- g.DrawImage(bitmap, 0, 48, new Rectangle(368, 8, 16, 16), GraphicsUnit.Pixel); // Lookup 3, Point 0: 10, 0
- g.DrawImage(bitmap, 16, 48, new Rectangle(368, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 3, Point 1: 10, 1
- g.DrawImage(bitmap, 32, 48, new Rectangle(368, 80, 16, 16), GraphicsUnit.Pixel); // Lookup 3, Point 2: 10, 2
- g.DrawImage(bitmap, 0, 64, new Rectangle(404, 8, 16, 16), GraphicsUnit.Pixel); // Lookup 4, Point 0: 11, 0
- g.DrawImage(bitmap, 16, 64, new Rectangle(404, 44, 16, 16), GraphicsUnit.Pixel); // Lookup 4, Point 1: 11, 1
- g.DrawImage(bitmap, 32, 64, new Rectangle(404, 80, 16, 16), GraphicsUnit.Pixel); // Lookup 4, Point 2: 11, 2
- }
- newBitmap.Save(Path.Combine("..", "..", "..", "WallImages", FormattableString.Invariant($"Wall_{kvp.Value}.png")), ImageFormat.Png);
- }
- }
+ var bitmap = new WriteableBitmap(new BitmapImage(new Uri(Path.Combine(terrariaImagesDirectory, $"Wall_{kvp.Key}.png"), UriKind.Absolute)));
+ var newBitmap = new WriteableBitmap(App.WallPixelWidth, App.WallPixelHeight, 96, 96, PixelFormats.Bgra32, null);
+ // The locations of these comes from Terraria.Framing for wall frame lookups 15-19
+ // The position is the X and Y points multiplied by 36 and then 8 added to them
+ // All the portions I an using are 16x16 in size
+ // Point 3 of each lookup is not used
+ newBitmap.Blit(new Rect(0, 0, 16, 16), bitmap, new Rect(44, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 0, Point 0: 1, 1
+ newBitmap.Blit(new Rect(16, 0, 16, 16), bitmap, new Rect(80, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 0, Point 1: 2, 1
+ newBitmap.Blit(new Rect(32, 0, 16, 16), bitmap, new Rect(116, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 0, Point 2: 3, 1
+ newBitmap.Blit(new Rect(0, 16, 16, 16), bitmap, new Rect(224, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 1, Point 0: 6, 1
+ newBitmap.Blit(new Rect(16, 16, 16, 16), bitmap, new Rect(260, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 1, Point 1: 7, 1
+ newBitmap.Blit(new Rect(32, 16, 16, 16), bitmap, new Rect(296, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 1, Point 2: 8, 1
+ newBitmap.Blit(new Rect(0, 32, 16, 16), bitmap, new Rect(224, 80, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 2, Point 0: 6, 2
+ newBitmap.Blit(new Rect(16, 32, 16, 16), bitmap, new Rect(260, 80, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 2, Point 1: 7, 2
+ newBitmap.Blit(new Rect(32, 32, 16, 16), bitmap, new Rect(296, 80, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 2, Point 2: 8, 2
+ newBitmap.Blit(new Rect(0, 48, 16, 16), bitmap, new Rect(368, 8, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 3, Point 0: 10, 0
+ newBitmap.Blit(new Rect(16, 48, 16, 16), bitmap, new Rect(368, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 3, Point 1: 10, 1
+ newBitmap.Blit(new Rect(32, 48, 16, 16), bitmap, new Rect(368, 80, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 3, Point 2: 10, 2
+ newBitmap.Blit(new Rect(0, 64, 16, 16), bitmap, new Rect(404, 8, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 4, Point 0: 11, 0
+ newBitmap.Blit(new Rect(16, 64, 16, 16), bitmap, new Rect(404, 44, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 4, Point 1: 11, 1
+ newBitmap.Blit(new Rect(32, 64, 16, 16), bitmap, new Rect(404, 80, 16, 16), WriteableBitmapExtensions.BlendMode.None); // Lookup 4, Point 2: 11, 2
- // The following recreates the resource file for the program
- Directory.SetCurrentDirectory(Path.Combine("..", "..", "..", "Properties"));
+ using (var stream = File.Create(Path.Combine(wallImagesDirectory, $"Wall_{kvp.Value}.png")))
+ {
+ var encoder = new PngBitmapEncoder();
+ encoder.Frames.Add(BitmapFrame.Create(newBitmap));
+ encoder.Save(stream);
+ }
- using (var writer = new ResXResourceWriter("Resources.resx"))
- {
- writer.AddResource(new ResXDataNode("Eyedropper", new ResXFileRef(Path.Combine("..", "Eyedropper.cur"), typeof(byte[]).AssemblyQualifiedName)));
- var BitmapAssemblyQualifiedName = typeof(Bitmap).AssemblyQualifiedName;
- foreach (var kvp in walls.OrderBy(w => w.Value))
- writer.AddResource(new ResXDataNode(FormattableString.Invariant($"Wall_{kvp.Value}"),
- new ResXFileRef(Path.Combine("..", "WallImages", FormattableString.Invariant($"Wall_{kvp.Value}.png")), BitmapAssemblyQualifiedName)));
-
- writer.Generate();
+ newItemGroup.AddItem("Resource", $@"WallImages\Wall_{kvp.Value}.png");
}
+
+ // Save over the project with the new references
+ project.Save();
#else
- // This section, when enabled, will run the actual WinForms application.
+ // This section, when enabled, will run the actual WPF application.
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- // The mouse wheel redirector doesn't work under Mono due to its lack of a WindowFromPoint function.
- if (Type.GetType("Mono.Runtime") == null)
- Application.AddMessageFilter(new MouseWheelRedirector());
- Application.Run(new MainForm());
+#pragma warning disable IDE0022 // Use expression body for methods
+ App.Main();
+#pragma warning restore IDE0022 // Use expression body for methods
#endif
}
}
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index e07623d..ddb2053 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -1,5 +1,6 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.InteropServices;
+using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -9,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TerrariaPixelArtHelper")]
-[assembly: AssemblyCopyright("© 2013-2017 Naram Qashat")]
+[assembly: AssemblyCopyright("© 2013-2018 Naram Qashat")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -18,8 +19,25 @@
// 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("2ccf508c-1209-4ea3-8233-cc8691732590")]
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
// Version information for an assembly consists of the following four values:
//
@@ -31,5 +49,5 @@
// 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")]
+[assembly: AssemblyVersion("2.0.0.0")]
+[assembly: AssemblyFileVersion("2.0.0.0")]
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
deleted file mode 100644
index d5ec820..0000000
--- a/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,1023 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace TerrariaPixelArtHelper.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TerrariaPixelArtHelper.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Byte[].
- ///
- internal static byte[] Eyedropper {
- get {
- object obj = ResourceManager.GetObject("Eyedropper", resourceCulture);
- return ((byte[])(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_AdamantiteBeamWall {
- get {
- object obj = ResourceManager.GetObject("Wall_AdamantiteBeamWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BlueBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BlueBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BlueDynastyWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BlueDynastyWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BlueSlabWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BlueSlabWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BlueTiledWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BlueTiledWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BoneBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BoneBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BorealWoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BorealWoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_BubblegumBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_BubblegumBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CactusWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CactusWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CandyCaneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CandyCaneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CaveWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CaveWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_ChlorophyteBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_ChlorophyteBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CloudWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CloudWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CobaltBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CobaltBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CopperBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CopperBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CopperPlatingWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CopperPlatingWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CorruptHardenedSandWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CorruptHardenedSandWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CorruptSandstoneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CorruptSandstoneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CrimsonHardenedSandWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CrimsonHardenedSandWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CrimsonSandstoneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CrimsonSandstoneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CrimtaneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CrimtaneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_CrystalWall {
- get {
- object obj = ResourceManager.GetObject("Wall_CrystalWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_DemoniteBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_DemoniteBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_DesertFossilWall {
- get {
- object obj = ResourceManager.GetObject("Wall_DesertFossilWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_DirtWall {
- get {
- object obj = ResourceManager.GetObject("Wall_DirtWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_DiscWall {
- get {
- object obj = ResourceManager.GetObject("Wall_DiscWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_EbonstoneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_EbonstoneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_EbonwoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_EbonwoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_FleshBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_FleshBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_FlowerWall {
- get {
- object obj = ResourceManager.GetObject("Wall_FlowerWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GlassWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GlassWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GoldBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GoldBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GraniteBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GraniteBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GraniteWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GraniteWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GrassWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GrassWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GrayBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GrayBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GrayStuccoWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GrayStuccoWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GreenBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GreenBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GreenCandyCaneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GreenCandyCaneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GreenSlabWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GreenSlabWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GreenStuccoWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GreenStuccoWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_GreenTiledWall {
- get {
- object obj = ResourceManager.GetObject("Wall_GreenTiledWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HallowHardenedSandWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HallowHardenedSandWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HallowSandstoneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HallowSandstoneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HardenedSandWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HardenedSandWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HayWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HayWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HellstoneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HellstoneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_HiveWall {
- get {
- object obj = ResourceManager.GetObject("Wall_HiveWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_IceBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_IceBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_IridescentBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_IridescentBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_JungleWall {
- get {
- object obj = ResourceManager.GetObject("Wall_JungleWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_LavafallWall {
- get {
- object obj = ResourceManager.GetObject("Wall_LavafallWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_LihzahrdBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_LihzahrdBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_LivingWoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_LivingWoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_LunarBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_LunarBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MarbleBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MarbleBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MarbleWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MarbleWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MartianConduitWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MartianConduitWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MeteoriteBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MeteoriteBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MudstoneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MudstoneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MushroomWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MushroomWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_MythrilBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_MythrilBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_ObsidianBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_ObsidianBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PalladiumColumnWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PalladiumColumnWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PalmWoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PalmWoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PearlstoneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PearlstoneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PearlwoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PearlwoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PinkBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PinkBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PinkSlabWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PinkSlabWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PinkTiledWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PinkTiledWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PlatinumBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PlatinumBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_PumpkinWall {
- get {
- object obj = ResourceManager.GetObject("Wall_PumpkinWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_RainbowBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_RainbowBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_RedBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_RedBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_RedStuccoWall {
- get {
- object obj = ResourceManager.GetObject("Wall_RedStuccoWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_RichMahoganyWall {
- get {
- object obj = ResourceManager.GetObject("Wall_RichMahoganyWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SailWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SailWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SandstoneBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SandstoneBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SandstoneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SandstoneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_ShadewoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_ShadewoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_ShroomitePlatingWall {
- get {
- object obj = ResourceManager.GetObject("Wall_ShroomitePlatingWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SilverBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SilverBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SlimeBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SlimeBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SnowBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SnowBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_SpookyWoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_SpookyWoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_StoneSlabWall {
- get {
- object obj = ResourceManager.GetObject("Wall_StoneSlabWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_StoneWall {
- get {
- object obj = ResourceManager.GetObject("Wall_StoneWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_TinBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_TinBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_TinPlatingWall {
- get {
- object obj = ResourceManager.GetObject("Wall_TinPlatingWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_TitanstoneBlockWall {
- get {
- object obj = ResourceManager.GetObject("Wall_TitanstoneBlockWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_TungstenBrickWall {
- get {
- object obj = ResourceManager.GetObject("Wall_TungstenBrickWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_WaterfallWall {
- get {
- object obj = ResourceManager.GetObject("Wall_WaterfallWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_WhiteDynastyWall {
- get {
- object obj = ResourceManager.GetObject("Wall_WhiteDynastyWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_WoodWall {
- get {
- object obj = ResourceManager.GetObject("Wall_WoodWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Wall_YellowStuccoWall {
- get {
- object obj = ResourceManager.GetObject("Wall_YellowStuccoWall", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
- }
-}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
deleted file mode 100644
index 6c1d470..0000000
--- a/Properties/Resources.resx
+++ /dev/null
@@ -1,481 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\Eyedropper.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\WallImages\Wall_AdamantiteBeamWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_AmberGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_AmethystGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BlueBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BlueDynastyWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BluegreenWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BlueSlabWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BlueTiledWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BoneBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BorealWoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BubblegumBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_BubbleWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CactusWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CandyCaneWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CandyCaneWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_ChlorophyteBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_ChristmasTreeWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CloudWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CobaltBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CopperBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CopperPipeWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CopperPlatingWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CrimtaneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_CrystalBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_DemoniteBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_DiamondGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_DirtWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_DiscWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_DuckyWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_EbonstoneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_EbonwoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_EmeraldGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_FancyGrayWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_FestiveWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_FleshBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_FlowerWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GlassWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GoldBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GraniteWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GrassWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GrayBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GrayStuccoWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GreenBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GreenCandyCaneWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GreenSlabWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GreenStuccoWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GreenTiledWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_GrinchFingerWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_HayWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_HellstoneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_HiveWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_IceBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_IceFloeWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_IridescentBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_JungleWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_KrampusHornWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_LihzahrdBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_LivingWoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_LuminiteBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MarbleWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MartianConduitWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MeteoriteBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MudstoneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MushroomWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MusicWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_MythrilBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_ObsidianBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineAmberGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineAmethystGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineDiamondGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineEmeraldGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineRubyGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineSapphireGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OfflineTopazGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_OrnamentWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PalladiumColumnWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PalmWoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PearlstoneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PearlwoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PinkBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PinkSlabWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PinkTiledWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PlatinumBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PumpkinWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_PurpleRainWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_RainbowWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_RedBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_RedStuccoWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_RichMahoganyWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_RubyGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_Sail.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SandstoneBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SapphireGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_ShadewoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_ShroomitePlatingWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SillyGreenBalloonWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SillyPinkBalloonWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SillyPurpleBalloonWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SilverBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SlimeBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SmoothGraniteWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SmoothMarbleWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SnowBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SnowflakeWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SparkleStoneWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SpookyWoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_SquigglesWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_StarlitHeavenWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_StarsWallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_StoneSlabWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_StoneWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_TinBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_TinPlatingWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_TitanstoneBlockWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_TopazGemsparkWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_TungstenBrickWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_WhiteDynastyWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_WoodWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\WallImages\Wall_YellowStuccoWall.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
\ No newline at end of file
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..fc65464
--- /dev/null
+++ b/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace TerrariaPixelArtHelper.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
new file mode 100644
index 0000000..8f2fd95
--- /dev/null
+++ b/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 239c4d2..8b747b0 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Terraria Pixel Art Helper is a program designed to help determine what walls and
(You only need to worry about this if you want to build it yourself instead of using the pre-built executables.)
-Terraria Pixel Art Helper uses C# 6 with the .NET Framework 4.6. You will need a minimum of Visual Studio 2015 to build the program.
+Terraria Pixel Art Helper uses C# 7.2 with the .NET Framework 4.6.2. You will need a minimum of Visual Studio 2017 to build the program.
Normally you can just build the program normally, as all the required files are included. However, if you decide to modify the program to include or exclude certain walls, you will need to build the program in two steps, as follows:
@@ -19,7 +19,7 @@ Normally you can just build the program normally, as all the required files are
This program does not actually interface with Terraria in any way. Rather, it is meant to show what you will need to use within Terraria to represent pixel art using the game's walls.
-1. On loading the program, you must first load an image. This can be done from a file or from the clipboard. **NOTE:** It is recommended that you choose images with low color counts, as high color counts can slow the program down. If you try to load an image that contains more than 256 colors, you will be asked if you want to reduce the color count down to 256.
+1. On loading the program, you must first load an image. This can be done from a file or from the clipboard. **NOTE:** It is recommended that you choose images with low color counts, as high color counts can slow the program down or cause it to crash from running out of memory. If you try to load an image that contains more than 256 colors, you will be asked if you want to reduce the color count down to 256.
2. Once the image is loaded, you can choose the walls and colors to use for each pixel color. This can either be done manually by selecting the wall and color, or it can be done semi-automatically with the "Find Closest Color" option (see below for more information about this option). "Reset" will remove the current wall and color from the pixel. You can also click on a pixel in the actual image to determine which pixel color it corresponds to (the section for that pixel will be scrolled into view and will flash red).
3. After you have selected all the walls and colors, you will have a list of the number of walls and colors needed to represent the image in Terraria. The image's size will show up in the status bar, and when you hover a pixel in the actual image, you will see what wall and color is on that pixel in the status bar.
@@ -31,8 +31,7 @@ From a technical standpoint, the original color as well as all combinations are
## Known Issues
-* Walls with the Deep Sky Blue paint color show up differently in the program than they do in Terraria, but only in-game and not on the map. This is actually an issue with Terraria currently, and not Terraria Pixel Art Helper. I have sent Re-Logic a support ticket about it and they acknowledge that the issue is known but is low priority.
-* The program will momentarily freeze when loading images that are high in color count or dimensions.
+* Walls with the Deep Sky Blue paint color show up differently in the program than they do in Terraria, but only in-game and not on the map. This is actually an issue with Terraria currently, and not Terraria Pixel Art Helper. I have sent Re-Logic a support ticket about it and they acknowledge that the issue is known but is low priority. I have made a note to look into making it so the user can toggle if they want Deep Sky Blue to show up as it does in the game or how it really should be.
* Seems that sometimes walls will not be rendered as well as they should. I may need to take a closer look at Terraria's code to figure out what is wrong.
## Possible TODOs
@@ -42,7 +41,6 @@ From a technical standpoint, the original color as well as all combinations are
* Save and load functionality
* Highlighting of blocks matching certain walls or colors
* Showing the currently selected color of the wall and color combination for each pixel color
-* A throbber when loading images to prevent the UI from looking frozen
* Tabbed interface to allow for multiple images to be loaded together
* Some way to measure pixel distances
* Possibly some way to show the original image
@@ -58,6 +56,19 @@ If you have any questions, comments or concerns about Terraria Pixel Art Helper:
* Contact me on IRC: On the server jenna.cyberbotx.com (I will usually be under CyberBotX)
* Submit an issue via [GitHub's issue tracker](https://github.com/CyberBotX/TerrariaPixelArtHelper/issues)
+## 3rd-Party Resources Utilized
+
+The following libraries have been utilized:
+
+* [CalcBinding](https://github.com/Alex141/CalcBinding) by Alexander Zinchenko
+* [FontAwesome5](https://github.com/MartinTopfstedt/FontAwesome5) by Codinion
+* [JeremyAnsel.ColorQuant](https://github.com/JeremyAnsel/JeremyAnsel.ColorQuant) by Jérémy Ansel
+* [Math.NET Numerics](https://numerics.mathdotnet.com/) by Christoph Ruegg, Marcus Cuda, Jurgen Van Gael
+* [PostSharp](https://www.postsharp.net/) by PostSharp Technologies
+* [WriteableBitmapEx](https://github.com/teichgraf/WriteableBitmapEx) by Schulte Software Development
+
+In addition, the font [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono) by Christian Robertson has been utilized.
+
## License
Certain portions of this program contain resources and code from Terraria itself. This includes:
@@ -68,15 +79,16 @@ Certain portions of this program contain resources and code from Terraria itself
* Colorizing the map colors of wall tiles also comes from decompiling the Terraria executable.
* The names and IDs of the walls also comes from decompiling the Terraria executable.
* The functionality to determine which wall tile to pick based on position and random number also comes from decompiling the Terraria executable.
+* The program icon comes from Terraria directly.
I claim no ownership of the above items, they are copyright to [Re-Logic](https://re-logic.com/). (Any places where the above are used has been documented within the source code.)
-Except where noted within the source code (mainly code that came from Stack Overflow and was not mine originally), the rest of the program is licensed as follows:
+Except where noted within the source code (mainly code that came from Stack Overflow or elsewhere and was not mine originally), the rest of the program is licensed as follows:
```
The MIT License (MIT)
-Copyright (c) 2013-2017 Naram Qashat
+Copyright (c) 2013-2018 Naram Qashat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Terraria.ico b/Terraria.ico
new file mode 100644
index 0000000..1a149eb
Binary files /dev/null and b/Terraria.ico differ
diff --git a/TerrariaPixelArtHelper.csproj b/TerrariaPixelArtHelper.csproj
index 17f4eb6..b77a9c2 100644
--- a/TerrariaPixelArtHelper.csproj
+++ b/TerrariaPixelArtHelper.csproj
@@ -1,19 +1,21 @@
-
+
+
Debug
x86
- 8.0.30703
- 2.0
{96FC9CA3-B8D2-4165-A21D-F3133A7FD061}
WinExe
- Properties
TerrariaPixelArtHelper
TerrariaPixelArtHelper
- v4.6
-
-
+ v4.6.2
512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+ true
+
+
publish\
true
Disk
@@ -29,28 +31,30 @@
false
false
true
+ TerrariaPixelArtHelper.Program
+ Terraria.ico
-
- x86
+
true
- full
- false
bin\x86\Debug\
DEBUG;TRACE
+ full
+ x86
+ 7.2
prompt
- 4
- ..\CBX Rules.ruleset
- false
+ MinimumRecommendedRules.ruleset
+ true
-
- x86
- pdbonly
- true
+
bin\x86\Release\
TRACE
+ true
+ pdbonly
+ x86
+ 7.2
prompt
- 4
- false
+ MinimumRecommendedRules.ruleset
+ true
true
@@ -58,8 +62,9 @@
DEBUG;TRACE
full
x64
+ 7.2
prompt
- ..\CBX Rules.ruleset
+ MinimumRecommendedRules.ruleset
false
@@ -68,86 +73,235 @@
true
pdbonly
x64
+ 7.2
prompt
MinimumRecommendedRules.ruleset
false
-
- TerrariaPixelArtHelper.Program
-
-
- packages\MathNet.Numerics.3.18.0\lib\net40\MathNet.Numerics.dll
-
-
- packages\nQuant.1.0.3\lib\net40\nQuant.Core.dll
- True
-
+
+
+
+
+
-
-
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ About.xaml
+
+
+
+
-
- UserControl
+
+
+
+
+ LoadingOverlay.xaml
-
- ColorToWall.cs
+
+
+
+ UnhandledException.xaml
-
-
- Form
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
-
- FindClosestColor.cs
+
+ ColorToWall.xaml
-
-
-
- Form
+
+ FindClosestColor.xaml
-
- MainForm.cs
+
+
+ MainWindow.xaml
+ Code
-
-
+
+ Designer
+ MSBuild:Compile
+
+
+
-
-
- True
- True
- Resources.resx
+
+ Code
-
- Component
+
+ True
+ Settings.settings
+ True
-
- ColorToWall.cs
-
-
- FindClosestColor.cs
-
-
- MainForm.cs
-
-
- ResXFileCodeGenerator
- Designer
- Resources.Designer.cs
-
-
-
-
-
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
False
- Microsoft .NET Framework 4.6 %28x86 and x64%29
+ Microsoft .NET Framework 4.6.2 %28x86 and x64%29
true
@@ -156,12 +310,31 @@
false
+
+
+
+
+
+ 2.3.0.1
+
+
+ 1.0.6
+
+
+ 1.0.55
+
+
+ 4.6.0
+
+
+ 6.0.29
+
+
+ 4.5.0
+
+
+ 1.5.1
+
+
-
\ No newline at end of file
diff --git a/TerrariaPixelArtHelper.sln b/TerrariaPixelArtHelper.sln
index 077535f..88776fd 100644
--- a/TerrariaPixelArtHelper.sln
+++ b/TerrariaPixelArtHelper.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerrariaPixelArtHelper", "TerrariaPixelArtHelper.csproj", "{96FC9CA3-B8D2-4165-A21D-F3133A7FD061}"
EndProject
@@ -25,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A04F9FE3-9D70-4548-BFB8-B957935DCAB8}
+ EndGlobalSection
EndGlobal
diff --git a/UnhandledException.xaml b/UnhandledException.xaml
new file mode 100644
index 0000000..6e75598
--- /dev/null
+++ b/UnhandledException.xaml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnhandledException.xaml.cs b/UnhandledException.xaml.cs
new file mode 100644
index 0000000..2edc5ba
--- /dev/null
+++ b/UnhandledException.xaml.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Diagnostics;
+using System.Text;
+using System.Windows;
+using FontAwesome5;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// Interaction logic for UnhandledException.xaml
+ ///
+ public partial class UnhandledException : Window
+ {
+ new UnhandledExceptionViewModel DataContext => base.DataContext as UnhandledExceptionViewModel;
+
+ public UnhandledException(Exception exception)
+ {
+ this.InitializeComponent();
+
+ if (exception == null)
+ exception = new Exception("Exception missing???");
+
+ string exceptionType = exception.GetType().ToString();
+ string exceptionMessage = exception.Message;
+ this.DataContext.ExceptionType = exceptionType;
+ this.DataContext.ExceptionMessage = exceptionMessage;
+
+ var sb = new StringBuilder();
+ sb.AppendLine("************** Exception Text **************");
+ sb.AppendLine($"{exceptionType}: {exceptionMessage}");
+ sb.AppendLine(exception.StackTrace);
+ sb.AppendLine();
+ sb.AppendLine("************** Loaded Assemblies **************");
+ foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
+ {
+ var sbAssembly = new StringBuilder();
+ try
+ {
+ var assemblyName = assembly.GetName();
+ sbAssembly.AppendLine(assemblyName.Name);
+ sbAssembly.AppendLine($" Assembly Version: {assemblyName.Version}");
+ sbAssembly.AppendLine($" Win32 Version: {FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion}");
+ sbAssembly.AppendLine($" CodeBase: {assembly.CodeBase}");
+ sbAssembly.AppendLine("----------------------------------------");
+ }
+ catch
+ {
+ continue;
+ }
+ sb.Append(sbAssembly.ToString());
+ }
+ this.DataContext.DetailsText = sb.ToString();
+ }
+
+ void Continue_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = false;
+ this.Close();
+ }
+
+ void Details_Click(object sender, RoutedEventArgs e) => this.DataContext.ShowDetails = !this.DataContext.ShowDetails;
+
+ void Quit_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ this.Close();
+ }
+ }
+
+ ///
+ /// The view model for .
+ ///
+ class UnhandledExceptionViewModel
+ {
+ public EFontAwesomeIcon DetailsIcon => this.ShowDetails ? EFontAwesomeIcon.Solid_CaretUp : EFontAwesomeIcon.Solid_CaretDown;
+
+ public string DetailsText { get; set; }
+
+ public string ExceptionMessage { get; set; }
+
+ public string ExceptionType { get; set; }
+
+ public bool ShowDetails { get; set; }
+ }
+}
diff --git a/WallImages/Wall_AdamantiteBeamWall.png b/WallImages/Wall_AdamantiteBeamWall.png
index 15cd9c1..331a165 100644
Binary files a/WallImages/Wall_AdamantiteBeamWall.png and b/WallImages/Wall_AdamantiteBeamWall.png differ
diff --git a/WallImages/Wall_AmberGemsparkWall.png b/WallImages/Wall_AmberGemsparkWall.png
index 66a4d74..567bbc0 100644
Binary files a/WallImages/Wall_AmberGemsparkWall.png and b/WallImages/Wall_AmberGemsparkWall.png differ
diff --git a/WallImages/Wall_AmethystGemsparkWall.png b/WallImages/Wall_AmethystGemsparkWall.png
index 4f14576..056c403 100644
Binary files a/WallImages/Wall_AmethystGemsparkWall.png and b/WallImages/Wall_AmethystGemsparkWall.png differ
diff --git a/WallImages/Wall_BlueBrickWall.png b/WallImages/Wall_BlueBrickWall.png
index ccea4fa..a135b67 100644
Binary files a/WallImages/Wall_BlueBrickWall.png and b/WallImages/Wall_BlueBrickWall.png differ
diff --git a/WallImages/Wall_BlueDynastyWall.png b/WallImages/Wall_BlueDynastyWall.png
index ea2b4c7..154aee2 100644
Binary files a/WallImages/Wall_BlueDynastyWall.png and b/WallImages/Wall_BlueDynastyWall.png differ
diff --git a/WallImages/Wall_BlueSlabWall.png b/WallImages/Wall_BlueSlabWall.png
index 855f8f4..a4c8648 100644
Binary files a/WallImages/Wall_BlueSlabWall.png and b/WallImages/Wall_BlueSlabWall.png differ
diff --git a/WallImages/Wall_BlueTiledWall.png b/WallImages/Wall_BlueTiledWall.png
index 2b675ff..dcfa2a4 100644
Binary files a/WallImages/Wall_BlueTiledWall.png and b/WallImages/Wall_BlueTiledWall.png differ
diff --git a/WallImages/Wall_BluegreenWallpaper.png b/WallImages/Wall_BluegreenWallpaper.png
index 88d0940..ae1fdd1 100644
Binary files a/WallImages/Wall_BluegreenWallpaper.png and b/WallImages/Wall_BluegreenWallpaper.png differ
diff --git a/WallImages/Wall_BoneBlockWall.png b/WallImages/Wall_BoneBlockWall.png
index 261e223..ad78b30 100644
Binary files a/WallImages/Wall_BoneBlockWall.png and b/WallImages/Wall_BoneBlockWall.png differ
diff --git a/WallImages/Wall_BorealWoodWall.png b/WallImages/Wall_BorealWoodWall.png
index 4fcd5fa..11ffe74 100644
Binary files a/WallImages/Wall_BorealWoodWall.png and b/WallImages/Wall_BorealWoodWall.png differ
diff --git a/WallImages/Wall_BubbleWallpaper.png b/WallImages/Wall_BubbleWallpaper.png
index aa5ef6f..7cdf0c1 100644
Binary files a/WallImages/Wall_BubbleWallpaper.png and b/WallImages/Wall_BubbleWallpaper.png differ
diff --git a/WallImages/Wall_BubblegumBlockWall.png b/WallImages/Wall_BubblegumBlockWall.png
index 4600933..970f437 100644
Binary files a/WallImages/Wall_BubblegumBlockWall.png and b/WallImages/Wall_BubblegumBlockWall.png differ
diff --git a/WallImages/Wall_CactusWall.png b/WallImages/Wall_CactusWall.png
index c6da9c7..e97bf1d 100644
Binary files a/WallImages/Wall_CactusWall.png and b/WallImages/Wall_CactusWall.png differ
diff --git a/WallImages/Wall_CandyCaneWall.png b/WallImages/Wall_CandyCaneWall.png
index e716ba5..f2dba41 100644
Binary files a/WallImages/Wall_CandyCaneWall.png and b/WallImages/Wall_CandyCaneWall.png differ
diff --git a/WallImages/Wall_CandyCaneWallpaper.png b/WallImages/Wall_CandyCaneWallpaper.png
index 6ae65c6..e6e6386 100644
Binary files a/WallImages/Wall_CandyCaneWallpaper.png and b/WallImages/Wall_CandyCaneWallpaper.png differ
diff --git a/WallImages/Wall_ChlorophyteBrickWall.png b/WallImages/Wall_ChlorophyteBrickWall.png
index a32b899..4442cc0 100644
Binary files a/WallImages/Wall_ChlorophyteBrickWall.png and b/WallImages/Wall_ChlorophyteBrickWall.png differ
diff --git a/WallImages/Wall_ChristmasTreeWallpaper.png b/WallImages/Wall_ChristmasTreeWallpaper.png
index 80aeda7..bef9e71 100644
Binary files a/WallImages/Wall_ChristmasTreeWallpaper.png and b/WallImages/Wall_ChristmasTreeWallpaper.png differ
diff --git a/WallImages/Wall_CloudWall.png b/WallImages/Wall_CloudWall.png
index 318c6c6..b131d90 100644
Binary files a/WallImages/Wall_CloudWall.png and b/WallImages/Wall_CloudWall.png differ
diff --git a/WallImages/Wall_CobaltBrickWall.png b/WallImages/Wall_CobaltBrickWall.png
index 5e34b69..52a2fdf 100644
Binary files a/WallImages/Wall_CobaltBrickWall.png and b/WallImages/Wall_CobaltBrickWall.png differ
diff --git a/WallImages/Wall_CopperBrickWall.png b/WallImages/Wall_CopperBrickWall.png
index 88218e3..3b5c0bf 100644
Binary files a/WallImages/Wall_CopperBrickWall.png and b/WallImages/Wall_CopperBrickWall.png differ
diff --git a/WallImages/Wall_CopperPipeWallpaper.png b/WallImages/Wall_CopperPipeWallpaper.png
index 627572a..408af34 100644
Binary files a/WallImages/Wall_CopperPipeWallpaper.png and b/WallImages/Wall_CopperPipeWallpaper.png differ
diff --git a/WallImages/Wall_CopperPlatingWall.png b/WallImages/Wall_CopperPlatingWall.png
index d642c3f..a097b6b 100644
Binary files a/WallImages/Wall_CopperPlatingWall.png and b/WallImages/Wall_CopperPlatingWall.png differ
diff --git a/WallImages/Wall_CrimtaneBrickWall.png b/WallImages/Wall_CrimtaneBrickWall.png
index 11877a4..1851abd 100644
Binary files a/WallImages/Wall_CrimtaneBrickWall.png and b/WallImages/Wall_CrimtaneBrickWall.png differ
diff --git a/WallImages/Wall_CrystalBlockWall.png b/WallImages/Wall_CrystalBlockWall.png
index e9ca42a..3c4849b 100644
Binary files a/WallImages/Wall_CrystalBlockWall.png and b/WallImages/Wall_CrystalBlockWall.png differ
diff --git a/WallImages/Wall_DemoniteBrickWall.png b/WallImages/Wall_DemoniteBrickWall.png
index 39658af..67e05d1 100644
Binary files a/WallImages/Wall_DemoniteBrickWall.png and b/WallImages/Wall_DemoniteBrickWall.png differ
diff --git a/WallImages/Wall_DiamondGemsparkWall.png b/WallImages/Wall_DiamondGemsparkWall.png
index eb5284e..54f49fa 100644
Binary files a/WallImages/Wall_DiamondGemsparkWall.png and b/WallImages/Wall_DiamondGemsparkWall.png differ
diff --git a/WallImages/Wall_DirtWall.png b/WallImages/Wall_DirtWall.png
index 2ead839..f367cba 100644
Binary files a/WallImages/Wall_DirtWall.png and b/WallImages/Wall_DirtWall.png differ
diff --git a/WallImages/Wall_DiscWall.png b/WallImages/Wall_DiscWall.png
index 6c257db..22dc00f 100644
Binary files a/WallImages/Wall_DiscWall.png and b/WallImages/Wall_DiscWall.png differ
diff --git a/WallImages/Wall_DuckyWallpaper.png b/WallImages/Wall_DuckyWallpaper.png
index 7915791..a3e9d9b 100644
Binary files a/WallImages/Wall_DuckyWallpaper.png and b/WallImages/Wall_DuckyWallpaper.png differ
diff --git a/WallImages/Wall_EbonstoneBrickWall.png b/WallImages/Wall_EbonstoneBrickWall.png
index 3ea1adb..6141231 100644
Binary files a/WallImages/Wall_EbonstoneBrickWall.png and b/WallImages/Wall_EbonstoneBrickWall.png differ
diff --git a/WallImages/Wall_EbonwoodWall.png b/WallImages/Wall_EbonwoodWall.png
index 428ab99..c76752c 100644
Binary files a/WallImages/Wall_EbonwoodWall.png and b/WallImages/Wall_EbonwoodWall.png differ
diff --git a/WallImages/Wall_EmeraldGemsparkWall.png b/WallImages/Wall_EmeraldGemsparkWall.png
index 394b789..e4bd95e 100644
Binary files a/WallImages/Wall_EmeraldGemsparkWall.png and b/WallImages/Wall_EmeraldGemsparkWall.png differ
diff --git a/WallImages/Wall_FancyGrayWallpaper.png b/WallImages/Wall_FancyGrayWallpaper.png
index ca674a6..47083df 100644
Binary files a/WallImages/Wall_FancyGrayWallpaper.png and b/WallImages/Wall_FancyGrayWallpaper.png differ
diff --git a/WallImages/Wall_FestiveWallpaper.png b/WallImages/Wall_FestiveWallpaper.png
index 0545142..8fa529a 100644
Binary files a/WallImages/Wall_FestiveWallpaper.png and b/WallImages/Wall_FestiveWallpaper.png differ
diff --git a/WallImages/Wall_FleshBlockWall.png b/WallImages/Wall_FleshBlockWall.png
index 5bc2e6b..43687a5 100644
Binary files a/WallImages/Wall_FleshBlockWall.png and b/WallImages/Wall_FleshBlockWall.png differ
diff --git a/WallImages/Wall_FlowerWall.png b/WallImages/Wall_FlowerWall.png
index cfbb2a0..4b600f9 100644
Binary files a/WallImages/Wall_FlowerWall.png and b/WallImages/Wall_FlowerWall.png differ
diff --git a/WallImages/Wall_GlassWall.png b/WallImages/Wall_GlassWall.png
index e7e10fd..da905ce 100644
Binary files a/WallImages/Wall_GlassWall.png and b/WallImages/Wall_GlassWall.png differ
diff --git a/WallImages/Wall_GoldBrickWall.png b/WallImages/Wall_GoldBrickWall.png
index b931429..d0e387e 100644
Binary files a/WallImages/Wall_GoldBrickWall.png and b/WallImages/Wall_GoldBrickWall.png differ
diff --git a/WallImages/Wall_GraniteWall.png b/WallImages/Wall_GraniteWall.png
index 44722be..7e04a1b 100644
Binary files a/WallImages/Wall_GraniteWall.png and b/WallImages/Wall_GraniteWall.png differ
diff --git a/WallImages/Wall_GrassWall.png b/WallImages/Wall_GrassWall.png
index baa72b5..add0c55 100644
Binary files a/WallImages/Wall_GrassWall.png and b/WallImages/Wall_GrassWall.png differ
diff --git a/WallImages/Wall_GrayBrickWall.png b/WallImages/Wall_GrayBrickWall.png
index fb5517d..82d4e91 100644
Binary files a/WallImages/Wall_GrayBrickWall.png and b/WallImages/Wall_GrayBrickWall.png differ
diff --git a/WallImages/Wall_GrayStuccoWall.png b/WallImages/Wall_GrayStuccoWall.png
index 2f6e127..834c56f 100644
Binary files a/WallImages/Wall_GrayStuccoWall.png and b/WallImages/Wall_GrayStuccoWall.png differ
diff --git a/WallImages/Wall_GreenBrickWall.png b/WallImages/Wall_GreenBrickWall.png
index 2f6145c..47f3916 100644
Binary files a/WallImages/Wall_GreenBrickWall.png and b/WallImages/Wall_GreenBrickWall.png differ
diff --git a/WallImages/Wall_GreenCandyCaneWall.png b/WallImages/Wall_GreenCandyCaneWall.png
index b51d310..b0b7389 100644
Binary files a/WallImages/Wall_GreenCandyCaneWall.png and b/WallImages/Wall_GreenCandyCaneWall.png differ
diff --git a/WallImages/Wall_GreenSlabWall.png b/WallImages/Wall_GreenSlabWall.png
index 966b097..842d92e 100644
Binary files a/WallImages/Wall_GreenSlabWall.png and b/WallImages/Wall_GreenSlabWall.png differ
diff --git a/WallImages/Wall_GreenStuccoWall.png b/WallImages/Wall_GreenStuccoWall.png
index 3f6a170..2797dbe 100644
Binary files a/WallImages/Wall_GreenStuccoWall.png and b/WallImages/Wall_GreenStuccoWall.png differ
diff --git a/WallImages/Wall_GreenTiledWall.png b/WallImages/Wall_GreenTiledWall.png
index 1a55652..b81a75c 100644
Binary files a/WallImages/Wall_GreenTiledWall.png and b/WallImages/Wall_GreenTiledWall.png differ
diff --git a/WallImages/Wall_GrinchFingerWallpaper.png b/WallImages/Wall_GrinchFingerWallpaper.png
index 9c2e824..a6d3d4b 100644
Binary files a/WallImages/Wall_GrinchFingerWallpaper.png and b/WallImages/Wall_GrinchFingerWallpaper.png differ
diff --git a/WallImages/Wall_HayWall.png b/WallImages/Wall_HayWall.png
index 743a229..212d846 100644
Binary files a/WallImages/Wall_HayWall.png and b/WallImages/Wall_HayWall.png differ
diff --git a/WallImages/Wall_HellstoneBrickWall.png b/WallImages/Wall_HellstoneBrickWall.png
index 206e7a6..77512ea 100644
Binary files a/WallImages/Wall_HellstoneBrickWall.png and b/WallImages/Wall_HellstoneBrickWall.png differ
diff --git a/WallImages/Wall_HiveWall.png b/WallImages/Wall_HiveWall.png
index d6f0d60..9def0cd 100644
Binary files a/WallImages/Wall_HiveWall.png and b/WallImages/Wall_HiveWall.png differ
diff --git a/WallImages/Wall_IceBrickWall.png b/WallImages/Wall_IceBrickWall.png
index e629a90..9aee669 100644
Binary files a/WallImages/Wall_IceBrickWall.png and b/WallImages/Wall_IceBrickWall.png differ
diff --git a/WallImages/Wall_IceFloeWallpaper.png b/WallImages/Wall_IceFloeWallpaper.png
index f52c5af..a83ac13 100644
Binary files a/WallImages/Wall_IceFloeWallpaper.png and b/WallImages/Wall_IceFloeWallpaper.png differ
diff --git a/WallImages/Wall_IridescentBrickWall.png b/WallImages/Wall_IridescentBrickWall.png
index c8b18af..1352822 100644
Binary files a/WallImages/Wall_IridescentBrickWall.png and b/WallImages/Wall_IridescentBrickWall.png differ
diff --git a/WallImages/Wall_JungleWall.png b/WallImages/Wall_JungleWall.png
index 82f126d..9922108 100644
Binary files a/WallImages/Wall_JungleWall.png and b/WallImages/Wall_JungleWall.png differ
diff --git a/WallImages/Wall_KrampusHornWallpaper.png b/WallImages/Wall_KrampusHornWallpaper.png
index c0d9124..191e5d6 100644
Binary files a/WallImages/Wall_KrampusHornWallpaper.png and b/WallImages/Wall_KrampusHornWallpaper.png differ
diff --git a/WallImages/Wall_LihzahrdBrickWall.png b/WallImages/Wall_LihzahrdBrickWall.png
index ea30303..539af12 100644
Binary files a/WallImages/Wall_LihzahrdBrickWall.png and b/WallImages/Wall_LihzahrdBrickWall.png differ
diff --git a/WallImages/Wall_LivingWoodWall.png b/WallImages/Wall_LivingWoodWall.png
index 62cd4a2..f776d2b 100644
Binary files a/WallImages/Wall_LivingWoodWall.png and b/WallImages/Wall_LivingWoodWall.png differ
diff --git a/WallImages/Wall_LuminiteBrickWall.png b/WallImages/Wall_LuminiteBrickWall.png
index 3bff8d0..a6ba027 100644
Binary files a/WallImages/Wall_LuminiteBrickWall.png and b/WallImages/Wall_LuminiteBrickWall.png differ
diff --git a/WallImages/Wall_MarbleWall.png b/WallImages/Wall_MarbleWall.png
index 7363eb1..9edf270 100644
Binary files a/WallImages/Wall_MarbleWall.png and b/WallImages/Wall_MarbleWall.png differ
diff --git a/WallImages/Wall_MartianConduitWall.png b/WallImages/Wall_MartianConduitWall.png
index 93d5cab..a9ee483 100644
Binary files a/WallImages/Wall_MartianConduitWall.png and b/WallImages/Wall_MartianConduitWall.png differ
diff --git a/WallImages/Wall_MeteoriteBrickWall.png b/WallImages/Wall_MeteoriteBrickWall.png
index 6a7523e..ea7bd2e 100644
Binary files a/WallImages/Wall_MeteoriteBrickWall.png and b/WallImages/Wall_MeteoriteBrickWall.png differ
diff --git a/WallImages/Wall_MudstoneBrickWall.png b/WallImages/Wall_MudstoneBrickWall.png
index 7c21e61..f046427 100644
Binary files a/WallImages/Wall_MudstoneBrickWall.png and b/WallImages/Wall_MudstoneBrickWall.png differ
diff --git a/WallImages/Wall_MushroomWall.png b/WallImages/Wall_MushroomWall.png
index 77c3083..623b763 100644
Binary files a/WallImages/Wall_MushroomWall.png and b/WallImages/Wall_MushroomWall.png differ
diff --git a/WallImages/Wall_MusicWallpaper.png b/WallImages/Wall_MusicWallpaper.png
index 0f4cb73..a45d953 100644
Binary files a/WallImages/Wall_MusicWallpaper.png and b/WallImages/Wall_MusicWallpaper.png differ
diff --git a/WallImages/Wall_MythrilBrickWall.png b/WallImages/Wall_MythrilBrickWall.png
index fa603f2..e8245f1 100644
Binary files a/WallImages/Wall_MythrilBrickWall.png and b/WallImages/Wall_MythrilBrickWall.png differ
diff --git a/WallImages/Wall_ObsidianBrickWall.png b/WallImages/Wall_ObsidianBrickWall.png
index a123037..5d8bf29 100644
Binary files a/WallImages/Wall_ObsidianBrickWall.png and b/WallImages/Wall_ObsidianBrickWall.png differ
diff --git a/WallImages/Wall_OfflineAmberGemsparkWall.png b/WallImages/Wall_OfflineAmberGemsparkWall.png
index 57bbf1e..0f0e97d 100644
Binary files a/WallImages/Wall_OfflineAmberGemsparkWall.png and b/WallImages/Wall_OfflineAmberGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineAmethystGemsparkWall.png b/WallImages/Wall_OfflineAmethystGemsparkWall.png
index 0ff027b..45d59bf 100644
Binary files a/WallImages/Wall_OfflineAmethystGemsparkWall.png and b/WallImages/Wall_OfflineAmethystGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineDiamondGemsparkWall.png b/WallImages/Wall_OfflineDiamondGemsparkWall.png
index 975327e..8b0dc55 100644
Binary files a/WallImages/Wall_OfflineDiamondGemsparkWall.png and b/WallImages/Wall_OfflineDiamondGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineEmeraldGemsparkWall.png b/WallImages/Wall_OfflineEmeraldGemsparkWall.png
index 1b1a17c..022c6f6 100644
Binary files a/WallImages/Wall_OfflineEmeraldGemsparkWall.png and b/WallImages/Wall_OfflineEmeraldGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineRubyGemsparkWall.png b/WallImages/Wall_OfflineRubyGemsparkWall.png
index 6470840..54ce20b 100644
Binary files a/WallImages/Wall_OfflineRubyGemsparkWall.png and b/WallImages/Wall_OfflineRubyGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineSapphireGemsparkWall.png b/WallImages/Wall_OfflineSapphireGemsparkWall.png
index c7e6b03..10bead6 100644
Binary files a/WallImages/Wall_OfflineSapphireGemsparkWall.png and b/WallImages/Wall_OfflineSapphireGemsparkWall.png differ
diff --git a/WallImages/Wall_OfflineTopazGemsparkWall.png b/WallImages/Wall_OfflineTopazGemsparkWall.png
index 7cb44d3..c37a05c 100644
Binary files a/WallImages/Wall_OfflineTopazGemsparkWall.png and b/WallImages/Wall_OfflineTopazGemsparkWall.png differ
diff --git a/WallImages/Wall_OrnamentWallpaper.png b/WallImages/Wall_OrnamentWallpaper.png
index cb3212c..5cec8d9 100644
Binary files a/WallImages/Wall_OrnamentWallpaper.png and b/WallImages/Wall_OrnamentWallpaper.png differ
diff --git a/WallImages/Wall_PalladiumColumnWall.png b/WallImages/Wall_PalladiumColumnWall.png
index 610e042..d886cfa 100644
Binary files a/WallImages/Wall_PalladiumColumnWall.png and b/WallImages/Wall_PalladiumColumnWall.png differ
diff --git a/WallImages/Wall_PalmWoodWall.png b/WallImages/Wall_PalmWoodWall.png
index cfbc563..bdaf32c 100644
Binary files a/WallImages/Wall_PalmWoodWall.png and b/WallImages/Wall_PalmWoodWall.png differ
diff --git a/WallImages/Wall_PearlstoneBrickWall.png b/WallImages/Wall_PearlstoneBrickWall.png
index b6707c4..b6dc769 100644
Binary files a/WallImages/Wall_PearlstoneBrickWall.png and b/WallImages/Wall_PearlstoneBrickWall.png differ
diff --git a/WallImages/Wall_PearlwoodWall.png b/WallImages/Wall_PearlwoodWall.png
index c69600f..3462914 100644
Binary files a/WallImages/Wall_PearlwoodWall.png and b/WallImages/Wall_PearlwoodWall.png differ
diff --git a/WallImages/Wall_PinkBrickWall.png b/WallImages/Wall_PinkBrickWall.png
index 870be0f..559f4b3 100644
Binary files a/WallImages/Wall_PinkBrickWall.png and b/WallImages/Wall_PinkBrickWall.png differ
diff --git a/WallImages/Wall_PinkSlabWall.png b/WallImages/Wall_PinkSlabWall.png
index eab1f72..2644e64 100644
Binary files a/WallImages/Wall_PinkSlabWall.png and b/WallImages/Wall_PinkSlabWall.png differ
diff --git a/WallImages/Wall_PinkTiledWall.png b/WallImages/Wall_PinkTiledWall.png
index 4c390ee..b29ac61 100644
Binary files a/WallImages/Wall_PinkTiledWall.png and b/WallImages/Wall_PinkTiledWall.png differ
diff --git a/WallImages/Wall_PlatinumBrickWall.png b/WallImages/Wall_PlatinumBrickWall.png
index e5727c8..37c9eca 100644
Binary files a/WallImages/Wall_PlatinumBrickWall.png and b/WallImages/Wall_PlatinumBrickWall.png differ
diff --git a/WallImages/Wall_PumpkinWall.png b/WallImages/Wall_PumpkinWall.png
index 767c0da..49c63b8 100644
Binary files a/WallImages/Wall_PumpkinWall.png and b/WallImages/Wall_PumpkinWall.png differ
diff --git a/WallImages/Wall_PurpleRainWallpaper.png b/WallImages/Wall_PurpleRainWallpaper.png
index 32dc9fd..85269c7 100644
Binary files a/WallImages/Wall_PurpleRainWallpaper.png and b/WallImages/Wall_PurpleRainWallpaper.png differ
diff --git a/WallImages/Wall_RainbowWallpaper.png b/WallImages/Wall_RainbowWallpaper.png
index d118bdd..a0c1144 100644
Binary files a/WallImages/Wall_RainbowWallpaper.png and b/WallImages/Wall_RainbowWallpaper.png differ
diff --git a/WallImages/Wall_RedBrickWall.png b/WallImages/Wall_RedBrickWall.png
index 6c55f42..119858f 100644
Binary files a/WallImages/Wall_RedBrickWall.png and b/WallImages/Wall_RedBrickWall.png differ
diff --git a/WallImages/Wall_RedStuccoWall.png b/WallImages/Wall_RedStuccoWall.png
index 2ba3d01..63ac163 100644
Binary files a/WallImages/Wall_RedStuccoWall.png and b/WallImages/Wall_RedStuccoWall.png differ
diff --git a/WallImages/Wall_RichMahoganyWall.png b/WallImages/Wall_RichMahoganyWall.png
index e8def87..1eb7a80 100644
Binary files a/WallImages/Wall_RichMahoganyWall.png and b/WallImages/Wall_RichMahoganyWall.png differ
diff --git a/WallImages/Wall_RubyGemsparkWall.png b/WallImages/Wall_RubyGemsparkWall.png
index 3eb30bc..7d7934c 100644
Binary files a/WallImages/Wall_RubyGemsparkWall.png and b/WallImages/Wall_RubyGemsparkWall.png differ
diff --git a/WallImages/Wall_Sail.png b/WallImages/Wall_Sail.png
index 4046d8e..9667780 100644
Binary files a/WallImages/Wall_Sail.png and b/WallImages/Wall_Sail.png differ
diff --git a/WallImages/Wall_SandstoneBrickWall.png b/WallImages/Wall_SandstoneBrickWall.png
index 4917915..c23498d 100644
Binary files a/WallImages/Wall_SandstoneBrickWall.png and b/WallImages/Wall_SandstoneBrickWall.png differ
diff --git a/WallImages/Wall_SapphireGemsparkWall.png b/WallImages/Wall_SapphireGemsparkWall.png
index b17133c..db04700 100644
Binary files a/WallImages/Wall_SapphireGemsparkWall.png and b/WallImages/Wall_SapphireGemsparkWall.png differ
diff --git a/WallImages/Wall_ShadewoodWall.png b/WallImages/Wall_ShadewoodWall.png
index 62ce8df..8b1403b 100644
Binary files a/WallImages/Wall_ShadewoodWall.png and b/WallImages/Wall_ShadewoodWall.png differ
diff --git a/WallImages/Wall_ShroomitePlatingWall.png b/WallImages/Wall_ShroomitePlatingWall.png
index f1d9da6..b82bbba 100644
Binary files a/WallImages/Wall_ShroomitePlatingWall.png and b/WallImages/Wall_ShroomitePlatingWall.png differ
diff --git a/WallImages/Wall_SillyGreenBalloonWall.png b/WallImages/Wall_SillyGreenBalloonWall.png
index 3a2101a..a87c953 100644
Binary files a/WallImages/Wall_SillyGreenBalloonWall.png and b/WallImages/Wall_SillyGreenBalloonWall.png differ
diff --git a/WallImages/Wall_SillyPinkBalloonWall.png b/WallImages/Wall_SillyPinkBalloonWall.png
index 22acb95..7ccc48e 100644
Binary files a/WallImages/Wall_SillyPinkBalloonWall.png and b/WallImages/Wall_SillyPinkBalloonWall.png differ
diff --git a/WallImages/Wall_SillyPurpleBalloonWall.png b/WallImages/Wall_SillyPurpleBalloonWall.png
index 6a334db..70fe97b 100644
Binary files a/WallImages/Wall_SillyPurpleBalloonWall.png and b/WallImages/Wall_SillyPurpleBalloonWall.png differ
diff --git a/WallImages/Wall_SilverBrickWall.png b/WallImages/Wall_SilverBrickWall.png
index 751c462..f448d16 100644
Binary files a/WallImages/Wall_SilverBrickWall.png and b/WallImages/Wall_SilverBrickWall.png differ
diff --git a/WallImages/Wall_SlimeBlockWall.png b/WallImages/Wall_SlimeBlockWall.png
index c531d25..e72dd1e 100644
Binary files a/WallImages/Wall_SlimeBlockWall.png and b/WallImages/Wall_SlimeBlockWall.png differ
diff --git a/WallImages/Wall_SmoothGraniteWall.png b/WallImages/Wall_SmoothGraniteWall.png
index f259733..8311c2e 100644
Binary files a/WallImages/Wall_SmoothGraniteWall.png and b/WallImages/Wall_SmoothGraniteWall.png differ
diff --git a/WallImages/Wall_SmoothMarbleWall.png b/WallImages/Wall_SmoothMarbleWall.png
index efa8a92..a58bb5b 100644
Binary files a/WallImages/Wall_SmoothMarbleWall.png and b/WallImages/Wall_SmoothMarbleWall.png differ
diff --git a/WallImages/Wall_SnowBrickWall.png b/WallImages/Wall_SnowBrickWall.png
index c91e0b8..786b561 100644
Binary files a/WallImages/Wall_SnowBrickWall.png and b/WallImages/Wall_SnowBrickWall.png differ
diff --git a/WallImages/Wall_SnowflakeWallpaper.png b/WallImages/Wall_SnowflakeWallpaper.png
index 7f8bac2..03907c4 100644
Binary files a/WallImages/Wall_SnowflakeWallpaper.png and b/WallImages/Wall_SnowflakeWallpaper.png differ
diff --git a/WallImages/Wall_SparkleStoneWallpaper.png b/WallImages/Wall_SparkleStoneWallpaper.png
index b094476..c098c5b 100644
Binary files a/WallImages/Wall_SparkleStoneWallpaper.png and b/WallImages/Wall_SparkleStoneWallpaper.png differ
diff --git a/WallImages/Wall_SpookyWoodWall.png b/WallImages/Wall_SpookyWoodWall.png
index fde46e5..a2a0549 100644
Binary files a/WallImages/Wall_SpookyWoodWall.png and b/WallImages/Wall_SpookyWoodWall.png differ
diff --git a/WallImages/Wall_SquigglesWallpaper.png b/WallImages/Wall_SquigglesWallpaper.png
index 8d2c9b3..5b03d6b 100644
Binary files a/WallImages/Wall_SquigglesWallpaper.png and b/WallImages/Wall_SquigglesWallpaper.png differ
diff --git a/WallImages/Wall_StarlitHeavenWallpaper.png b/WallImages/Wall_StarlitHeavenWallpaper.png
index 3cdc459..881512c 100644
Binary files a/WallImages/Wall_StarlitHeavenWallpaper.png and b/WallImages/Wall_StarlitHeavenWallpaper.png differ
diff --git a/WallImages/Wall_StarsWallpaper.png b/WallImages/Wall_StarsWallpaper.png
index 087059c..89d4276 100644
Binary files a/WallImages/Wall_StarsWallpaper.png and b/WallImages/Wall_StarsWallpaper.png differ
diff --git a/WallImages/Wall_StoneSlabWall.png b/WallImages/Wall_StoneSlabWall.png
index 0784592..ff1947a 100644
Binary files a/WallImages/Wall_StoneSlabWall.png and b/WallImages/Wall_StoneSlabWall.png differ
diff --git a/WallImages/Wall_StoneWall.png b/WallImages/Wall_StoneWall.png
index 1229d61..38dde90 100644
Binary files a/WallImages/Wall_StoneWall.png and b/WallImages/Wall_StoneWall.png differ
diff --git a/WallImages/Wall_TinBrickWall.png b/WallImages/Wall_TinBrickWall.png
index 2ea034d..1308bcf 100644
Binary files a/WallImages/Wall_TinBrickWall.png and b/WallImages/Wall_TinBrickWall.png differ
diff --git a/WallImages/Wall_TinPlatingWall.png b/WallImages/Wall_TinPlatingWall.png
index a8d5465..c04b5fe 100644
Binary files a/WallImages/Wall_TinPlatingWall.png and b/WallImages/Wall_TinPlatingWall.png differ
diff --git a/WallImages/Wall_TitanstoneBlockWall.png b/WallImages/Wall_TitanstoneBlockWall.png
index 0b7d04c..bad1e8b 100644
Binary files a/WallImages/Wall_TitanstoneBlockWall.png and b/WallImages/Wall_TitanstoneBlockWall.png differ
diff --git a/WallImages/Wall_TopazGemsparkWall.png b/WallImages/Wall_TopazGemsparkWall.png
index f767cda..f2bcdc9 100644
Binary files a/WallImages/Wall_TopazGemsparkWall.png and b/WallImages/Wall_TopazGemsparkWall.png differ
diff --git a/WallImages/Wall_TungstenBrickWall.png b/WallImages/Wall_TungstenBrickWall.png
index 24adf65..a749927 100644
Binary files a/WallImages/Wall_TungstenBrickWall.png and b/WallImages/Wall_TungstenBrickWall.png differ
diff --git a/WallImages/Wall_WhiteDynastyWall.png b/WallImages/Wall_WhiteDynastyWall.png
index d9e609c..de9e84f 100644
Binary files a/WallImages/Wall_WhiteDynastyWall.png and b/WallImages/Wall_WhiteDynastyWall.png differ
diff --git a/WallImages/Wall_WoodWall.png b/WallImages/Wall_WoodWall.png
index 4100258..2a713e5 100644
Binary files a/WallImages/Wall_WoodWall.png and b/WallImages/Wall_WoodWall.png differ
diff --git a/WallImages/Wall_YellowStuccoWall.png b/WallImages/Wall_YellowStuccoWall.png
index 12b604b..10947b7 100644
Binary files a/WallImages/Wall_YellowStuccoWall.png and b/WallImages/Wall_YellowStuccoWall.png differ
diff --git a/WallItem.cs b/WallItem.cs
new file mode 100644
index 0000000..f46e324
--- /dev/null
+++ b/WallItem.cs
@@ -0,0 +1,48 @@
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+using PostSharp.Patterns.Contracts;
+using PostSharp.Patterns.Model;
+
+///
+/// See Program.cs for license.
+///
+namespace TerrariaPixelArtHelper
+{
+ ///
+ /// The item type to store within a combo box of a control.
+ ///
+ [DebuggerDisplay("{Name,nq}")]
+ [NotifyPropertyChanged]
+ public class WallItem
+ {
+ static readonly ConcurrentDictionary> wallItemsCache = new ConcurrentDictionary>();
+
+ ///
+ /// Gets or sets this wall's name.
+ ///
+ public string Name { get; private set; }
+
+ ///
+ /// Gets or sets this wall's image, if any.
+ ///
+ public BitmapSource Image { get; private set; }
+
+ ///
+ /// Creates a new with an image, if possible.
+ ///
+ /// The name of the wall.
+ /// A new .
+ internal static async Task Create([Required] string wallName) => await WallItem.wallItemsCache.GetOrAdd(wallName, async key =>
+ {
+ var wallItem = new WallItem()
+ {
+ Name = wallName
+ };
+ if (!string.IsNullOrWhiteSpace(wallName))
+ wallItem.Image = await App.GetWallFrame(wallName, "Uncolored", 0, 0, 0);
+ return wallItem;
+ });
+ }
+}
diff --git a/WallSelector.cs b/WallSelector.cs
deleted file mode 100644
index 5b921ed..0000000
--- a/WallSelector.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Drawing;
-using System.Windows.Forms;
-
-///
-/// See Program.cs for license.
-///
-namespace TerrariaPixelArtHelper
-{
- ///
- /// A custom ComboBox that draws a small 16x16 image of the selected wall next to the wall's name.
- ///
- public class WallSelector : ComboBox
- {
- public WallSelector() : base()
- {
- base.DrawMode = DrawMode.OwnerDrawVariable;
- this.DropDownStyle = ComboBoxStyle.DropDownList;
- }
-
- protected override void OnDrawItem(DrawItemEventArgs e)
- {
- e.DrawBackground();
- e.DrawFocusRectangle();
-
- if (e.Index >= 0 && e.Index < this.Items.Count)
- {
- var item = this.Items[e.Index] as WallItem;
- if (item.Image != null)
- e.Graphics.DrawImage(item.Image, e.Bounds.Left, e.Bounds.Top + 1);
- using (var brush = new SolidBrush(e.ForeColor))
- e.Graphics.DrawString(item.Name, e.Font, brush, e.Bounds.Left + (item.Image?.Width ?? 16), e.Bounds.Top + 1);
- }
-
- base.OnDrawItem(e);
- }
-
- protected override void OnMeasureItem(MeasureItemEventArgs e) => e.ItemHeight = 18;
-
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This is overriding an existing property in the parent type and cannot be static.")]
- [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value",
- Justification = "This is overriding an existing property in the parent type and I don't want it set through here.")]
- public new DrawMode DrawMode
- {
- get { return DrawMode.OwnerDrawVariable; }
- set { }
- }
- }
-
- ///
- /// The item type to store within a combo box.
- ///
- [Serializable]
- public class WallItem : IEquatable
- {
- string name = null;
- Image image = null;
-
- ///
- /// Gets or sets this wall's name.
- ///
- public string Name
- {
- get { return this.name; }
- set
- {
- this.name = value;
- if (string.IsNullOrWhiteSpace(value))
- this.Image = null;
- else
- {
- var wallImage = MainForm.GetWall(value);
- this.Image = new Bitmap(16, 16);
- if (wallImage != null)
- using (var g = Graphics.FromImage(this.Image))
- g.DrawImage(wallImage, 0, 0, new Rectangle(0, 0, 16, 16), GraphicsUnit.Pixel);
- }
- }
- }
-
- ///
- /// Gets or sets this wall's image, if any.
- ///
- public Image Image
- {
- get { return this.image; }
- private set
- {
- this.image?.Dispose();
- this.image = value;
- }
- }
-
- public WallItem() : this(null)
- {
- }
-
- public WallItem(string wallName)
- {
- this.Name = wallName;
- }
-
- public static implicit operator WallItem(string wallName) => new WallItem(wallName);
-
- public override string ToString() => string.IsNullOrWhiteSpace(this.Name) ? "WallItem" : this.Name;
-
- ///
- /// Determine if the given matches this one. They match if their names are the same.
- ///
- /// The other to match against.
- /// true if both match, false otherwise.
- public bool Equals(WallItem other) => this.Name == other.Name;
- }
-}
diff --git a/app.config b/app.config
index b45f31e..e89424b 100644
--- a/app.config
+++ b/app.config
@@ -1,3 +1,6 @@
-
-
-
+
+
+
+
+
+
diff --git a/packages.config b/packages.config
deleted file mode 100644
index 51c70ea..0000000
--- a/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/postsharp.config b/postsharp.config
new file mode 100644
index 0000000..24c180f
--- /dev/null
+++ b/postsharp.config
@@ -0,0 +1,4 @@
+
+
+
+